Set mCurrentUserId before UC.startUserInternal returns.
UserController.startUserInternal method was broken into two parts after ag/31995061, executing the first half on the caller's thread, and the last half on the UserController.mHandler thread, in order to make sure onBeforeUserSwitching event is called for the UserSwitchObservers on UserController.mHandler thread, and to be synced with the other events of UserSwitchObservers. Otherwise, it was causing a race condition. More info can be found on the commit message of the CL with the Change-Id I3b9de74fc74fc586656ea962b4efafc2442cf5d1 While that CL was fixing the race condition, it was changing the behavior of the UserController.startUserInternal method. Before the CL, the method was setting mCurrentUserId in case of a foreground user start, before returning. But now, the mCurrentUserId is set on a different thread, which can lead to some unexpected results for the already existing parts of the platform. This CL makes the behavior of the UserController.startUserInternal method more similar to how it was before ag/31995061, without losing the fix. Bug: 378175388 Test: atest UserControllerTest Flag: EXEMPT bugfix Change-Id: I236ad92d4f6e8c936ff8045d3a8c6d351645c4cd
Loading
Please register or sign in to comment