Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4ac5f854 authored by Julia Reynolds's avatar Julia Reynolds
Browse files

If DISALLOW_REMOVE_USER is enabled, UserManager.removeUser should not remove users.

Bug: 15834711
Change-Id: I8048c971401fe3216a6e92aae1c961a3aee02dde
parent 61606cec
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -1103,6 +1103,12 @@ public class UserManagerService extends IUserManager.Stub {
     */
    public boolean removeUser(int userHandle) {
        checkManageUsersPermission("Only the system can remove users");
        if (getUserRestrictions(UserHandle.getCallingUserId()).getBoolean(
                UserManager.DISALLOW_REMOVE_USER, false)) {
            Log.w(LOG_TAG, "Cannot remove user. DISALLOW_REMOVE_USER is enabled.");
            return false;
        }

        long ident = Binder.clearCallingIdentity();
        try {
            final UserInfo user;