diff options
| author | 2018-02-27 09:03:21 +0000 | |
|---|---|---|
| committer | 2018-02-27 09:03:21 +0000 | |
| commit | 6d925591c48498b93514b8301c8ed3392c30f389 (patch) | |
| tree | 6af83ad604d2ea9da7a45a698337bdd93f535a5b | |
| parent | a986a96d30e14ed89fb12ffb21db77294fe6ceae (diff) | |
| parent | 5c0df23e76b65977d6ec036cca7c1227ca2bef71 (diff) | |
Merge "Block am switch-user when user switching is disallowed"
| -rw-r--r-- | services/core/java/com/android/server/am/ActivityManagerShellCommand.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/am/ActivityManagerShellCommand.java b/services/core/java/com/android/server/am/ActivityManagerShellCommand.java index 3b2a22d2ad99..2251d2ccd5b8 100644 --- a/services/core/java/com/android/server/am/ActivityManagerShellCommand.java +++ b/services/core/java/com/android/server/am/ActivityManagerShellCommand.java @@ -62,6 +62,7 @@ import android.os.StrictMode; import android.os.SystemClock; import android.os.SystemProperties; import android.os.UserHandle; +import android.os.UserManager; import android.text.TextUtils; import android.util.ArrayMap; import android.util.DebugUtils; @@ -1638,6 +1639,11 @@ final class ActivityManagerShellCommand extends ShellCommand { } int runSwitchUser(PrintWriter pw) throws RemoteException { + UserManager userManager = mInternal.mContext.getSystemService(UserManager.class); + if (!userManager.canSwitchUsers()) { + getErrPrintWriter().println("Error: disallowed switching user"); + return -1; + } String user = getNextArgRequired(); mInterface.switchUser(Integer.parseInt(user)); return 0; |