diff --git a/core/api/system-current.txt b/core/api/system-current.txt index fb8e0c7a57350..b4f32f051422e 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -996,8 +996,12 @@ package android.app.admin { field public static final String ACTION_PROVISION_FINANCED_DEVICE = "android.app.action.PROVISION_FINANCED_DEVICE"; field public static final String ACTION_PROVISION_MANAGED_DEVICE_FROM_TRUSTED_SOURCE = "android.app.action.PROVISION_MANAGED_DEVICE_FROM_TRUSTED_SOURCE"; field @RequiresPermission(android.Manifest.permission.MANAGE_FACTORY_RESET_PROTECTION) public static final String ACTION_RESET_PROTECTION_POLICY_CHANGED = "android.app.action.RESET_PROTECTION_POLICY_CHANGED"; + field public static final String ACTION_ROLE_HOLDER_PROVISION_FINALIZATION = "android.app.action.ROLE_HOLDER_PROVISION_FINALIZATION"; + field public static final String ACTION_ROLE_HOLDER_PROVISION_MANAGED_DEVICE_FROM_TRUSTED_SOURCE = "android.app.action.ROLE_HOLDER_PROVISION_MANAGED_DEVICE_FROM_TRUSTED_SOURCE"; + field public static final String ACTION_ROLE_HOLDER_PROVISION_MANAGED_PROFILE = "android.app.action.ROLE_HOLDER_PROVISION_MANAGED_PROFILE"; field public static final String ACTION_SET_PROFILE_OWNER = "android.app.action.SET_PROFILE_OWNER"; field @Deprecated public static final String ACTION_STATE_USER_SETUP_COMPLETE = "android.app.action.STATE_USER_SETUP_COMPLETE"; + field public static final String ACTION_UPDATE_DEVICE_MANAGEMENT_ROLE_HOLDER = "android.app.action.UPDATE_DEVICE_MANAGEMENT_ROLE_HOLDER"; field public static final String EXTRA_PROFILE_OWNER_NAME = "android.app.extra.PROFILE_OWNER_NAME"; field @Deprecated public static final String EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_ICON_URI = "android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_ICON_URI"; field @Deprecated public static final String EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_LABEL = "android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_LABEL"; @@ -1020,6 +1024,10 @@ package android.app.admin { field public static final String REQUIRED_APP_MANAGED_DEVICE = "android.app.REQUIRED_APP_MANAGED_DEVICE"; field public static final String REQUIRED_APP_MANAGED_PROFILE = "android.app.REQUIRED_APP_MANAGED_PROFILE"; field public static final String REQUIRED_APP_MANAGED_USER = "android.app.REQUIRED_APP_MANAGED_USER"; + field public static final int RESULT_DEVICE_OWNER_SET = 123; // 0x7b + field public static final int RESULT_UPDATE_DEVICE_MANAGEMENT_ROLE_HOLDER_RECOVERABLE_ERROR = 1; // 0x1 + field public static final int RESULT_UPDATE_DEVICE_MANAGEMENT_ROLE_HOLDER_UNRECOVERABLE_ERROR = 2; // 0x2 + field public static final int RESULT_WORK_PROFILE_CREATED = 122; // 0x7a field public static final int STATE_USER_PROFILE_COMPLETE = 4; // 0x4 field public static final int STATE_USER_PROFILE_FINALIZED = 5; // 0x5 field public static final int STATE_USER_SETUP_COMPLETE = 2; // 0x2 diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java index cf95ffe62b6bf..ee74bb875a357 100644 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -469,6 +469,105 @@ public class DevicePolicyManager { public static final String ACTION_PROVISION_FINALIZATION = "android.app.action.PROVISION_FINALIZATION"; + /** + * Activity action: starts the managed profile provisioning flow inside the device management + * role holder. + * + *

During the managed profile provisioning flow, the platform-provided provisioning handler + * will delegate provisioning to the device management role holder, by firing this intent. + * Third-party mobile device management applications attempting to fire this intent will + * receive a {@link SecurityException}. + * + *

Device management role holders are required to have a handler for this intent action. + * + *

A result code of {@link Activity#RESULT_OK} implies that managed profile provisioning + * finished successfully. If it did not, a result code of {@link Activity#RESULT_CANCELED} + * is used instead. + * + * @see #ACTION_PROVISION_MANAGED_PROFILE + * + * @hide + */ + // TODO(b/208628038): Uncomment when the permission is in place + // @RequiresPermission(android.Manifest.permission.LAUNCH_DEVICE_MANAGER_ROLE_HOLDER) + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) + @SystemApi + public static final String ACTION_ROLE_HOLDER_PROVISION_MANAGED_PROFILE = + "android.app.action.ROLE_HOLDER_PROVISION_MANAGED_PROFILE"; + + /** + * Result code that can be returned by the {@link + * #ACTION_PROVISION_MANAGED_DEVICE_FROM_TRUSTED_SOURCE} or {@link + * #ACTION_ROLE_HOLDER_PROVISION_MANAGED_DEVICE_FROM_TRUSTED_SOURCE} intent handlers if a work + * profile has been created. + * + * @hide + */ + @SystemApi + public static final int RESULT_WORK_PROFILE_CREATED = 122; + + /** + * Result code that can be returned by the {@link + * #ACTION_PROVISION_MANAGED_DEVICE_FROM_TRUSTED_SOURCE} or {@link + * #ACTION_ROLE_HOLDER_PROVISION_MANAGED_DEVICE_FROM_TRUSTED_SOURCE} intent handlers if the + * device owner was set. + * + * @hide + */ + @SystemApi + public static final int RESULT_DEVICE_OWNER_SET = 123; + + /** + * Activity action: starts the trusted source provisioning flow inside the device management + * role holder. + * + *

During the trusted source provisioning flow, the platform-provided provisioning handler + * will delegate provisioning to the device management role holder, by firing this intent. + * Third-party mobile device management applications attempting to fire this intent will + * receive a {@link SecurityException}. + * + *

Device management role holders are required to have a handler for this intent action. + * + *

The result codes can be either {@link #RESULT_WORK_PROFILE_CREATED}, {@link + * #RESULT_DEVICE_OWNER_SET} or {@link Activity#RESULT_CANCELED} if provisioning failed. + * + * @see #ACTION_PROVISION_MANAGED_DEVICE_FROM_TRUSTED_SOURCE + * + * @hide + */ + // TODO(b/208628038): Uncomment when the permission is in place + // @RequiresPermission(android.Manifest.permission.LAUNCH_DEVICE_MANAGER_ROLE_HOLDER) + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) + @SystemApi + public static final String ACTION_ROLE_HOLDER_PROVISION_MANAGED_DEVICE_FROM_TRUSTED_SOURCE = + "android.app.action.ROLE_HOLDER_PROVISION_MANAGED_DEVICE_FROM_TRUSTED_SOURCE"; + + /** + * Activity action: starts the provisioning finalization flow inside the device management + * role holder. + * + *

During the provisioning finalization flow, the platform-provided provisioning handler + * will delegate provisioning to the device management role holder, by firing this intent. + * Third-party mobile device management applications attempting to fire this intent will + * receive a {@link SecurityException}. + * + *

Device management role holders are required to have a handler for this intent action. + * + *

This handler forwards the result from the admin app's {@link + * #ACTION_ADMIN_POLICY_COMPLIANCE} handler. Result code {@link Activity#RESULT_CANCELED} + * implies the provisioning finalization flow has failed. + * + * @see #ACTION_PROVISION_FINALIZATION + * + * @hide + */ + // TODO(b/208628038): Uncomment when the permission is in place + // @RequiresPermission(android.Manifest.permission.LAUNCH_DEVICE_MANAGER_ROLE_HOLDER) + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) + @SystemApi + public static final String ACTION_ROLE_HOLDER_PROVISION_FINALIZATION = + "android.app.action.ROLE_HOLDER_PROVISION_FINALIZATION"; + /** * Action: Bugreport sharing with device owner has been accepted by the user. * @@ -2820,6 +2919,43 @@ public class DevicePolicyManager { public static final String ACTION_ADMIN_POLICY_COMPLIANCE = "android.app.action.ADMIN_POLICY_COMPLIANCE"; + /** + * Activity action: Starts the device management role holder updater. + * + *

The activity must handle the device management role holder update and set the intent + * result to either {@link Activity#RESULT_OK} if the update was successful, {@link + * #RESULT_UPDATE_DEVICE_MANAGEMENT_ROLE_HOLDER_RECOVERABLE_ERROR} if it encounters a problem + * that may be solved by relaunching it again, or {@link + * #RESULT_UPDATE_DEVICE_MANAGEMENT_ROLE_HOLDER_UNRECOVERABLE_ERROR} if it encounters a problem + * that will not be solved by relaunching it again. + * + * @hide + */ + // TODO(b/208628038): Uncomment when the permission is in place + // @RequiresPermission(android.Manifest.permission.LAUNCH_DEVICE_MANAGER_ROLE_HOLDER) + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) + @SystemApi + public static final String ACTION_UPDATE_DEVICE_MANAGEMENT_ROLE_HOLDER = + "android.app.action.UPDATE_DEVICE_MANAGEMENT_ROLE_HOLDER"; + + /** + * Result code that can be returned by the {@link #ACTION_UPDATE_DEVICE_MANAGEMENT_ROLE_HOLDER} + * handler if it encounters a problem that may be solved by relaunching it again. + * + * @hide + */ + @SystemApi + public static final int RESULT_UPDATE_DEVICE_MANAGEMENT_ROLE_HOLDER_RECOVERABLE_ERROR = 1; + + /** + * Result code that can be returned by the {@link #ACTION_UPDATE_DEVICE_MANAGEMENT_ROLE_HOLDER} + * handler if it encounters a problem that will not be solved by relaunching it again. + * + * @hide + */ + @SystemApi + public static final int RESULT_UPDATE_DEVICE_MANAGEMENT_ROLE_HOLDER_UNRECOVERABLE_ERROR = 2; + /** * Maximum supported password length. Kind-of arbitrary. * @hide