diff options
author | Jeff Sharkey <jsharkey@android.com> | 2018-04-20 13:11:20 -0600 |
---|---|---|
committer | Jeff Sharkey <jsharkey@android.com> | 2018-04-20 13:11:23 -0600 |
commit | 901c04270f5968137d5c2911c5174003f3e2ecfe (patch) | |
tree | cf5cbbdc0335436afc38a49e4872785bc135e552 /cmds/sm | |
parent | 5e12ebfffd813fc7035c9eef60220914dc92482f (diff) |
Extend adoptable override to force on or off.
Virtual disks are adoptable by default, but for debugging purposes
we want to treat them as unadoptable in some cases. Add the ability
for the "sm" shell command to force on/off, or return to default.
Bug: 77849654, 74132243
Test: manual
Change-Id: Ieda317396624ca081e5dd9568795483f684f9297
Diffstat (limited to 'cmds/sm')
-rw-r--r-- | cmds/sm/src/com/android/commands/sm/Sm.java | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/cmds/sm/src/com/android/commands/sm/Sm.java b/cmds/sm/src/com/android/commands/sm/Sm.java index 2bb7edcc7467..09343f174587 100644 --- a/cmds/sm/src/com/android/commands/sm/Sm.java +++ b/cmds/sm/src/com/android/commands/sm/Sm.java @@ -147,9 +147,21 @@ public final class Sm { } public void runSetForceAdoptable() throws RemoteException { - final boolean forceAdoptable = Boolean.parseBoolean(nextArg()); - mSm.setDebugFlags(forceAdoptable ? StorageManager.DEBUG_FORCE_ADOPTABLE : 0, - StorageManager.DEBUG_FORCE_ADOPTABLE); + final int mask = StorageManager.DEBUG_ADOPTABLE_FORCE_ON + | StorageManager.DEBUG_ADOPTABLE_FORCE_OFF; + switch (nextArg()) { + case "on": + case "true": + mSm.setDebugFlags(StorageManager.DEBUG_ADOPTABLE_FORCE_ON, mask); + break; + case "off": + mSm.setDebugFlags(StorageManager.DEBUG_ADOPTABLE_FORCE_OFF, mask); + break; + case "default": + case "false": + mSm.setDebugFlags(0, mask); + break; + } } public void runSetSdcardfs() throws RemoteException { @@ -289,7 +301,7 @@ public final class Sm { System.err.println(" sm list-volumes [public|private|emulated|all]"); System.err.println(" sm has-adoptable"); System.err.println(" sm get-primary-storage-uuid"); - System.err.println(" sm set-force-adoptable [true|false]"); + System.err.println(" sm set-force-adoptable [on|off|default]"); System.err.println(" sm set-virtual-disk [true|false]"); System.err.println(""); System.err.println(" sm partition DISK [public|private|mixed] [ratio]"); |