diff --git a/core/api/system-current.txt b/core/api/system-current.txt index d6745071270a8..23a02765c3144 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -1058,6 +1058,7 @@ package android.app.admin { field public static final int CODE_USER_HAS_PROFILE_OWNER = 2; // 0x2 field public static final int CODE_USER_NOT_RUNNING = 3; // 0x3 field public static final int CODE_USER_SETUP_COMPLETED = 4; // 0x4 + field public static final String EXTRA_FORCE_UPDATE_ROLE_HOLDER = "android.app.extra.FORCE_UPDATE_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"; @@ -1069,6 +1070,7 @@ package android.app.admin { field public static final String EXTRA_PROVISIONING_SUPPORT_URL = "android.app.extra.PROVISIONING_SUPPORT_URL"; field public static final String EXTRA_PROVISIONING_TRIGGER = "android.app.extra.PROVISIONING_TRIGGER"; field public static final String EXTRA_RESTRICTION = "android.app.extra.RESTRICTION"; + field public static final String EXTRA_ROLE_HOLDER_STATE = "android.app.extra.ROLE_HOLDER_STATE"; field public static final int FLAG_SUPPORTED_MODES_DEVICE_OWNER = 4; // 0x4 field public static final int FLAG_SUPPORTED_MODES_ORGANIZATION_OWNED = 1; // 0x1 field public static final int FLAG_SUPPORTED_MODES_PERSONALLY_OWNED = 2; // 0x2 @@ -1084,6 +1086,7 @@ package android.app.admin { 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_UPDATE_ROLE_HOLDER = 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 diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java index a60de088bab29..070fab3c8f31d 100644 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -480,6 +480,10 @@ public class DevicePolicyManager { * *
Device management role holders are required to have a handler for this intent action. * + *
If {@link #EXTRA_ROLE_HOLDER_STATE} is supplied to this intent, it is the responsibility + * of the role holder to restore its state from this extra. This is the same {@link Bundle} + * which the role holder returns alongside {@link #RESULT_UPDATE_ROLE_HOLDER}. + * *
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. @@ -527,6 +531,10 @@ public class DevicePolicyManager { * *
Device management role holders are required to have a handler for this intent action. * + *
If {@link #EXTRA_ROLE_HOLDER_STATE} is supplied to this intent, it is the responsibility + * of the role holder to restore its state from this extra. This is the same {@link Bundle} + * which the role holder returns alongside {@link #RESULT_UPDATE_ROLE_HOLDER}. + * *
The result codes can be either {@link #RESULT_WORK_PROFILE_CREATED}, {@link * #RESULT_DEVICE_OWNER_SET} or {@link Activity#RESULT_CANCELED} if provisioning failed. * @@ -565,6 +573,47 @@ public class DevicePolicyManager { public static final String ACTION_ROLE_HOLDER_PROVISION_FINALIZATION = "android.app.action.ROLE_HOLDER_PROVISION_FINALIZATION"; + /** + * {@link Activity} result code which can be returned by {@link + * #ACTION_ROLE_HOLDER_PROVISION_MANAGED_PROFILE} and {@link + * #ACTION_ROLE_HOLDER_PROVISION_MANAGED_DEVICE_FROM_TRUSTED_SOURCE} to signal that an update + * to the role holder is required. + * + *
This result code must be accompanied by {@link #EXTRA_ROLE_HOLDER_STATE}. + * + * @hide + */ + @SystemApi + public static final int RESULT_UPDATE_ROLE_HOLDER = 2; + + /** + * A {@link Bundle} extra which describes the state of the role holder at the time when it + * returns {@link #RESULT_UPDATE_ROLE_HOLDER}. + * + *
After the update completes, the role holder's {@link + * #ACTION_ROLE_HOLDER_PROVISION_MANAGED_PROFILE} or {@link + * #ACTION_ROLE_HOLDER_PROVISION_MANAGED_DEVICE_FROM_TRUSTED_SOURCE} intent will be relaunched, + * which will contain this extra. It is the role holder's responsibility to restore its + * state from this extra. + * + * @hide + */ + @SystemApi + public static final String EXTRA_ROLE_HOLDER_STATE = "android.app.extra.ROLE_HOLDER_STATE"; + + /** + * A {@code boolean} extra which determines whether to force a role holder update, regardless + * of any internal conditions {@link #ACTION_UPDATE_DEVICE_MANAGEMENT_ROLE_HOLDER} might have. + * + *
This extra can be provided to intents with action {@link + * #ACTION_UPDATE_DEVICE_MANAGEMENT_ROLE_HOLDER}. + * + * @hide + */ + @SystemApi + public static final String EXTRA_FORCE_UPDATE_ROLE_HOLDER = + "android.app.extra.FORCE_UPDATE_ROLE_HOLDER"; + /** * Action: Bugreport sharing with device owner has been accepted by the user. * @@ -2854,6 +2903,9 @@ public class DevicePolicyManager { * #RESULT_UPDATE_DEVICE_MANAGEMENT_ROLE_HOLDER_UNRECOVERABLE_ERROR} if it encounters a problem * that will not be solved by relaunching it again. * + *
If this activity has additional internal conditions which are not met, it should return + * {@link #RESULT_UPDATE_DEVICE_MANAGEMENT_ROLE_HOLDER_UNRECOVERABLE_ERROR}. + * * @hide */ @RequiresPermission(android.Manifest.permission.LAUNCH_DEVICE_MANAGER_SETUP)