summaryrefslogtreecommitdiff
path: root/cmds/sm
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2018-12-15 11:53:03 -0700
committerJeff Sharkey <jsharkey@android.com>2018-12-15 18:07:01 -0700
commitb0c363b21e2ab5bc8bc2f153442ce0e79f6011d7 (patch)
tree14510e367e26f615b097ffa5a9752ea969c49a93 /cmds/sm
parenta567e657aedcf0ee022547a558bf1a30b08a0e3d (diff)
Local and remote isolated storage feature flags.
Moving forward as we start enabling isolated storage in various dogfood groups, we'll need to maintain separate values for the feature flag for both "local" and "remote" opinions. Any strongly expressed local opinion will always take precidence over any remote opinion. Any changes to these feature flags means that we need to invalidate any PackageManager parsed APKs, since PackageParser changes it's output depending on the flag state. Since other feature flags are likely to need this type of invalidation in the future, define the PackageManager cache using a SHA-1 hash of a collection of values that should invalidate the cache. Bug: 112545973 Test: atest android.os.SystemPropertiesTest Change-Id: Ifafcdf15e40e694eb4126e06981aeb82df51da33
Diffstat (limited to 'cmds/sm')
-rw-r--r--cmds/sm/src/com/android/commands/sm/Sm.java27
1 files changed, 22 insertions, 5 deletions
diff --git a/cmds/sm/src/com/android/commands/sm/Sm.java b/cmds/sm/src/com/android/commands/sm/Sm.java
index 783c8c45d603..be5a5bf6c35a 100644
--- a/cmds/sm/src/com/android/commands/sm/Sm.java
+++ b/cmds/sm/src/com/android/commands/sm/Sm.java
@@ -282,14 +282,31 @@ public final class Sm {
StorageManager.DEBUG_VIRTUAL_DISK);
}
- public void runIsolatedStorage() throws RemoteException {
- final boolean enableIsolatedStorage = Boolean.parseBoolean(nextArg());
+ public void runIsolatedStorage() {
+ final int value;
+ final int mask = StorageManager.DEBUG_ISOLATED_STORAGE_FORCE_ON
+ | StorageManager.DEBUG_ISOLATED_STORAGE_FORCE_OFF;
+ switch (nextArg()) {
+ case "on":
+ case "true":
+ value = StorageManager.DEBUG_ISOLATED_STORAGE_FORCE_ON;
+ break;
+ case "off":
+ value = StorageManager.DEBUG_ISOLATED_STORAGE_FORCE_OFF;
+ break;
+ case "default":
+ case "false":
+ value = 0;
+ break;
+ 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(enableIsolatedStorage ? StorageManager.DEBUG_ISOLATED_STORAGE : 0,
- StorageManager.DEBUG_ISOLATED_STORAGE);
+ mSm.setDebugFlags(value, mask);
} catch (RemoteException e) {
Log.e(TAG, "Encountered an error!", e);
}
@@ -334,7 +351,7 @@ public final class Sm {
System.err.println("");
System.err.println(" sm set-emulate-fbe [true|false]");
System.err.println("");
- System.err.println(" sm set-isolated-storage [true|false]");
+ System.err.println(" sm set-isolated-storage [on|off|default]");
System.err.println("");
return 1;
}