Set user state to STATE_BOOTING 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 the user state to STATE_BOOTING before returning. But
now, the user state can be null for a short period of time, 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: 396564030
Test: atest UserControllerTest
Flag: EXEMPT bugfix
Change-Id: I78eea7fbf1c8d507a2575796b1bafe2d443b6ec7
1 file changed