Loading core/java/android/os/IUserManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -54,7 +54,7 @@ interface IUserManager { void setUserIcon(int userHandle, in Bitmap icon); ParcelFileDescriptor getUserIcon(int userHandle); UserInfo getPrimaryUser(); List<UserInfo> getUsers(boolean excludeDying); List<UserInfo> getUsers(boolean excludePartial, boolean excludeDying, boolean excludePreCreated); List<UserInfo> getProfiles(int userHandle, boolean enabledOnly); int[] getProfileIds(int userId, boolean enabledOnly); boolean canAddMoreManagedProfiles(int userHandle, boolean allowedToRemoveOne); Loading core/java/android/os/UserManager.java +21 −17 Original line number Diff line number Diff line Loading @@ -2389,15 +2389,26 @@ public class UserManager { /** * Returns information for all users on this device, including ones marked for deletion. * To retrieve only users that are alive, use {@link #getUsers(boolean)}. * <p> * Requires {@link android.Manifest.permission#MANAGE_USERS} permission. * * @return the list of users that exist on the device. * @hide */ @UnsupportedAppUsage @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public List<UserInfo> getUsers() { return getUsers(/* excludeDying= */ false); } /** * Returns information for all users on this device, based on the filtering parameters. * * @hide */ @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public List<UserInfo> getUsers(boolean excludePartial, boolean excludeDying, boolean excludePreCreated) { try { return mService.getUsers(false); return mService.getUsers(excludePartial, excludeDying, excludePreCreated); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } Loading @@ -2413,16 +2424,12 @@ public class UserManager { @SystemApi @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public long[] getSerialNumbersOfUsers(boolean excludeDying) { try { List<UserInfo> users = mService.getUsers(excludeDying); List<UserInfo> users = getUsers(excludeDying); long[] result = new long[users.size()]; for (int i = 0; i < result.length; i++) { result[i] = users.get(i).serialNumber; } return result; } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } } /** Loading Loading @@ -2806,11 +2813,8 @@ public class UserManager { */ @UnsupportedAppUsage public @NonNull List<UserInfo> getUsers(boolean excludeDying) { try { return mService.getUsers(excludeDying); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } return getUsers(/*excludePartial= */ true, excludeDying, /* excludePreCreated= */ true); } /** Loading services/core/java/com/android/server/pm/UserManagerService.java +4 −2 Original line number Diff line number Diff line Loading @@ -663,12 +663,12 @@ public class UserManagerService extends IUserManager.Stub { return null; } @Override public @NonNull List<UserInfo> getUsers(boolean excludeDying) { return getUsers(/*excludePartial= */ true, excludeDying, /* excludePreCreated= */ true); } private @NonNull List<UserInfo> getUsers(boolean excludePartial, boolean excludeDying, @Override public @NonNull List<UserInfo> getUsers(boolean excludePartial, boolean excludeDying, boolean excludePreCreated) { checkManageOrCreateUsersPermission("query users"); synchronized (mUsersLock) { Loading Loading @@ -2739,6 +2739,8 @@ public class UserManagerService extends IUserManager.Stub { Preconditions.checkArgument(!UserInfo.isManagedProfile(flags), "cannot pre-create managed profiles"); Slog.i(LOG_TAG, "Pre-creating user with flags " + UserInfo.flagsToString(flags)); return createUserInternalUnchecked(/* name= */ null, flags, /* parentId= */ UserHandle.USER_NULL, /* preCreate= */ true, /* disallowedPackages= */ null); Loading Loading
core/java/android/os/IUserManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -54,7 +54,7 @@ interface IUserManager { void setUserIcon(int userHandle, in Bitmap icon); ParcelFileDescriptor getUserIcon(int userHandle); UserInfo getPrimaryUser(); List<UserInfo> getUsers(boolean excludeDying); List<UserInfo> getUsers(boolean excludePartial, boolean excludeDying, boolean excludePreCreated); List<UserInfo> getProfiles(int userHandle, boolean enabledOnly); int[] getProfileIds(int userId, boolean enabledOnly); boolean canAddMoreManagedProfiles(int userHandle, boolean allowedToRemoveOne); Loading
core/java/android/os/UserManager.java +21 −17 Original line number Diff line number Diff line Loading @@ -2389,15 +2389,26 @@ public class UserManager { /** * Returns information for all users on this device, including ones marked for deletion. * To retrieve only users that are alive, use {@link #getUsers(boolean)}. * <p> * Requires {@link android.Manifest.permission#MANAGE_USERS} permission. * * @return the list of users that exist on the device. * @hide */ @UnsupportedAppUsage @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public List<UserInfo> getUsers() { return getUsers(/* excludeDying= */ false); } /** * Returns information for all users on this device, based on the filtering parameters. * * @hide */ @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public List<UserInfo> getUsers(boolean excludePartial, boolean excludeDying, boolean excludePreCreated) { try { return mService.getUsers(false); return mService.getUsers(excludePartial, excludeDying, excludePreCreated); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } Loading @@ -2413,16 +2424,12 @@ public class UserManager { @SystemApi @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public long[] getSerialNumbersOfUsers(boolean excludeDying) { try { List<UserInfo> users = mService.getUsers(excludeDying); List<UserInfo> users = getUsers(excludeDying); long[] result = new long[users.size()]; for (int i = 0; i < result.length; i++) { result[i] = users.get(i).serialNumber; } return result; } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } } /** Loading Loading @@ -2806,11 +2813,8 @@ public class UserManager { */ @UnsupportedAppUsage public @NonNull List<UserInfo> getUsers(boolean excludeDying) { try { return mService.getUsers(excludeDying); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } return getUsers(/*excludePartial= */ true, excludeDying, /* excludePreCreated= */ true); } /** Loading
services/core/java/com/android/server/pm/UserManagerService.java +4 −2 Original line number Diff line number Diff line Loading @@ -663,12 +663,12 @@ public class UserManagerService extends IUserManager.Stub { return null; } @Override public @NonNull List<UserInfo> getUsers(boolean excludeDying) { return getUsers(/*excludePartial= */ true, excludeDying, /* excludePreCreated= */ true); } private @NonNull List<UserInfo> getUsers(boolean excludePartial, boolean excludeDying, @Override public @NonNull List<UserInfo> getUsers(boolean excludePartial, boolean excludeDying, boolean excludePreCreated) { checkManageOrCreateUsersPermission("query users"); synchronized (mUsersLock) { Loading Loading @@ -2739,6 +2739,8 @@ public class UserManagerService extends IUserManager.Stub { Preconditions.checkArgument(!UserInfo.isManagedProfile(flags), "cannot pre-create managed profiles"); Slog.i(LOG_TAG, "Pre-creating user with flags " + UserInfo.flagsToString(flags)); return createUserInternalUnchecked(/* name= */ null, flags, /* parentId= */ UserHandle.USER_NULL, /* preCreate= */ true, /* disallowedPackages= */ null); Loading