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
This commit is contained in:
Alex Chau
2018-01-18 18:43:35 +00:00
parent 5170831d92
commit fbc7717851

View File

@@ -795,11 +795,13 @@ class UserController implements Handler.Callback {
*/
private void stopGuestOrEphemeralUserIfBackground(int oldUserId) {
if (DEBUG_MU) Slog.i(TAG, "Stop guest or ephemeral user if background: " + oldUserId);
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;
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);