Merge "Clarify "enabled" in UserManager" into main
diff --git a/core/java/android/content/pm/UserInfo.java b/core/java/android/content/pm/UserInfo.java
index 3e9f260..8a3a3ad 100644
--- a/core/java/android/content/pm/UserInfo.java
+++ b/core/java/android/content/pm/UserInfo.java
@@ -112,6 +112,12 @@
/**
* Indicates that this user is disabled.
*
+ * <p> This is currently used to indicate that a Managed Profile, when created via
+ * DevicePolicyManager, has not yet been provisioned; once the DPC provisions it, a DPM call
+ * will manually set it to enabled.
+ *
+ * <p>Users that are slated for deletion are also generally set to disabled.
+ *
* <p>Note: If an ephemeral user is disabled, it shouldn't be later re-enabled. Ephemeral users
* are disabled as their removal is in progress to indicate that they shouldn't be re-entered.
*/
@@ -398,6 +404,7 @@
return UserManager.isUserTypePrivateProfile(userType);
}
+ /** See {@link #FLAG_DISABLED}*/
@UnsupportedAppUsage
public boolean isEnabled() {
return (flags & FLAG_DISABLED) != FLAG_DISABLED;
diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java
index ccb534e..9757a10 100644
--- a/core/java/android/os/UserManager.java
+++ b/core/java/android/os/UserManager.java
@@ -4708,6 +4708,9 @@
* Sets the user as enabled, if such an user exists.
*
* <p>Note that the default is true, it's only that managed profiles might not be enabled.
+ * (Managed profiles created by DevicePolicyManager will start out disabled, and DPM will later
+ * toggle them to enabled once they are provisioned. This is the primary purpose of the
+ * {@link UserInfo#FLAG_DISABLED} flag.)
* Also ephemeral users can be disabled to indicate that their removal is in progress and they
* shouldn't be re-entered. Therefore ephemeral users should not be re-enabled once disabled.
*
@@ -5259,7 +5262,7 @@
/**
* Returns list of the profiles of userId including userId itself.
- * Note that this returns only enabled.
+ * Note that this returns only {@link UserInfo#isEnabled() enabled} profiles.
* <p>Note that this includes all profile types (not including Restricted profiles).
*
* <p>Requires {@link android.Manifest.permission#MANAGE_USERS} or