Loading cmds/sm/src/com/android/commands/sm/Sm.java +11 −0 Original line number Diff line number Diff line Loading @@ -107,6 +107,8 @@ public final class Sm { runStartCheckpoint(); } else if ("supports-checkpoint".equals(op)) { runSupportsCheckpoint(); } else if ("unmount-app-data-dirs".equals(op)) { runDisableAppDataIsolation(); } else { throw new IllegalArgumentException(); } Loading Loading @@ -253,6 +255,13 @@ public final class Sm { System.out.println(result.get()); } public void runDisableAppDataIsolation() throws RemoteException { final String pkgName = nextArg(); final int pid = Integer.parseInt(nextArg()); final int userId = Integer.parseInt(nextArg()); mSm.disableAppDataIsolation(pkgName, pid, userId); } public void runForget() throws RemoteException { final String fsUuid = nextArg(); if ("all".equals(fsUuid)) { Loading Loading @@ -373,6 +382,8 @@ public final class Sm { System.err.println(""); System.err.println(" sm supports-checkpoint"); System.err.println(""); System.err.println(" sm unmount-app-data-dirs PACKAGE_NAME PID USER_ID"); System.err.println(""); return 1; } } core/java/android/os/storage/IStorageManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -195,4 +195,5 @@ interface IStorageManager { void abortChanges(in String message, boolean retry) = 87; void clearUserKeyAuth(int userId, int serialNumber, in byte[] token, in byte[] secret) = 88; void fixupAppDir(in String path) = 89; void disableAppDataIsolation(in String pkgName, int pid, int userId) = 90; } services/core/java/com/android/server/StorageManagerService.java +21 −1 Original line number Diff line number Diff line Loading @@ -1609,7 +1609,6 @@ class StorageManagerService extends IStorageManager.Stub } } private void onVolumeStateChangedAsync(VolumeInfo vol, int oldState, int newState) { synchronized (mLock) { // Remember that we saw this volume so we're ready to accept user Loading Loading @@ -3430,6 +3429,27 @@ class StorageManagerService extends IStorageManager.Stub } } /* * Disable storage's app data isolation for testing. */ @Override public void disableAppDataIsolation(String pkgName, int pid, int userId) { final int callingUid = Binder.getCallingUid(); if (callingUid != Process.ROOT_UID && callingUid != Process.SHELL_UID) { throw new SecurityException("no permission to enable app visibility"); } final String[] sharedPackages = mPmInternal.getSharedUserPackagesForPackage(pkgName, userId); final int uid = mPmInternal.getPackageUid(pkgName, 0, userId); final String[] packages = sharedPackages.length != 0 ? sharedPackages : new String[]{pkgName}; try { mVold.unmountAppStorageDirs(uid, pid, packages); } catch (RemoteException e) { throw e.rethrowAsRuntimeException(); } } /** Not thread safe */ class AppFuseMountScope extends AppFuseBridge.MountScope { private boolean mMounted = false; Loading Loading
cmds/sm/src/com/android/commands/sm/Sm.java +11 −0 Original line number Diff line number Diff line Loading @@ -107,6 +107,8 @@ public final class Sm { runStartCheckpoint(); } else if ("supports-checkpoint".equals(op)) { runSupportsCheckpoint(); } else if ("unmount-app-data-dirs".equals(op)) { runDisableAppDataIsolation(); } else { throw new IllegalArgumentException(); } Loading Loading @@ -253,6 +255,13 @@ public final class Sm { System.out.println(result.get()); } public void runDisableAppDataIsolation() throws RemoteException { final String pkgName = nextArg(); final int pid = Integer.parseInt(nextArg()); final int userId = Integer.parseInt(nextArg()); mSm.disableAppDataIsolation(pkgName, pid, userId); } public void runForget() throws RemoteException { final String fsUuid = nextArg(); if ("all".equals(fsUuid)) { Loading Loading @@ -373,6 +382,8 @@ public final class Sm { System.err.println(""); System.err.println(" sm supports-checkpoint"); System.err.println(""); System.err.println(" sm unmount-app-data-dirs PACKAGE_NAME PID USER_ID"); System.err.println(""); return 1; } }
core/java/android/os/storage/IStorageManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -195,4 +195,5 @@ interface IStorageManager { void abortChanges(in String message, boolean retry) = 87; void clearUserKeyAuth(int userId, int serialNumber, in byte[] token, in byte[] secret) = 88; void fixupAppDir(in String path) = 89; void disableAppDataIsolation(in String pkgName, int pid, int userId) = 90; }
services/core/java/com/android/server/StorageManagerService.java +21 −1 Original line number Diff line number Diff line Loading @@ -1609,7 +1609,6 @@ class StorageManagerService extends IStorageManager.Stub } } private void onVolumeStateChangedAsync(VolumeInfo vol, int oldState, int newState) { synchronized (mLock) { // Remember that we saw this volume so we're ready to accept user Loading Loading @@ -3430,6 +3429,27 @@ class StorageManagerService extends IStorageManager.Stub } } /* * Disable storage's app data isolation for testing. */ @Override public void disableAppDataIsolation(String pkgName, int pid, int userId) { final int callingUid = Binder.getCallingUid(); if (callingUid != Process.ROOT_UID && callingUid != Process.SHELL_UID) { throw new SecurityException("no permission to enable app visibility"); } final String[] sharedPackages = mPmInternal.getSharedUserPackagesForPackage(pkgName, userId); final int uid = mPmInternal.getPackageUid(pkgName, 0, userId); final String[] packages = sharedPackages.length != 0 ? sharedPackages : new String[]{pkgName}; try { mVold.unmountAppStorageDirs(uid, pid, packages); } catch (RemoteException e) { throw e.rethrowAsRuntimeException(); } } /** Not thread safe */ class AppFuseMountScope extends AppFuseBridge.MountScope { private boolean mMounted = false; Loading