diff --git a/core/api/system-current.txt b/core/api/system-current.txt index 59ae926f071fd..8cb8397c9556e 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -959,6 +959,9 @@ 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 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 field public static final int PROVISIONING_TRIGGER_CLOUD_ENROLLMENT = 1; // 0x1 field public static final int PROVISIONING_TRIGGER_MANAGED_ACCOUNT = 4; // 0x4 field @Deprecated public static final int PROVISIONING_TRIGGER_PERSISTENT_DEVICE_OWNER = 3; // 0x3 @@ -973,10 +976,6 @@ 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 } public final class SystemUpdatePolicy implements android.os.Parcelable { diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java index 843aa2ecb4925..d9ef12c11f549 100644 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -1214,15 +1214,14 @@ public class DevicePolicyManager { public @interface ProvisioningTrigger {} /** - * Possible values for {@link #EXTRA_PROVISIONING_SUPPORTED_MODES}. + * Flags for {@link #EXTRA_PROVISIONING_SUPPORTED_MODES}. * * @hide */ - @IntDef(prefix = { "SUPPORTED_MODES_" }, value = { - SUPPORTED_MODES_ORGANIZATION_OWNED, - SUPPORTED_MODES_PERSONALLY_OWNED, - SUPPORTED_MODES_ORGANIZATION_AND_PERSONALLY_OWNED, - SUPPORTED_MODES_DEVICE_OWNER + @IntDef(flag = true, prefix = { "FLAG_SUPPORTED_MODES_" }, value = { + FLAG_SUPPORTED_MODES_ORGANIZATION_OWNED, + FLAG_SUPPORTED_MODES_PERSONALLY_OWNED, + FLAG_SUPPORTED_MODES_DEVICE_OWNER }) @Retention(RetentionPolicy.SOURCE) public @interface ProvisioningConfiguration {} @@ -1307,7 +1306,7 @@ public class DevicePolicyManager { public static final int PROVISIONING_TRIGGER_MANAGED_ACCOUNT = 4; /** - * A value for {@link #EXTRA_PROVISIONING_SUPPORTED_MODES} indicating that provisioning is + * Flag for {@link #EXTRA_PROVISIONING_SUPPORTED_MODES} indicating that provisioning is * organization-owned. * *
Using this value indicates the admin app can only be provisioned in either a @@ -1316,55 +1315,48 @@ public class DevicePolicyManager { * #EXTRA_PROVISIONING_ALLOWED_PROVISIONING_MODES} array extra contain {@link * #PROVISIONING_MODE_MANAGED_PROFILE} and {@link #PROVISIONING_MODE_FULLY_MANAGED_DEVICE}. * - *
Also, if this value is set, the admin app's {@link #ACTION_GET_PROVISIONING_MODE} activity + *
Also, if this flag is set, the admin app's {@link #ACTION_GET_PROVISIONING_MODE} activity * will not receive the {@link #EXTRA_PROVISIONING_IMEI} and {@link * #EXTRA_PROVISIONING_SERIAL_NUMBER} extras. * - * @hide - */ - @SystemApi - public static final int SUPPORTED_MODES_ORGANIZATION_OWNED = 1; - - /** - * A value for {@link #EXTRA_PROVISIONING_SUPPORTED_MODES} indicating that provisioning is - * personally-owned. - * - *
Using this value will cause the admin app's {@link #ACTION_GET_PROVISIONING_MODE} - * activity to have the {@link #EXTRA_PROVISIONING_ALLOWED_PROVISIONING_MODES} array extra - * contain only {@link #PROVISIONING_MODE_MANAGED_PROFILE}. - * - * @hide - */ - @SystemApi - public static final int SUPPORTED_MODES_PERSONALLY_OWNED = 2; - - /** - * A value for {@link #EXTRA_PROVISIONING_SUPPORTED_MODES} indicating that provisioning could - * be organization-owned or personally-owned. - * - *
Using this value will cause the admin app's {@link #ACTION_GET_PROVISIONING_MODE} - * activity to have the {@link #EXTRA_PROVISIONING_ALLOWED_PROVISIONING_MODES} array extra - * contain {@link + *
This flag can be combined with {@link #FLAG_SUPPORTED_MODES_PERSONALLY_OWNED}. In + * that case, the admin app's {@link #ACTION_GET_PROVISIONING_MODE} activity will have + * the {@link #EXTRA_PROVISIONING_ALLOWED_PROVISIONING_MODES} array extra contain {@link * #PROVISIONING_MODE_MANAGED_PROFILE}, {@link #PROVISIONING_MODE_FULLY_MANAGED_DEVICE} and * {@link #PROVISIONING_MODE_MANAGED_PROFILE_ON_PERSONAL_DEVICE}. * - *
Also, if this value is set, the admin app's {@link #ACTION_GET_PROVISIONING_MODE} activity - * will not receive the {@link #EXTRA_PROVISIONING_IMEI} and {@link - * #EXTRA_PROVISIONING_SERIAL_NUMBER} extras. - * * @hide */ @SystemApi - public static final int SUPPORTED_MODES_ORGANIZATION_AND_PERSONALLY_OWNED = 3; + public static final int FLAG_SUPPORTED_MODES_ORGANIZATION_OWNED = 1; /** - * A value for {@link #EXTRA_PROVISIONING_SUPPORTED_MODES} indicating that the only supported - * provisioning mode is device owner. + * Flag for {@link #EXTRA_PROVISIONING_SUPPORTED_MODES} indicating that provisioning + * is personally-owned. + * + *
Using this flag will cause the admin app's {@link #ACTION_GET_PROVISIONING_MODE} + * activity to have the {@link #EXTRA_PROVISIONING_ALLOWED_PROVISIONING_MODES} array extra + * contain only {@link #PROVISIONING_MODE_MANAGED_PROFILE}. + * + *
This flag can be combined with {@link #FLAG_SUPPORTED_MODES_ORGANIZATION_OWNED}. In + * that case, the admin app's {@link #ACTION_GET_PROVISIONING_MODE} activity will have the + * {@link #EXTRA_PROVISIONING_ALLOWED_PROVISIONING_MODES} array extra contain {@link + * #PROVISIONING_MODE_MANAGED_PROFILE}, {@link #PROVISIONING_MODE_FULLY_MANAGED_DEVICE} and + * {@link #PROVISIONING_MODE_MANAGED_PROFILE_ON_PERSONAL_DEVICE}. * * @hide */ @SystemApi - public static final int SUPPORTED_MODES_DEVICE_OWNER = 4; + public static final int FLAG_SUPPORTED_MODES_PERSONALLY_OWNED = 1 << 1; + + /** + * Flag for {@link #EXTRA_PROVISIONING_SUPPORTED_MODES} indicating that the only + * supported provisioning mode is device owner. + * + * @hide + */ + @SystemApi + public static final int FLAG_SUPPORTED_MODES_DEVICE_OWNER = 1 << 2; /** * This MIME type is used for starting the device owner provisioning. @@ -2637,7 +2629,7 @@ public class DevicePolicyManager { * An integer extra indication what provisioning modes should be available for the admin app * to pick. * - *
The default value is {@link #SUPPORTED_MODES_ORGANIZATION_OWNED}. + *
The default value is {@link #FLAG_SUPPORTED_MODES_ORGANIZATION_OWNED}. * *
The value of this extra will determine the contents of the {@link * #EXTRA_PROVISIONING_ALLOWED_PROVISIONING_MODES} array that is passed to the admin app as an @@ -2648,13 +2640,21 @@ public class DevicePolicyManager { * #ACTION_GET_PROVISIONING_MODE} activity via the {@link #EXTRA_PROVISIONING_IMEI} and {@link * #EXTRA_PROVISIONING_SERIAL_NUMBER} respectively. * + *
The allowed flag combinations are: + *
This extra is only respected when provided alongside the {@link * #ACTION_PROVISION_MANAGED_DEVICE_FROM_TRUSTED_SOURCE} intent action. * - * @see #SUPPORTED_MODES_ORGANIZATION_OWNED - * @see #SUPPORTED_MODES_PERSONALLY_OWNED - * @see #SUPPORTED_MODES_ORGANIZATION_AND_PERSONALLY_OWNED - * @see #SUPPORTED_MODES_DEVICE_OWNER + * @see #FLAG_SUPPORTED_MODES_ORGANIZATION_OWNED + * @see #FLAG_SUPPORTED_MODES_PERSONALLY_OWNED + * @see #FLAG_SUPPORTED_MODES_DEVICE_OWNER * @hide */ @SystemApi