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

Commit ee58b4f4 authored by Kenny Guy's avatar Kenny Guy
Browse files

Fix bug with removeUser assuming it is called from system uid.

This causes adb shell pm remove-user to fail.

Bug: 15160176
Change-Id: If1ff61dbde90f930d32affd87f935b318df813df
parent 94d76b3b
Loading
Loading
Loading
Loading
+46 −42
Original line number Diff line number Diff line
@@ -1140,6 +1140,8 @@ public class UserManagerService extends IUserManager.Stub {
     */
    public boolean removeUser(int userHandle) {
        checkManageUsersPermission("Only the system can remove users");
        long ident = Binder.clearCallingIdentity();
        try {
            final UserInfo user;
            synchronized (mPackagesLock) {
                user = mUsers.get(userHandle);
@@ -1185,8 +1187,10 @@ public class UserManagerService extends IUserManager.Stub {
            } catch (RemoteException e) {
                return false;
            }

            return res == ActivityManager.USER_OP_SUCCESS;
        } finally {
            Binder.restoreCallingIdentity(ident);
        }
    }

    void finishRemoveUser(final int userHandle) {