From b57474fe7cb9d357ca9f0d588399cc5ef3f5ec2f Mon Sep 17 00:00:00 2001 From: arangelov Date: Thu, 7 Jan 2021 15:25:44 +0000 Subject: [PATCH] Add SUPPORTED_MODES_DEVICE_OWNER to force DO provisioning This change is part of the initiative to make managed account provisioning support the admin-integrated flow. This supported mode is necessary for the case when restoring from a device that is a device owner. The target device must be provisioned to a device owner. Fixes: 176975113 Test: compiled Test: This will be separately tested in ManagedProvisioning Change-Id: I9cc47a35562e9061332864d660bb556b56e8f9bc --- core/api/system-current.txt | 1 + .../java/android/app/admin/DevicePolicyManager.java | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/core/api/system-current.txt b/core/api/system-current.txt index 8d748e6370d23..43b754c704b32 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -902,6 +902,7 @@ package android.app.admin { field public static final int STATE_USER_SETUP_FINALIZED = 3; // 0x3 field public static final int STATE_USER_SETUP_INCOMPLETE = 1; // 0x1 field public static final int STATE_USER_UNMANAGED = 0; // 0x0 + field public static final int SUPPORTED_MODES_DEVICE_OWNER = 4; // 0x4 field public static final int SUPPORTED_MODES_ORGANIZATION_AND_PERSONALLY_OWNED = 3; // 0x3 field public static final int SUPPORTED_MODES_ORGANIZATION_OWNED = 1; // 0x1 field public static final int SUPPORTED_MODES_PERSONALLY_OWNED = 2; // 0x2 diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java index 4b6a2664b17b4..56720b36adb3e 100644 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -1257,7 +1257,8 @@ public class DevicePolicyManager { @IntDef(prefix = { "SUPPORTED_MODES_" }, value = { SUPPORTED_MODES_ORGANIZATION_OWNED, SUPPORTED_MODES_PERSONALLY_OWNED, - SUPPORTED_MODES_ORGANIZATION_AND_PERSONALLY_OWNED + SUPPORTED_MODES_ORGANIZATION_AND_PERSONALLY_OWNED, + SUPPORTED_MODES_DEVICE_OWNER }) @Retention(RetentionPolicy.SOURCE) public @interface ProvisioningConfiguration {} @@ -1383,6 +1384,15 @@ public class DevicePolicyManager { @SystemApi public static final int SUPPORTED_MODES_ORGANIZATION_AND_PERSONALLY_OWNED = 3; + /** + * A value for {@link #EXTRA_PROVISIONING_SUPPORTED_MODES} indicating that the only supported + * provisioning mode is device owner. + * + * @hide + */ + @SystemApi + public static final int SUPPORTED_MODES_DEVICE_OWNER = 4; + /** * This MIME type is used for starting the device owner provisioning. * @@ -2519,6 +2529,7 @@ public class DevicePolicyManager { * @see #SUPPORTED_MODES_ORGANIZATION_OWNED * @see #SUPPORTED_MODES_PERSONALLY_OWNED * @see #SUPPORTED_MODES_ORGANIZATION_AND_PERSONALLY_OWNED + * @see #SUPPORTED_MODES_DEVICE_OWNER * @hide */ @SystemApi