diff options
author | Makoto Onuki <omakoto@google.com> | 2015-09-04 10:48:16 -0700 |
---|---|---|
committer | Makoto Onuki <omakoto@google.com> | 2015-09-08 11:24:58 -0700 |
commit | 58b684f1cdc52467b71c42cfae18433a19ce7d0b (patch) | |
tree | fe83f72cd971fbc624c3820c2286024359fdc3fa /cmds/dpm | |
parent | 3403b74429973cd743ff9487b21ad5c9bb8dd461 (diff) |
[split system] Tentatively support running DO on meat user
- setDeviceOwner() now takes a user ID. (We can infer it from Binder, but
we still need it for the dpm command.)
- Change broadcast target UID for DO to the DO user
- Start the DO user on boot complete.
TODO Investigate whether this is actually the good timing.
TODO Prevent the DO user from being killed
Bug 23827706
Change-Id: I227dbd444f1f4e94d98c317489d151554fe79d91
Diffstat (limited to 'cmds/dpm')
-rw-r--r-- | cmds/dpm/src/com/android/commands/dpm/Dpm.java | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/cmds/dpm/src/com/android/commands/dpm/Dpm.java b/cmds/dpm/src/com/android/commands/dpm/Dpm.java index 471fa3bd046e..214dc5d35a24 100644 --- a/cmds/dpm/src/com/android/commands/dpm/Dpm.java +++ b/cmds/dpm/src/com/android/commands/dpm/Dpm.java @@ -51,7 +51,8 @@ public final class Dpm extends BaseCommand { out.println( "usage: dpm [subcommand] [options]\n" + "usage: dpm set-active-admin [ --user <USER_ID> ] <COMPONENT>\n" + - "usage: dpm set-device-owner <COMPONENT>\n" + + // STOPSHIP Finalize it + "usage: dpm set-device-owner [ --user <USER_ID> *EXPERIMENTAL* ] <COMPONENT>\n" + "usage: dpm set-profile-owner [ --user <USER_ID> ] <COMPONENT>\n" + "\n" + "dpm set-active-admin: Sets the given component as active admin" + @@ -106,22 +107,22 @@ public final class Dpm extends BaseCommand { } private void runSetDeviceOwner() throws RemoteException { - ComponentName component = parseComponentName(nextArgRequired()); - mDevicePolicyManager.setActiveAdmin(component, true /*refreshing*/, UserHandle.USER_SYSTEM); + parseArgs(true); + mDevicePolicyManager.setActiveAdmin(mComponent, true /*refreshing*/, mUserId); - String packageName = component.getPackageName(); + String packageName = mComponent.getPackageName(); try { - if (!mDevicePolicyManager.setDeviceOwner(packageName, null /*ownerName*/)) { + if (!mDevicePolicyManager.setDeviceOwner(packageName, null /*ownerName*/, mUserId)) { throw new RuntimeException( "Can't set package " + packageName + " as device owner."); } } catch (Exception e) { // Need to remove the admin that we just added. - mDevicePolicyManager.removeActiveAdmin(component, UserHandle.USER_SYSTEM); + mDevicePolicyManager.removeActiveAdmin(mComponent, UserHandle.USER_SYSTEM); throw e; } System.out.println("Success: Device owner set to package " + packageName); - System.out.println("Active admin set to component " + component.toShortString()); + System.out.println("Active admin set to component " + mComponent.toShortString()); } private void runSetProfileOwner() throws RemoteException { |