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

Commit f03752c2 authored by Adam Bookatz's avatar Adam Bookatz Committed by Android (Google) Code Review
Browse files

Merge "UserController.getUserInfo outside of mLock" into main

parents 54bba9f0 cbc6eb37
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -1344,18 +1344,19 @@ class UserController implements Handler.Callback {

    private void finishUserStopping(final int userId, final UserState uss,
            final boolean allowDelayedLocking) {
        final UserInfo userInfo = getUserInfo(userId);
        EventLog.writeEvent(EventLogTags.UC_FINISH_USER_STOPPING, userId);
        synchronized (mLock) {
            if (uss.state != UserState.STATE_STOPPING) {
                // Whoops, we are being started back up.  Abort, abort!
                UserJourneySession session = mInjector.getUserJourneyLogger()
                        .logUserJourneyFinishWithError(-1, getUserInfo(userId),
                        .logUserJourneyFinishWithError(-1, userInfo,
                                USER_JOURNEY_USER_STOP, ERROR_CODE_ABORTED);
                if (session != null) {
                    mHandler.removeMessages(CLEAR_USER_JOURNEY_SESSION_MSG, session);
                } else {
                    mInjector.getUserJourneyLogger()
                            .logUserJourneyFinishWithError(-1, getUserInfo(userId),
                            .logUserJourneyFinishWithError(-1, userInfo,
                                    USER_JOURNEY_USER_STOP, ERROR_CODE_INVALID_SESSION_ID);
                }
                return;
@@ -1441,7 +1442,7 @@ class UserController implements Handler.Callback {
                                    + userId + " callbacks:" + keyEvictedCallbacks);
                    allowDelayedLocking = false;
                }
                userIdToLock = updateUserToLockLU(userId, allowDelayedLocking);
                userIdToLock = updateUserToLockLU(userInfo, allowDelayedLocking);
                if (userIdToLock == UserHandle.USER_NULL) {
                    lockUser = false;
                }
@@ -1581,10 +1582,11 @@ class UserController implements Handler.Callback {
     * @return user id to lock. UserHandler.USER_NULL will be returned if no user should be locked.
     */
    @GuardedBy("mLock")
    private int updateUserToLockLU(@UserIdInt int userId, boolean allowDelayedLocking) {
    private int updateUserToLockLU(UserInfo userInfo, boolean allowDelayedLocking) {
        final int userId = userInfo.id;
        if (!canDelayDataLockingForUser(userId)
                || !allowDelayedLocking
                || getUserInfo(userId).isEphemeral()
                || userInfo.isEphemeral()
                || hasUserRestriction(UserManager.DISALLOW_RUN_IN_BACKGROUND, userId)) {
            return userId;
        }