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

Commit fbc77178 authored by Alex Chau's avatar Alex Chau
Browse files

Add back missing synchronized in stopGuestOrEphemeralUserIfBackground

- mStartedUsers and mCurrentUserId should be locked by mLock

Bug: 72133858
Test: Manually create secondary user, and exit the user in SetupWizard
Change-Id: If59749c06c5d8174462a6f2a255517c60321d9f4
parent 5170831d
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -795,12 +795,14 @@ class UserController implements Handler.Callback {
     */
    private void stopGuestOrEphemeralUserIfBackground(int oldUserId) {
        if (DEBUG_MU) Slog.i(TAG, "Stop guest or ephemeral user if background: " + oldUserId);
        synchronized(mLock) {
            UserState oldUss = mStartedUsers.get(oldUserId);
            if (oldUserId == UserHandle.USER_SYSTEM || oldUserId == mCurrentUserId || oldUss == null
                    || oldUss.state == UserState.STATE_STOPPING
                    || oldUss.state == UserState.STATE_SHUTDOWN) {
                return;
            }
        }

        UserInfo userInfo = getUserInfo(oldUserId);
        if (userInfo.isEphemeral()) {