Loading core/java/android/os/IUserManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,7 @@ interface IUserManager { List<UserInfo> getUsers(boolean excludePartial, boolean excludeDying, boolean excludePreCreated); List<UserInfo> getProfiles(int userId, boolean enabledOnly); int[] getProfileIds(int userId, boolean enabledOnly); boolean isUserTypeEnabled(in String userType); boolean canAddMoreUsersOfType(in String userType); boolean canAddMoreProfilesToUser(in String userType, int userId, boolean allowedToRemoveOne); boolean canAddMoreManagedProfiles(int userId, boolean allowedToRemoveOne); Loading core/java/android/os/UserManager.java +19 −0 Original line number Diff line number Diff line Loading @@ -3957,6 +3957,25 @@ public class UserManager { } } /** * Checks whether this device supports users of the given user type. * * @param userType the type of user, such as {@link UserManager#USER_TYPE_FULL_SECONDARY}. * @return true if the creation of users of the given user type is enabled on this device. * @hide */ @RequiresPermission(anyOf = { android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.CREATE_USERS }) public boolean isUserTypeEnabled(@NonNull String userType) { try { return mService.isUserTypeEnabled(userType); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } } /** * Returns list of the profiles of userId including userId itself. * Note that this returns both enabled and not enabled profiles. See Loading services/core/java/com/android/server/pm/UserManagerService.java +8 −0 Original line number Diff line number Diff line Loading @@ -2408,6 +2408,14 @@ public class UserManagerService extends IUserManager.Stub { return userTypeDetails != null && canAddMoreUsersOfType(userTypeDetails); } /** Returns whether the creation of users of the given user type is enabled on this device. */ @Override public boolean isUserTypeEnabled(String userType) { checkManageOrCreateUsersPermission("check if user type is enabled."); final UserTypeDetails userTypeDetails = mUserTypes.get(userType); return userTypeDetails != null && userTypeDetails.isEnabled(); } @Override public boolean canAddMoreManagedProfiles(@UserIdInt int userId, boolean allowedToRemoveOne) { return canAddMoreProfilesToUser(UserManager.USER_TYPE_PROFILE_MANAGED, userId, Loading Loading
core/java/android/os/IUserManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,7 @@ interface IUserManager { List<UserInfo> getUsers(boolean excludePartial, boolean excludeDying, boolean excludePreCreated); List<UserInfo> getProfiles(int userId, boolean enabledOnly); int[] getProfileIds(int userId, boolean enabledOnly); boolean isUserTypeEnabled(in String userType); boolean canAddMoreUsersOfType(in String userType); boolean canAddMoreProfilesToUser(in String userType, int userId, boolean allowedToRemoveOne); boolean canAddMoreManagedProfiles(int userId, boolean allowedToRemoveOne); Loading
core/java/android/os/UserManager.java +19 −0 Original line number Diff line number Diff line Loading @@ -3957,6 +3957,25 @@ public class UserManager { } } /** * Checks whether this device supports users of the given user type. * * @param userType the type of user, such as {@link UserManager#USER_TYPE_FULL_SECONDARY}. * @return true if the creation of users of the given user type is enabled on this device. * @hide */ @RequiresPermission(anyOf = { android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.CREATE_USERS }) public boolean isUserTypeEnabled(@NonNull String userType) { try { return mService.isUserTypeEnabled(userType); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } } /** * Returns list of the profiles of userId including userId itself. * Note that this returns both enabled and not enabled profiles. See Loading
services/core/java/com/android/server/pm/UserManagerService.java +8 −0 Original line number Diff line number Diff line Loading @@ -2408,6 +2408,14 @@ public class UserManagerService extends IUserManager.Stub { return userTypeDetails != null && canAddMoreUsersOfType(userTypeDetails); } /** Returns whether the creation of users of the given user type is enabled on this device. */ @Override public boolean isUserTypeEnabled(String userType) { checkManageOrCreateUsersPermission("check if user type is enabled."); final UserTypeDetails userTypeDetails = mUserTypes.get(userType); return userTypeDetails != null && userTypeDetails.isEnabled(); } @Override public boolean canAddMoreManagedProfiles(@UserIdInt int userId, boolean allowedToRemoveOne) { return canAddMoreProfilesToUser(UserManager.USER_TYPE_PROFILE_MANAGED, userId, Loading