diff --git a/api/current.txt b/api/current.txt index 2282a33d33c3e..1e7d548d42945 100644 --- a/api/current.txt +++ b/api/current.txt @@ -4741,7 +4741,7 @@ package android.app.admin { field public static final java.lang.String ACTION_PASSWORD_EXPIRING = "android.app.action.ACTION_PASSWORD_EXPIRING"; field public static final java.lang.String ACTION_PASSWORD_FAILED = "android.app.action.ACTION_PASSWORD_FAILED"; field public static final java.lang.String ACTION_PASSWORD_SUCCEEDED = "android.app.action.ACTION_PASSWORD_SUCCEEDED"; - field public static final java.lang.String ACTION_PROFILE_PROVISIONING_COMPLETE = "android.managedprovisioning.ACTION_PROVISIONING_COMPLETE"; + field public static final java.lang.String ACTION_PROFILE_PROVISIONING_COMPLETE = "android.app.action.ACTION_PROFILE_PROVISIONING_COMPLETE"; field public static final java.lang.String DEVICE_ADMIN_META_DATA = "android.app.device_admin"; field public static final java.lang.String EXTRA_DISABLE_WARNING = "android.app.extra.DISABLE_WARNING"; } @@ -4794,6 +4794,7 @@ package android.app.admin { method public int setStorageEncryption(android.content.ComponentName, boolean); 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_PROVISION_MANAGED_PROFILE = "android.managedprovisioning.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"; field public static final int ENCRYPTION_STATUS_ACTIVATING = 2; // 0x2 @@ -4802,6 +4803,8 @@ package android.app.admin { field public static final int ENCRYPTION_STATUS_UNSUPPORTED = 0; // 0x0 field public static final java.lang.String EXTRA_ADD_EXPLANATION = "android.app.extra.ADD_EXPLANATION"; field public static final java.lang.String EXTRA_DEVICE_ADMIN = "android.app.extra.DEVICE_ADMIN"; + field public static final java.lang.String EXTRA_PROVISIONING_DEFAULT_MANAGED_PROFILE_NAME = "defaultManagedProfileName"; + field public static final java.lang.String EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME = "deviceAdminPackageName"; field public static final int KEYGUARD_DISABLE_FEATURES_ALL = 2147483647; // 0x7fffffff field public static final int KEYGUARD_DISABLE_FEATURES_NONE = 0; // 0x0 field public static final int KEYGUARD_DISABLE_SECURE_CAMERA = 2; // 0x2 diff --git a/core/java/android/app/admin/DeviceAdminReceiver.java b/core/java/android/app/admin/DeviceAdminReceiver.java index 00e7da4fc6eea..6f4533c980a77 100644 --- a/core/java/android/app/admin/DeviceAdminReceiver.java +++ b/core/java/android/app/admin/DeviceAdminReceiver.java @@ -164,13 +164,21 @@ public class DeviceAdminReceiver extends BroadcastReceiver { public static final String ACTION_PASSWORD_EXPIRING = "android.app.action.ACTION_PASSWORD_EXPIRING"; - /** - * Action broadcasted when provisioning of a managed profile has completed. + * Broadcast Action: This broadcast is sent to the newly created profile when + * the provisioning of a managed profile has completed successfully. + * + *

The broadcast is limited to the package which started the provisioning as specified in + * the extra {@link DevicePolicyManager#EXTRA_PROVISIONING_MDM_PACKAGE_NAME} of the + * {@link DevicePolicyManager#ACTION_PROVISION_MANAGED_PROFILE} intent that started the + * provisioning. It is also limited to the managed profile. + * + *

Input: Nothing.

+ *

Output: Nothing

*/ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) - public static final String ACTION_PROFILE_PROVISIONING_COMPLETE - = "android.managedprovisioning.ACTION_PROVISIONING_COMPLETE"; + public static final String ACTION_PROFILE_PROVISIONING_COMPLETE = + "android.app.action.ACTION_PROFILE_PROVISIONING_COMPLETE"; /** * Name under which a DevicePolicy component publishes information diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java index 1f41c56238bec..e06cf38c6be06 100644 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -76,6 +76,43 @@ public class DevicePolicyManager { return me.mService != null ? me : null; } + /** + * Activity action: Starts the provisioning flow which sets up a managed profile. + * This intent will typically be sent by a mobile device management application(mdm). + * Managed profile provisioning creates a profile, moves the mdm to the profile, + * sets the mdm as the profile owner and removes all non required applications from the profile. + * As a profile owner the mdm than has full control over the managed profile. + * + *

The intent must contain the extras {@link #EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME} and + * {@link #EXTRA_PROVISIONING_DEFAULT_MANAGED_PROFILE_NAME}. + * + *

When managed provisioning has completed, an intent of the type + * {@link DeviceAdminReceiver#ACTION_PROFILE_PROVISIONING_COMPLETE} is broadcasted to the + * mdm app on the managed profile. + * + *

Input: Nothing.

+ *

Output: Nothing

+ */ + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) + public static final String ACTION_PROVISION_MANAGED_PROFILE + = "android.managedprovisioning.ACTION_PROVISION_MANAGED_PROFILE"; + + /** + * A String extra holding the name of the package of the mobile device management application + * that starts the managed provisioning flow. This package will be set as the profile owner. + *

Use with {@link #ACTION_PROVISION_MANAGED_PROFILE}. + */ + public static final String EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME + = "deviceAdminPackageName"; + + /** + * A String extra holding the default name of the profile that is created during managed profile + * provisioning. + *

Use with {@link #ACTION_PROVISION_MANAGED_PROFILE} + */ + public static final String EXTRA_PROVISIONING_DEFAULT_MANAGED_PROFILE_NAME + = "defaultManagedProfileName"; + /** * Activity action: ask the user to add a new device administrator to the system. * The desired policy is the ComponentName of the policy in the