Loading cmds/sm/src/com/android/commands/sm/Sm.java +9 −10 Original line number Diff line number Diff line Loading @@ -103,6 +103,8 @@ public final class Sm { runSetVirtualDisk(); } else if ("set-isolated-storage".equals(op)) { runIsolatedStorage(); } else if ("set-legacy-greylist".equals(op)) { runLegacyGreylist(); } else { throw new IllegalArgumentException(); } Loading Loading @@ -282,7 +284,7 @@ public final class Sm { StorageManager.DEBUG_VIRTUAL_DISK); } public void runIsolatedStorage() { public void runIsolatedStorage() throws RemoteException { final int value; final int mask = StorageManager.DEBUG_ISOLATED_STORAGE_FORCE_ON | StorageManager.DEBUG_ISOLATED_STORAGE_FORCE_OFF; Loading @@ -301,16 +303,13 @@ public final class Sm { default: return; } // Toggling isolated-storage state will result in a device reboot. So to avoid this command // from erroring out (DeadSystemException), call setDebugFlags() in a separate thread. new Thread(() -> { try { mSm.setDebugFlags(value, mask); } catch (RemoteException e) { Log.e(TAG, "Encountered an error!", e); } }).start(); public void runLegacyGreylist() throws RemoteException { final boolean legacyGreylist = Boolean.parseBoolean(nextArg()); mSm.setDebugFlags(legacyGreylist ? StorageManager.DEBUG_LEGACY_GREYLIST : 0, StorageManager.DEBUG_LEGACY_GREYLIST); } public void runIdleMaint() throws RemoteException { Loading core/java/android/os/storage/StorageManager.java +4 −0 Original line number Diff line number Diff line Loading @@ -136,6 +136,8 @@ public class StorageManager { public static final String PROP_ISOLATED_STORAGE = "persist.sys.isolated_storage"; /** {@hide} */ public static final String PROP_ISOLATED_STORAGE_SNAPSHOT = "sys.isolated_storage_snapshot"; /** {@hide} */ public static final String PROP_LEGACY_GREYLIST = "persist.sys.legacy_greylist"; /** {@hide} */ public static final String PROP_FORCE_AUDIO = "persist.fw.force_audio"; Loading Loading @@ -233,6 +235,8 @@ public class StorageManager { public static final int DEBUG_ISOLATED_STORAGE_FORCE_ON = 1 << 6; /** {@hide} */ public static final int DEBUG_ISOLATED_STORAGE_FORCE_OFF = 1 << 7; /** {@hide} */ public static final int DEBUG_LEGACY_GREYLIST = 1 << 8; /** {@hide} */ public static final int FLAG_STORAGE_DE = IInstalld.FLAG_STORAGE_DE; Loading services/core/java/com/android/server/StorageManagerService.java +33 −10 Original line number Diff line number Diff line Loading @@ -205,6 +205,9 @@ class StorageManagerService extends IStorageManager.Stub private static final boolean ENABLE_ISOLATED_STORAGE = StorageManager.hasIsolatedStorage(); private static final boolean ENABLE_LEGACY_GREYLIST = SystemProperties .getBoolean(StorageManager.PROP_LEGACY_GREYLIST, true); public static class Lifecycle extends SystemService { private StorageManagerService mStorageManagerService; Loading Loading @@ -2289,7 +2292,26 @@ class StorageManagerService extends IStorageManager.Stub refreshIsolatedStorageSettings(); // Perform hard reboot to kick policy into place mHandler.post(() -> { mContext.getSystemService(PowerManager.class).reboot(null); }); } finally { Binder.restoreCallingIdentity(token); } } if ((mask & StorageManager.DEBUG_LEGACY_GREYLIST) != 0) { final boolean enabled = (flags & StorageManager.DEBUG_LEGACY_GREYLIST) != 0; final long token = Binder.clearCallingIdentity(); try { SystemProperties.set(StorageManager.PROP_LEGACY_GREYLIST, Boolean.toString(enabled)); // Perform hard reboot to kick policy into place mHandler.post(() -> { mContext.getSystemService(PowerManager.class).reboot(null); }); } finally { Binder.restoreCallingIdentity(token); } Loading Loading @@ -3675,6 +3697,7 @@ class StorageManagerService extends IStorageManager.Stub } else if (mPmInternal.isInstantApp(packageName, UserHandle.getUserId(uid))) { return Zygote.MOUNT_EXTERNAL_NONE; } else { if (ENABLE_LEGACY_GREYLIST) { // STOPSHIP: remove this temporary workaround once developers // fix bugs where they're opening _data paths in native code switch (packageName) { Loading @@ -3682,10 +3705,10 @@ class StorageManagerService extends IStorageManager.Stub case "jp.naver.line.android": // b/124767356 case "com.mxtech.videoplayer.ad": // b/124531483 return Zygote.MOUNT_EXTERNAL_LEGACY; default: return Zygote.MOUNT_EXTERNAL_WRITE; } } return Zygote.MOUNT_EXTERNAL_WRITE; } } catch (RemoteException e) { // Should not happen } Loading Loading
cmds/sm/src/com/android/commands/sm/Sm.java +9 −10 Original line number Diff line number Diff line Loading @@ -103,6 +103,8 @@ public final class Sm { runSetVirtualDisk(); } else if ("set-isolated-storage".equals(op)) { runIsolatedStorage(); } else if ("set-legacy-greylist".equals(op)) { runLegacyGreylist(); } else { throw new IllegalArgumentException(); } Loading Loading @@ -282,7 +284,7 @@ public final class Sm { StorageManager.DEBUG_VIRTUAL_DISK); } public void runIsolatedStorage() { public void runIsolatedStorage() throws RemoteException { final int value; final int mask = StorageManager.DEBUG_ISOLATED_STORAGE_FORCE_ON | StorageManager.DEBUG_ISOLATED_STORAGE_FORCE_OFF; Loading @@ -301,16 +303,13 @@ public final class Sm { default: return; } // Toggling isolated-storage state will result in a device reboot. So to avoid this command // from erroring out (DeadSystemException), call setDebugFlags() in a separate thread. new Thread(() -> { try { mSm.setDebugFlags(value, mask); } catch (RemoteException e) { Log.e(TAG, "Encountered an error!", e); } }).start(); public void runLegacyGreylist() throws RemoteException { final boolean legacyGreylist = Boolean.parseBoolean(nextArg()); mSm.setDebugFlags(legacyGreylist ? StorageManager.DEBUG_LEGACY_GREYLIST : 0, StorageManager.DEBUG_LEGACY_GREYLIST); } public void runIdleMaint() throws RemoteException { Loading
core/java/android/os/storage/StorageManager.java +4 −0 Original line number Diff line number Diff line Loading @@ -136,6 +136,8 @@ public class StorageManager { public static final String PROP_ISOLATED_STORAGE = "persist.sys.isolated_storage"; /** {@hide} */ public static final String PROP_ISOLATED_STORAGE_SNAPSHOT = "sys.isolated_storage_snapshot"; /** {@hide} */ public static final String PROP_LEGACY_GREYLIST = "persist.sys.legacy_greylist"; /** {@hide} */ public static final String PROP_FORCE_AUDIO = "persist.fw.force_audio"; Loading Loading @@ -233,6 +235,8 @@ public class StorageManager { public static final int DEBUG_ISOLATED_STORAGE_FORCE_ON = 1 << 6; /** {@hide} */ public static final int DEBUG_ISOLATED_STORAGE_FORCE_OFF = 1 << 7; /** {@hide} */ public static final int DEBUG_LEGACY_GREYLIST = 1 << 8; /** {@hide} */ public static final int FLAG_STORAGE_DE = IInstalld.FLAG_STORAGE_DE; Loading
services/core/java/com/android/server/StorageManagerService.java +33 −10 Original line number Diff line number Diff line Loading @@ -205,6 +205,9 @@ class StorageManagerService extends IStorageManager.Stub private static final boolean ENABLE_ISOLATED_STORAGE = StorageManager.hasIsolatedStorage(); private static final boolean ENABLE_LEGACY_GREYLIST = SystemProperties .getBoolean(StorageManager.PROP_LEGACY_GREYLIST, true); public static class Lifecycle extends SystemService { private StorageManagerService mStorageManagerService; Loading Loading @@ -2289,7 +2292,26 @@ class StorageManagerService extends IStorageManager.Stub refreshIsolatedStorageSettings(); // Perform hard reboot to kick policy into place mHandler.post(() -> { mContext.getSystemService(PowerManager.class).reboot(null); }); } finally { Binder.restoreCallingIdentity(token); } } if ((mask & StorageManager.DEBUG_LEGACY_GREYLIST) != 0) { final boolean enabled = (flags & StorageManager.DEBUG_LEGACY_GREYLIST) != 0; final long token = Binder.clearCallingIdentity(); try { SystemProperties.set(StorageManager.PROP_LEGACY_GREYLIST, Boolean.toString(enabled)); // Perform hard reboot to kick policy into place mHandler.post(() -> { mContext.getSystemService(PowerManager.class).reboot(null); }); } finally { Binder.restoreCallingIdentity(token); } Loading Loading @@ -3675,6 +3697,7 @@ class StorageManagerService extends IStorageManager.Stub } else if (mPmInternal.isInstantApp(packageName, UserHandle.getUserId(uid))) { return Zygote.MOUNT_EXTERNAL_NONE; } else { if (ENABLE_LEGACY_GREYLIST) { // STOPSHIP: remove this temporary workaround once developers // fix bugs where they're opening _data paths in native code switch (packageName) { Loading @@ -3682,10 +3705,10 @@ class StorageManagerService extends IStorageManager.Stub case "jp.naver.line.android": // b/124767356 case "com.mxtech.videoplayer.ad": // b/124531483 return Zygote.MOUNT_EXTERNAL_LEGACY; default: return Zygote.MOUNT_EXTERNAL_WRITE; } } return Zygote.MOUNT_EXTERNAL_WRITE; } } catch (RemoteException e) { // Should not happen } Loading