diff options
author | Sudheer Shanka <sudheersai@google.com> | 2015-01-13 14:16:03 +0000 |
---|---|---|
committer | Sudheer Shanka <sudheersai@google.com> | 2015-01-13 20:07:46 +0000 |
commit | 474c7aceae0c6a91049deb7db944cbe85b56bcc7 (patch) | |
tree | 919066bc0b5a4432c68726486bb9ce7d0932897a /cmds/dpm | |
parent | cd0555f27384c1bbb91fbb544d33e834acb3f3c3 (diff) | |
download | frameworks_base-474c7aceae0c6a91049deb7db944cbe85b56bcc7.zip frameworks_base-474c7aceae0c6a91049deb7db944cbe85b56bcc7.tar.gz frameworks_base-474c7aceae0c6a91049deb7db944cbe85b56bcc7.tar.bz2 |
Update dpm command to follow --user convention.
Bug: 18426246
Change-Id: Ieacba15c4b4bfaf6ac325d20554ac91a1051ca4c
Diffstat (limited to 'cmds/dpm')
-rw-r--r-- | cmds/dpm/src/com/android/commands/dpm/Dpm.java | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/cmds/dpm/src/com/android/commands/dpm/Dpm.java b/cmds/dpm/src/com/android/commands/dpm/Dpm.java index 781fb96..3d86ac1 100644 --- a/cmds/dpm/src/com/android/commands/dpm/Dpm.java +++ b/cmds/dpm/src/com/android/commands/dpm/Dpm.java @@ -52,7 +52,7 @@ public final class Dpm extends BaseCommand { "usage: dpm [subcommand] [options]\n" + "usage: dpm set-active-admin [ --user <USER_ID> ] <COMPONENT>\n" + "usage: dpm set-device-owner <COMPONENT>\n" + - "usage: dpm set-profile-owner <COMPONENT> <USER_ID>\n" + + "usage: dpm set-profile-owner [ --user <USER_ID> ] <COMPONENT>\n" + "\n" + "dpm set-active-admin: Sets the given component as active admin" + " for an existing user.\n" + @@ -125,23 +125,21 @@ public final class Dpm extends BaseCommand { } private void runSetProfileOwner() throws RemoteException { - // To be refactored later to use parseArgs(boolean). Currently in use by existing tests. - ComponentName component = parseComponentName(nextArgRequired()); - int userId = parseInt(nextArgRequired()); - mDevicePolicyManager.setActiveAdmin(component, true /*refreshing*/, userId); + parseArgs(true); + mDevicePolicyManager.setActiveAdmin(mComponent, true /*refreshing*/, mUserId); try { - if (!mDevicePolicyManager.setProfileOwner(component, "" /*ownerName*/, userId)) { - throw new RuntimeException("Can't set component " + component.toShortString() + - " as profile owner for user " + userId); + if (!mDevicePolicyManager.setProfileOwner(mComponent, "" /*ownerName*/, mUserId)) { + throw new RuntimeException("Can't set component " + mComponent.toShortString() + + " as profile owner for user " + mUserId); } } catch (Exception e) { // Need to remove the admin that we just added. - mDevicePolicyManager.removeActiveAdmin(component, userId); + mDevicePolicyManager.removeActiveAdmin(mComponent, mUserId); throw e; } System.out.println("Success: Active admin and profile owner set to " - + component.toShortString() + " for user " + userId); + + mComponent.toShortString() + " for user " + mUserId); } private ComponentName parseComponentName(String component) { |