summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Varun Shah <varunshah@google.com> 2018-10-27 02:07:56 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2018-10-27 02:07:56 +0000
commit59a1ff3ee74473e6acab0dfb28ccd7526a43813a (patch)
treec1d54b1aaa51210f91349f6c60b59d093022a9d0
parentf0e7b9b35b84637f5e805d803b3be7158c11766f (diff)
parente142e3361346c52cd55af96a3b8ccb9e81328650 (diff)
Merge "Exposes user type related hidden APIs in UserManager."
-rw-r--r--api/system-current.txt3
-rw-r--r--config/hiddenapi-vendor-list.txt1
-rw-r--r--core/java/android/os/UserManager.java26
3 files changed, 22 insertions, 8 deletions
diff --git a/api/system-current.txt b/api/system-current.txt
index fb97643129bd..c08606ee0cb2 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -4154,8 +4154,11 @@ package android.os {
method public deprecated int getUserRestrictionSource(java.lang.String, android.os.UserHandle);
method public java.util.List<android.os.UserManager.EnforcingUser> getUserRestrictionSources(java.lang.String, android.os.UserHandle);
method public boolean hasRestrictedProfiles();
+ method public boolean isAdminUser();
+ method public boolean isGuestUser();
method public boolean isManagedProfile();
method public boolean isManagedProfile(int);
+ method public boolean isPrimaryUser();
method public boolean isRestrictedProfile();
field public static final java.lang.String ACTION_USER_RESTRICTIONS_CHANGED = "android.os.action.USER_RESTRICTIONS_CHANGED";
field public static final deprecated java.lang.String DISALLOW_OEM_UNLOCK = "no_oem_unlock";
diff --git a/config/hiddenapi-vendor-list.txt b/config/hiddenapi-vendor-list.txt
index e5e64d34f721..4275bd47f1ad 100644
--- a/config/hiddenapi-vendor-list.txt
+++ b/config/hiddenapi-vendor-list.txt
@@ -120,7 +120,6 @@ Landroid/os/SystemService;->stop(Ljava/lang/String;)V
Landroid/os/SystemVibrator;-><init>()V
Landroid/os/UserHandle;->isSameApp(II)Z
Landroid/os/UserManager;->hasUserRestriction(Ljava/lang/String;Landroid/os/UserHandle;)Z
-Landroid/os/UserManager;->isAdminUser()Z
Landroid/R$styleable;->CheckBoxPreference:[I
Landroid/telephony/ims/compat/feature/MMTelFeature;-><init>()V
Landroid/telephony/ims/compat/ImsService;-><init>()V
diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java
index 00b989e03c61..1a84197974b4 100644
--- a/core/java/android/os/UserManager.java
+++ b/core/java/android/os/UserManager.java
@@ -1278,6 +1278,8 @@ public class UserManager {
* @return whether this process is running under the primary user.
* @hide
*/
+ @SystemApi
+ @RequiresPermission(android.Manifest.permission.MANAGE_USERS)
public boolean isPrimaryUser() {
UserInfo user = getUserInfo(UserHandle.myUserId());
return user != null && user.isPrimary();
@@ -1295,10 +1297,15 @@ public class UserManager {
}
/**
+ * Used to check if this process is running as an admin user. An admin user is allowed to
+ * modify or configure certain settings that aren't available to non-admin users,
+ * create and delete additional users, etc. There can be more than one admin users.
+ *
+ * @return whether this process is running under an admin user.
* @hide
- * Returns whether the caller is running as an admin user. There can be more than one admin
- * user.
*/
+ @SystemApi
+ @RequiresPermission(android.Manifest.permission.MANAGE_USERS)
public boolean isAdminUser() {
return isUserAdmin(UserHandle.myUserId());
}
@@ -1323,12 +1330,14 @@ public class UserManager {
}
/**
- * Returns whether the caller is running as restricted profile. Restricted profile may have
- * a reduced number of available apps, app restrictions and account restrictions.
- * @return whether the user making this call is a linked user
+ * Used to check if this process is running under a restricted profile. Restricted profiles
+ * may have a reduced number of available apps, app restrictions, and account restrictions.
+ *
+ * @return whether this process is running under a restricted profile.
* @hide
*/
@SystemApi
+ @RequiresPermission(android.Manifest.permission.MANAGE_USERS)
public boolean isRestrictedProfile() {
try {
return mService.isRestricted();
@@ -1374,10 +1383,13 @@ public class UserManager {
}
/**
- * Checks if the calling app is running as a guest user.
- * @return whether the caller is a guest user.
+ * Used to check if this process is running under a guest user. A guest user may be transient.
+ *
+ * @return whether this process is running under a guest user.
* @hide
*/
+ @SystemApi
+ @RequiresPermission(android.Manifest.permission.MANAGE_USERS)
public boolean isGuestUser() {
UserInfo user = getUserInfo(UserHandle.myUserId());
return user != null && user.isGuest();