From 50f0c47adbc006ed15955c236c2d6e123eaf6126 Mon Sep 17 00:00:00 2001 From: arangelov Date: Tue, 18 Jan 2022 16:34:52 +0000 Subject: [PATCH] Add intent action to establish network connectivity prior to provisioning. Bug: 215159250 Test: none Change-Id: I8263c1170cf33ac9f9f0acbf11ab72f09c800e11 --- core/api/system-current.txt | 1 + .../app/admin/DevicePolicyManager.java | 48 +++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/core/api/system-current.txt b/core/api/system-current.txt index 949dee3d69428..1a6f569a5fe54 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -1047,6 +1047,7 @@ package android.app.admin { field public static final String ACCOUNT_FEATURE_DEVICE_OR_PROFILE_OWNER_ALLOWED = "android.account.DEVICE_OR_PROFILE_OWNER_ALLOWED"; field public static final String ACCOUNT_FEATURE_DEVICE_OR_PROFILE_OWNER_DISALLOWED = "android.account.DEVICE_OR_PROFILE_OWNER_DISALLOWED"; field public static final String ACTION_BIND_SECONDARY_LOCKSCREEN_SERVICE = "android.app.action.BIND_SECONDARY_LOCKSCREEN_SERVICE"; + field @RequiresPermission(android.Manifest.permission.DISPATCH_PROVISIONING_MESSAGE) public static final String ACTION_ESTABLISH_NETWORK_CONNECTION = "android.app.action.ESTABLISH_NETWORK_CONNECTION"; field public static final String ACTION_PROVISION_FINALIZATION = "android.app.action.PROVISION_FINALIZATION"; 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"; diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java index 96825933b17ca..a5fcd3040c5b3 100644 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -2985,6 +2985,54 @@ public class DevicePolicyManager { public static final String EXTRA_PROVISIONING_ROLE_HOLDER_CUSTOM_USER_CONSENT_INTENT = "android.app.extra.PROVISIONING_ROLE_HOLDER_CUSTOM_USER_CONSENT_INTENT"; + /** + * Activity action: attempts to establish network connection + * + *

This intent can be accompanied by any of the relevant provisioning extras related to + * network connectivity, such as: + *

+ * + *

If there are provisioning extras related to network connectivity, this activity + * attempts to connect to the specified network. Otherwise it prompts the end-user to connect. + * + *

This activity is meant to be started by the provisioning initiator prior to starting + * {@link #ACTION_PROVISION_MANAGED_PROFILE} or {@link + * #ACTION_PROVISION_MANAGED_DEVICE_FROM_TRUSTED_SOURCE}. + * + *

Note that network connectivity is still also handled when provisioning via {@link + * #ACTION_PROVISION_MANAGED_PROFILE} or {@link + * #ACTION_PROVISION_MANAGED_DEVICE_FROM_TRUSTED_SOURCE}. {@link + * #ACTION_ESTABLISH_NETWORK_CONNECTION} should only be used in cases when the provisioning + * initiator would like to do some additional logic after the network connectivity step and + * before the start of provisioning. + * + * If network connection is established, {@link Activity#RESULT_OK} will be returned. Otherwise + * the result will be {@link Activity#RESULT_CANCELED}. + * + * @hide + */ + @RequiresPermission(android.Manifest.permission.DISPATCH_PROVISIONING_MESSAGE) + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) + @SystemApi + public static final String ACTION_ESTABLISH_NETWORK_CONNECTION = + "android.app.action.ESTABLISH_NETWORK_CONNECTION"; + /** * Maximum supported password length. Kind-of arbitrary. * @hide