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

Commit 6eb09390 authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Prevent user ID reuse until after reboot.

We're still seeing rare cases where a device struggles to create a
new user, probably because of a subtle bug in the FUSE daemon.  To
work around this, only allow user IDs reuse after reboot.

Bug: 8302014
Change-Id: Id7f9fb539c6d6d1ff3d47d941af1d9e6b93eca03
parent 2cffc7da
Loading
Loading
Loading
Loading
+5 −12
Original line number Diff line number Diff line
@@ -1298,7 +1298,12 @@ public class UserManagerService extends IUserManager.Stub {
                if (userHandle == 0 || user == null || mRemovingUserIds.get(userHandle)) {
                    return false;
                }

                // We remember deleted user IDs to prevent them from being
                // reused during the current boot; they can still be reused
                // after a reboot.
                mRemovingUserIds.put(userHandle, true);

                try {
                    mAppOpsService.removeUser(userHandle);
                } catch (RemoteException e) {
@@ -1387,18 +1392,6 @@ public class UserManagerService extends IUserManager.Stub {
        // Remove this user from the list
        mUsers.remove(userHandle);

        // Have user ID linger for several seconds to let external storage VFS
        // cache entries expire. This must be greater than the 'entry_valid'
        // timeout used by the FUSE daemon.
        mHandler.postDelayed(new Runnable() {
            @Override
            public void run() {
                synchronized (mPackagesLock) {
                    mRemovingUserIds.delete(userHandle);
                }
            }
        }, MINUTE_IN_MILLIS);

        mRestrictionsPinStates.remove(userHandle);
        // Remove user file
        AtomicFile userFile = new AtomicFile(new File(mUsersDir, userHandle + XML_SUFFIX));