From 64bf7b2870b4fd38c859080441927f5a63196f5a Mon Sep 17 00:00:00 2001 From: Nicolas Prevot Date: Wed, 29 Apr 2015 14:43:49 +0100 Subject: Make ACTION_PROVISION_MANAGED_DEVICE public. Also remove the doc saying that factory reset is impossible if there is a device owner: the device owner may not set the user restriciton DISALLOW_FACTORY_RESET. BUG:19889110 Change-Id: Iadc084a38e541061c0b0c95bfc95da73d48842d7 --- api/current.txt | 1 + api/system-current.txt | 1 + .../android/app/admin/DevicePolicyManager.java | 52 ++++++++++++++++++---- 3 files changed, 45 insertions(+), 9 deletions(-) diff --git a/api/current.txt b/api/current.txt index 8e08df9791d7..cb72a2efe6c8 100644 --- a/api/current.txt +++ b/api/current.txt @@ -5803,6 +5803,7 @@ package android.app.admin { method public void wipeData(int); field public static final java.lang.String ACTION_ADD_DEVICE_ADMIN = "android.app.action.ADD_DEVICE_ADMIN"; field public static final java.lang.String ACTION_MANAGED_PROFILE_PROVISIONED = "android.app.action.MANAGED_PROFILE_PROVISIONED"; + field public static final java.lang.String ACTION_PROVISION_MANAGED_DEVICE = "android.app.action.PROVISION_MANAGED_DEVICE"; field public static final java.lang.String ACTION_PROVISION_MANAGED_PROFILE = "android.app.action.PROVISION_MANAGED_PROFILE"; field public static final java.lang.String ACTION_SET_NEW_PASSWORD = "android.app.action.SET_NEW_PASSWORD"; field public static final java.lang.String ACTION_START_ENCRYPTION = "android.app.action.START_ENCRYPTION"; diff --git a/api/system-current.txt b/api/system-current.txt index e3f6699b4d1a..488c92e65c8a 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -5913,6 +5913,7 @@ package android.app.admin { method public void wipeData(int); field public static final java.lang.String ACTION_ADD_DEVICE_ADMIN = "android.app.action.ADD_DEVICE_ADMIN"; field public static final java.lang.String ACTION_MANAGED_PROFILE_PROVISIONED = "android.app.action.MANAGED_PROFILE_PROVISIONED"; + field public static final java.lang.String ACTION_PROVISION_MANAGED_DEVICE = "android.app.action.PROVISION_MANAGED_DEVICE"; field public static final java.lang.String ACTION_PROVISION_MANAGED_PROFILE = "android.app.action.PROVISION_MANAGED_PROFILE"; field public static final java.lang.String ACTION_SEND_DEVICE_INITIALIZER_STATUS = "android.app.action.SEND_DEVICE_INITIALIZER_STATUS"; field public static final java.lang.String ACTION_SET_NEW_PASSWORD = "android.app.action.SET_NEW_PASSWORD"; diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java index a0b95b6a53c4..55eaf272ba77 100644 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -129,6 +129,39 @@ public class DevicePolicyManager { public static final String ACTION_PROVISION_MANAGED_PROFILE = "android.app.action.PROVISION_MANAGED_PROFILE"; + /** + * Activity action: Starts the provisioning flow which sets up a managed device. + * Must be started with {@link android.app.Activity#startActivityForResult(Intent, int)}. + * + *

During device owner provisioning a device admin app is set as the owner of the device. + * A device owner has full control over the device. The device owner can not be modified by the + * user. + * + *

A typical use case would be a device that is owned by a company, but used by either an + * employee or client. + * + *

An intent with this action can be sent only on an unprovisioned device. + * It is possible to check if the device is provisioned or not by looking at + * {@link android.provider.Settings.Global#DEVICE_PROVISIONED} + * + * The intent contains the following extras: + *

+ * + *

When device owner provisioning has completed, an intent of the type + * {@link DeviceAdminReceiver#ACTION_PROFILE_PROVISIONING_COMPLETE} is broadcast to the + * device owner. + * + *

If provisioning fails, the device is factory reset. + * + */ + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) + public static final String ACTION_PROVISION_MANAGED_DEVICE + = "android.app.action.PROVISION_MANAGED_DEVICE"; + /** * A {@link android.os.Parcelable} extra of type {@link android.os.PersistableBundle} that allows * a mobile device management application that starts managed profile provisioning to pass data @@ -169,11 +202,13 @@ public class DevicePolicyManager { * application that will be set as the profile owner or device owner and active admin. * *

If an application starts provisioning directly via an intent with action - * {@link #ACTION_PROVISION_MANAGED_PROFILE} the package name of this component has to match the - * package name of the application that started provisioning. + * {@link #ACTION_PROVISION_MANAGED_PROFILE} or + * {@link #ACTION_PROVISION_MANAGED_DEVICE} the package name of this + * component has to match the package name of the application that started provisioning. * *

This component is set as device owner and active admin when device owner provisioning is - * started by an NFC message containing an NFC record with MIME type + * started by an intent with action {@link #ACTION_PROVISION_MANAGED_DEVICE} or by an NFC + * message containing an NFC record with MIME type * {@link #MIME_TYPE_PROVISIONING_NFC_V2}. For the NFC record, the component name should be * flattened to a string, via {@link ComponentName#flattenToShortString()}. * @@ -213,8 +248,8 @@ public class DevicePolicyManager { * A Boolean extra that can be used by the mobile device management application to skip the * disabling of system apps during provisioning when set to {@code true}. * - *

Use in an NFC record with {@link #MIME_TYPE_PROVISIONING_NFC} that starts device owner - * provisioning via an NFC bump. + *

Use in an NFC record with {@link #MIME_TYPE_PROVISIONING_NFC} or an intent with action + * {@link #ACTION_PROVISION_MANAGED_DEVICE} that starts device owner provisioning. */ public static final String EXTRA_PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED = "android.app.extra.PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED"; @@ -414,8 +449,8 @@ public class DevicePolicyManager { * A boolean extra indicating whether device encryption can be skipped as part of Device Owner * provisioning. * - *

Use in an NFC record with {@link #MIME_TYPE_PROVISIONING_NFC_V2} that starts device owner - * provisioning via an NFC bump. + *

Use in an NFC record with {@link #MIME_TYPE_PROVISIONING_NFC_V2} or an intent with action + * {@link #ACTION_PROVISION_MANAGED_DEVICE} that starts device owner provisioning. */ public static final String EXTRA_PROVISIONING_SKIP_ENCRYPTION = "android.app.extra.PROVISIONING_SKIP_ENCRYPTION"; @@ -609,8 +644,7 @@ public class DevicePolicyManager { * *

During device owner provisioning a device admin app is set as the owner of the device. * A device owner has full control over the device. The device owner can not be modified by the - * user and the only way of resetting the device is if the device owner app calls a factory - * reset. + * user. * *

A typical use case would be a device that is owned by a company, but used by either an * employee or client. -- cgit v1.2.3-59-g8ed1b