HsumBootUserInitializer creates MainUser earlier
Previously, on first boot, an HSUM device would unlock the system user,
then create the MainUser (if needed), and then switch to the boot user,
all at around the same time.
This cl reorders these events and spreads them out:
* first, early on (just prior to PHASE_SYSTEM_SERVICES_READY), the
MainUser is created (if needed)
* later (after PHASE_THIRD_PARTY_APPS_CAN_START), the system user is
unlocked
* then we promptly switch to the boot user. This needs to be after
PHASE_THIRD_PARTY_APPS_CAN_START since special apps may designate a
different boot user.
This will ensure that the MainUser can be retrieved much earlier on by
system services whose operations may depend on it.
Also, the structure of BootUserInitializer is renamed to better reflect
its role, and its structure is modified slightly to allow SystemServer
to use it more easily.
Bug: 262438904
Bug: 266098768
Test: flashed HSUM and confirmed that MainUser was created as needed
Test: atest FrameworksMockingServicesTests:com.android.server.pm.UserManagerServiceTest
Change-Id: Ic84b1be538234b2bfde3ae792c9a923ace55f24c
6 files changed