summaryrefslogtreecommitdiff
path: root/cmds/dpm
diff options
context:
space:
mode:
authorAlan Treadway <alantreadway@google.com>2016-01-19 15:15:08 +0000
committerAlan Treadway <alantreadway@google.com>2016-01-25 15:46:30 +0000
commitafad8783699b1ba6f3c7ee5961d6ddc2bd771dc1 (patch)
treeb003623b28ba92db60746872de361f203d5a7f0b /cmds/dpm
parentfe434a15d6bde9299b51dc284b336944e5cf8a1c (diff)
Add explicit and persistent user provisioning state.
Add explicit modelling of provisioning state so that integration of management provisioning flows with packages such as setup-wizard are cleaner, and can be more direct. Previously we relied upon USER_SETUP_COMPLETE secure setting and HOME intents to signal intent, but this is not very clear and can be fragile. Bug: 25858670 Change-Id: Idc56a040f710c3aee281db420f21717da3960722
Diffstat (limited to 'cmds/dpm')
-rw-r--r--cmds/dpm/src/com/android/commands/dpm/Dpm.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/cmds/dpm/src/com/android/commands/dpm/Dpm.java b/cmds/dpm/src/com/android/commands/dpm/Dpm.java
index 6dc3cd1d48e0..b83484d99824 100644
--- a/cmds/dpm/src/com/android/commands/dpm/Dpm.java
+++ b/cmds/dpm/src/com/android/commands/dpm/Dpm.java
@@ -18,6 +18,7 @@ package com.android.commands.dpm;
import android.app.ActivityManagerNative;
import android.app.IActivityManager;
+import android.app.admin.DevicePolicyManager;
import android.app.admin.IDevicePolicyManager;
import android.content.ComponentName;
import android.content.Context;
@@ -143,6 +144,10 @@ public final class Dpm extends BaseCommand {
mDevicePolicyManager.removeActiveAdmin(mComponent, UserHandle.USER_SYSTEM);
throw e;
}
+
+ mDevicePolicyManager.setUserProvisioningState(
+ DevicePolicyManager.STATE_USER_SETUP_FINALIZED, mUserId);
+
System.out.println("Success: Device owner set to package " + mComponent);
System.out.println("Active admin set to component " + mComponent.toShortString());
}
@@ -161,6 +166,10 @@ public final class Dpm extends BaseCommand {
mDevicePolicyManager.removeActiveAdmin(mComponent, mUserId);
throw e;
}
+
+ mDevicePolicyManager.setUserProvisioningState(
+ DevicePolicyManager.STATE_USER_SETUP_FINALIZED, mUserId);
+
System.out.println("Success: Active admin and profile owner set to "
+ mComponent.toShortString() + " for user " + mUserId);
}
@@ -180,4 +189,4 @@ public final class Dpm extends BaseCommand {
throw new IllegalArgumentException ("Invalid integer argument '" + argument + "'", e);
}
}
-} \ No newline at end of file
+}