From e4c8022508a8bea95a0e7b5ce0e317b4ddd7a9af Mon Sep 17 00:00:00 2001 From: arangelov Date: Thu, 9 Dec 2021 20:01:00 +0000 Subject: [PATCH] Add intent extra for a custom consent screen intent Bug: 210004718 Test: compiled Change-Id: Ibc5e60561923efe0f6f8b3139fc2b9d3aa58737c --- core/api/system-current.txt | 1 + .../app/admin/DevicePolicyManager.java | 32 +++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/core/api/system-current.txt b/core/api/system-current.txt index 0991e5fc136e4..bdf9b4c11c2f7 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -1046,6 +1046,7 @@ package android.app.admin { field @Deprecated public static final String EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_LABEL = "android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_LABEL"; field public static final String EXTRA_PROVISIONING_ORGANIZATION_NAME = "android.app.extra.PROVISIONING_ORGANIZATION_NAME"; field public static final String EXTRA_PROVISIONING_RETURN_BEFORE_POLICY_COMPLIANCE = "android.app.extra.PROVISIONING_RETURN_BEFORE_POLICY_COMPLIANCE"; + field public static final String EXTRA_PROVISIONING_ROLE_HOLDER_CUSTOM_USER_CONSENT_INTENT = "android.app.extra.PROVISIONING_ROLE_HOLDER_CUSTOM_USER_CONSENT_INTENT"; field public static final String EXTRA_PROVISIONING_SKIP_OWNERSHIP_DISCLAIMER = "android.app.extra.PROVISIONING_SKIP_OWNERSHIP_DISCLAIMER"; field public static final String EXTRA_PROVISIONING_SUPPORTED_MODES = "android.app.extra.PROVISIONING_SUPPORTED_MODES"; field public static final String EXTRA_PROVISIONING_SUPPORT_URL = "android.app.extra.PROVISIONING_SUPPORT_URL"; diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java index 7969cda7b84db..73ebdf6a45450 100644 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -2884,6 +2884,38 @@ public class DevicePolicyManager { @SystemApi public static final int RESULT_UPDATE_DEVICE_MANAGEMENT_ROLE_HOLDER_UNRECOVERABLE_ERROR = 2; + /** + * An {@link Intent} extra which resolves to a custom user consent screen. + * + *

If this extra is provided to the device management role holder via either {@link + * #ACTION_ROLE_HOLDER_PROVISION_MANAGED_DEVICE_FROM_TRUSTED_SOURCE} or {@link + * #ACTION_ROLE_HOLDER_PROVISION_MANAGED_PROFILE}, the device management role holder must + * launch this intent which shows the custom user consent screen, replacing its own standard + * consent screen. + * + *

If this extra is provided, it is the responsibility of the intent handler to show the + * list of disclaimers which are normally shown by the standard consent screen: + *

+ * + *

If the custom consent screens are granted by the user {@link Activity#RESULT_OK} is + * returned, otherwise {@link Activity#RESULT_CANCELED} is returned. The device management + * role holder should ensure that the provisioning flow terminates immediately if consent + * is not granted by the user. + * + * @hide + */ + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) + @SystemApi + public static final String EXTRA_PROVISIONING_ROLE_HOLDER_CUSTOM_USER_CONSENT_INTENT = + "android.app.extra.PROVISIONING_ROLE_HOLDER_CUSTOM_USER_CONSENT_INTENT"; + /** * Maximum supported password length. Kind-of arbitrary. * @hide