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

Commit f3c86086 authored by Nikhil Kumar's avatar Nikhil Kumar Committed by Android (Google) Code Review
Browse files

Merge "Refactored switchUSer to handle user switch back to the current user" into main

parents 685000c6 46088e4f
Loading
Loading
Loading
Loading
+18 −17
Original line number Diff line number Diff line
@@ -1999,7 +1999,9 @@ class UserController implements Handler.Callback {
        EventLog.writeEvent(EventLogTags.UC_SWITCH_USER, targetUserId);
        int currentUserId = getCurrentUserId();
        UserInfo targetUserInfo = getUserInfo(targetUserId);
        if (targetUserId == currentUserId) {
        boolean userSwitchUiEnabled;
        synchronized (mLock) {
            if (targetUserId == currentUserId && mTargetUserId == UserHandle.USER_NULL) {
                Slogf.i(TAG, "user #" + targetUserId + " is already the current user");
                return true;
            }
@@ -2012,12 +2014,11 @@ class UserController implements Handler.Callback {
                return false;
            }
            if (FactoryResetter.isFactoryResetting()) {
            Slogf.w(TAG, "Cannot switch to User #" + targetUserId + ": factory reset in progress");
                Slogf.w(TAG, "Cannot switch to User #" + targetUserId
                        + ": factory reset in progress");
                return false;
            }

        boolean userSwitchUiEnabled;
        synchronized (mLock) {
            if (!mInitialized) {
                Slogf.e(TAG, "Cannot switch to User #" + targetUserId
                        + ": UserController not ready yet");