From 0d18e82854e3f1ba94149b35757cdabebeb1dd5c Mon Sep 17 00:00:00 2001 From: arangelov Date: Tue, 8 Dec 2020 17:42:08 +0000 Subject: Update javadocs and remove unused hidden API constant This change is part of the initiative to make managed account provisioning support the admin-integrated flow. We now deprecate ACTION_PROVISION_MANAGED_DEVICE as it will no longer be used by admin apps. Instead, they will be directly started by the managed account flow. EXTRA_PROVISIONING_SKIP_USER_CONSENT is now deprecated as it was only relevant for work profile on device owner which is not a supported configuration. EXTRA_PROVISIONING_KEEP_ACCOUNT_ON_MIGRATION and EXTRA_PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED are now also allowed to be returned as extras to the intent result of the GET_PROVISIONING_MODE admin app screen. EXTRA_PROVISIONING_SKIP_USER_SETUP is now removed as it was a hidden constant that was only relevant to split user mode, which is no longer supported. In addition, EXTRA_PROVISIONING_ACCOUNT_TO_MIGRATE documentation is now updated to reflect that it can be also set by the managed account provisioning initiator. Test: compiled Bug: 167955145 Change-Id: I8892d25209a9f1db17a1352390807372b956e704 --- core/api/current.txt | 4 +- .../android/app/admin/DevicePolicyManager.java | 60 ++++++++++++++-------- 2 files changed, 42 insertions(+), 22 deletions(-) diff --git a/core/api/current.txt b/core/api/current.txt index 2464ddad8607..b59fcad925e1 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -7135,7 +7135,7 @@ package android.app.admin { field public static final String ACTION_MANAGED_PROFILE_PROVISIONED = "android.app.action.MANAGED_PROFILE_PROVISIONED"; field public static final String ACTION_PROFILE_OWNER_CHANGED = "android.app.action.PROFILE_OWNER_CHANGED"; field public static final String ACTION_PROVISIONING_SUCCESSFUL = "android.app.action.PROVISIONING_SUCCESSFUL"; - field public static final String ACTION_PROVISION_MANAGED_DEVICE = "android.app.action.PROVISION_MANAGED_DEVICE"; + field @Deprecated public static final String ACTION_PROVISION_MANAGED_DEVICE = "android.app.action.PROVISION_MANAGED_DEVICE"; field public static final String ACTION_PROVISION_MANAGED_PROFILE = "android.app.action.PROVISION_MANAGED_PROFILE"; field public static final String ACTION_SET_NEW_PARENT_PROFILE_PASSWORD = "android.app.action.SET_NEW_PARENT_PROFILE_PASSWORD"; field public static final String ACTION_SET_NEW_PASSWORD = "android.app.action.SET_NEW_PASSWORD"; @@ -7186,7 +7186,7 @@ package android.app.admin { field public static final String EXTRA_PROVISIONING_SERIAL_NUMBER = "android.app.extra.PROVISIONING_SERIAL_NUMBER"; field public static final String EXTRA_PROVISIONING_SKIP_EDUCATION_SCREENS = "android.app.extra.PROVISIONING_SKIP_EDUCATION_SCREENS"; field public static final String EXTRA_PROVISIONING_SKIP_ENCRYPTION = "android.app.extra.PROVISIONING_SKIP_ENCRYPTION"; - field public static final String EXTRA_PROVISIONING_SKIP_USER_CONSENT = "android.app.extra.PROVISIONING_SKIP_USER_CONSENT"; + field @Deprecated public static final String EXTRA_PROVISIONING_SKIP_USER_CONSENT = "android.app.extra.PROVISIONING_SKIP_USER_CONSENT"; field public static final String EXTRA_PROVISIONING_TIME_ZONE = "android.app.extra.PROVISIONING_TIME_ZONE"; field public static final String EXTRA_PROVISIONING_WIFI_ANONYMOUS_IDENTITY = "android.app.extra.PROVISIONING_WIFI_ANONYMOUS_IDENTITY"; field public static final String EXTRA_PROVISIONING_WIFI_CA_CERTIFICATE = "android.app.extra.PROVISIONING_WIFI_CA_CERTIFICATE"; diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java index 4d0b90b9e426..4b6a2664b17b 100644 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -306,7 +306,13 @@ public class DevicePolicyManager { * of the provisioning flow was successful, although this doesn't guarantee the full flow will * succeed. Conversely a result code of {@link android.app.Activity#RESULT_CANCELED} implies * that the user backed-out of provisioning, or some precondition for provisioning wasn't met. + * + * @deprecated admin apps must now implement activities with intent filters for the {@link + * #ACTION_GET_PROVISIONING_MODE} and {@link #ACTION_ADMIN_POLICY_COMPLIANCE} intent actions; + * using {@link #ACTION_PROVISION_MANAGED_DEVICE} to start provisioning will cause the + * provisioning to fail. */ + @Deprecated @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_PROVISION_MANAGED_DEVICE = "android.app.action.PROVISION_MANAGED_DEVICE"; @@ -598,6 +604,12 @@ public class DevicePolicyManager { * properties will be converted into a {@link android.os.PersistableBundle} and passed to the * management application after provisioning. * + *

Admin apps will receive this extra in their {@link #ACTION_GET_PROVISIONING_MODE} and + * {@link #ACTION_ADMIN_POLICY_COMPLIANCE} intent handlers. Additionally, {@link + * #ACTION_GET_PROVISIONING_MODE} may also return this extra which will then be sent over to + * {@link #ACTION_ADMIN_POLICY_COMPLIANCE}, alongside the original values that were passed to + * {@link #ACTION_GET_PROVISIONING_MODE}. + * *

* In both cases the application receives the data in * {@link DeviceAdminReceiver#onProfileProvisioningComplete} via an intent with the action @@ -655,7 +667,9 @@ public class DevicePolicyManager { * profile provisioning. If the account supplied is present in the primary user, it will be * copied, along with its credentials to the managed profile and removed from the primary user. * - * Use with {@link #ACTION_PROVISION_MANAGED_PROFILE}. + * Use with {@link #ACTION_PROVISION_MANAGED_PROFILE}, with managed account provisioning, or + * return as an extra to the intent result from the {@link #ACTION_GET_PROVISIONING_MODE} + * activity. */ public static final String EXTRA_PROVISIONING_ACCOUNT_TO_MIGRATE @@ -669,8 +683,10 @@ public class DevicePolicyManager { * *

Defaults to {@code false} * - *

Use with {@link #ACTION_PROVISION_MANAGED_PROFILE} and - * {@link #EXTRA_PROVISIONING_ACCOUNT_TO_MIGRATE} + *

Use with {@link #ACTION_PROVISION_MANAGED_PROFILE} or set as an extra to the + * intent result of the {@link #ACTION_GET_PROVISIONING_MODE} activity. + * + * @see #EXTRA_PROVISIONING_ACCOUNT_TO_MIGRATE */ public static final String EXTRA_PROVISIONING_KEEP_ACCOUNT_ON_MIGRATION = "android.app.extra.PROVISIONING_KEEP_ACCOUNT_ON_MIGRATION"; @@ -697,8 +713,9 @@ 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} or an intent with action - * {@link #ACTION_PROVISION_MANAGED_DEVICE} that starts device owner provisioning. + *

Use in an NFC record with {@link #MIME_TYPE_PROVISIONING_NFC}, an intent with action + * {@link #ACTION_PROVISION_MANAGED_PROFILE} that starts profile owner provisioning or + * set as an extra to the intent result of the {@link #ACTION_GET_PROVISIONING_MODE} activity. */ public static final String EXTRA_PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED = "android.app.extra.PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED"; @@ -1174,28 +1191,16 @@ public class DevicePolicyManager { public static final String EXTRA_PROVISIONING_DISCLAIMER_CONTENT = "android.app.extra.PROVISIONING_DISCLAIMER_CONTENT"; - /** - * A boolean extra indicating if user setup should be skipped, for when provisioning is started - * during setup-wizard. - * - *

If unspecified, defaults to {@code true} to match the behavior in - * {@link android.os.Build.VERSION_CODES#M} and earlier. - * - *

Use in an intent with action {@link #ACTION_PROVISION_MANAGED_DEVICE} or - * {@link #ACTION_PROVISION_MANAGED_USER}. - * - * @hide - */ - public static final String EXTRA_PROVISIONING_SKIP_USER_SETUP = - "android.app.extra.PROVISIONING_SKIP_USER_SETUP"; - /** * A boolean extra indicating if the user consent steps from the provisioning flow should be * skipped. If unspecified, defaults to {@code false}. * * It can only be used by an existing device owner trying to create a managed profile via * {@link #ACTION_PROVISION_MANAGED_PROFILE}. Otherwise it is ignored. + * + * @deprecated this extra is no longer relevant as device owners cannot create managed profiles */ + @Deprecated public static final String EXTRA_PROVISIONING_SKIP_USER_CONSENT = "android.app.extra.PROVISIONING_SKIP_USER_CONSENT"; @@ -2456,6 +2461,16 @@ public class DevicePolicyManager { *

The target activity may also return the account that needs to be migrated from primary * user to managed profile in case of a profile owner provisioning in * {@link #EXTRA_PROVISIONING_ACCOUNT_TO_MIGRATE} as result. + * + *

The target activity may also include the {@link #EXTRA_PROVISIONING_ADMIN_EXTRAS_BUNDLE} + * extra in the intent result. The values of this {@link android.os.PersistableBundle} will be + * sent as an intent extra of the same name to the {@link #ACTION_ADMIN_POLICY_COMPLIANCE} + * activity, along with the values of the {@link #EXTRA_PROVISIONING_ADMIN_EXTRAS_BUNDLE} extra + * that are already supplied to this activity. + * + * @see #EXTRA_PROVISIONING_KEEP_ACCOUNT_ON_MIGRATION + * @see #EXTRA_PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED + * @see #ACTION_ADMIN_POLICY_COMPLIANCE */ public static final String ACTION_GET_PROVISIONING_MODE = "android.app.action.GET_PROVISIONING_MODE"; @@ -2545,6 +2560,11 @@ public class DevicePolicyManager { * provisioning flow (in which case this gets sent after {@link #ACTION_GET_PROVISIONING_MODE}), * or it could happen during provisioning finalization if the administrator supports * finalization during setup wizard. + * + *

Intents with this action may also be supplied with the {@link + * #EXTRA_PROVISIONING_ADMIN_EXTRAS_BUNDLE} extra. + * + * @see #ACTION_GET_PROVISIONING_MODE */ public static final String ACTION_ADMIN_POLICY_COMPLIANCE = "android.app.action.ADMIN_POLICY_COMPLIANCE"; -- cgit v1.2.3-59-g8ed1b