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

Commit 6341be1d authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Make TvInputManagerService robust against user race conditions"

parents 1641a7a4 d8349052
Loading
Loading
Loading
Loading
+31 −25
Original line number Diff line number Diff line
@@ -383,6 +383,7 @@ public final class TvInputManagerService extends SystemService {
            if (mCurrentUserId == userId) {
                return;
            }
            if (mUserStates.contains(mCurrentUserId)) {
                UserState userState = mUserStates.get(mCurrentUserId);
                List<SessionState> sessionStatesToRelease = new ArrayList<>();
                for (SessionState sessionState : userState.sessionStateMap.values()) {
@@ -415,6 +416,7 @@ public final class TvInputManagerService extends SystemService {
                        it.remove();
                    }
                }
            }

            mCurrentUserId = userId;
            getOrCreateUserStateLocked(userId);
@@ -490,6 +492,10 @@ public final class TvInputManagerService extends SystemService {
            userState.mainSessionToken = null;

            mUserStates.remove(userId);

            if (userId == mCurrentUserId) {
                switchUser(UserHandle.USER_SYSTEM);
            }
        }
    }