diff options
author | Ricky Wai <rickywai@google.com> | 2021-01-21 14:12:28 +0000 |
---|---|---|
committer | rickywai <rickywai@google.com> | 2021-01-22 10:15:01 +0000 |
commit | 2007b0564e1dd03b97e00bf429405bdb5ad5c321 (patch) | |
tree | f43d556dc303fd7370f8e5bb3f48e9737c767221 /cmds | |
parent | c74d6f31150676ea1cc2a5e78de9ec2f510c9a52 (diff) |
Return error in "sm unmount-app-data-dirs" if app data isolation is not enabled
This command should not do anything when feature flag is off,
and let developer knows this command fails.
Bug: 177228735
Test: run "sm unmount-app-data-dirs" when the app data isolation flag is off and returns error message
Change-Id: If07107712e8215a58ffade08aedce3e80ad1ac12
Diffstat (limited to 'cmds')
-rw-r--r-- | cmds/sm/src/com/android/commands/sm/Sm.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/cmds/sm/src/com/android/commands/sm/Sm.java b/cmds/sm/src/com/android/commands/sm/Sm.java index 405d6f6f5f63..dc2868a59840 100644 --- a/cmds/sm/src/com/android/commands/sm/Sm.java +++ b/cmds/sm/src/com/android/commands/sm/Sm.java @@ -20,6 +20,7 @@ import android.os.IVoldTaskListener; import android.os.PersistableBundle; import android.os.RemoteException; import android.os.ServiceManager; +import android.os.SystemProperties; import android.os.storage.DiskInfo; import android.os.storage.IStorageManager; import android.os.storage.StorageManager; @@ -30,6 +31,8 @@ import java.util.concurrent.CompletableFuture; public final class Sm { private static final String TAG = "Sm"; + private static final String ANDROID_VOLD_APP_DATA_ISOLATION_ENABLED_PROPERTY = + "persist.sys.vold_app_data_isolation_enabled"; IStorageManager mSm; @@ -256,6 +259,10 @@ public final class Sm { } public void runDisableAppDataIsolation() throws RemoteException { + if (!SystemProperties.getBoolean( + ANDROID_VOLD_APP_DATA_ISOLATION_ENABLED_PROPERTY, false)) { + throw new IllegalStateException("Storage app data isolation is not enabled."); + } final String pkgName = nextArg(); final int pid = Integer.parseInt(nextArg()); final int userId = Integer.parseInt(nextArg()); |