Remove ImfLock dependencies from *Repository
This CL reworks how the following two per-user data stores are
guaranteed to be initialized for each user with also making them
independent of ImfLock.
* AdditionalSubtypeMapRepository
* InputMethodSettingsRepository
Here is a quick summary on how the above per-user data stores will be
initialized.
1. IMMS.Lifecycle(Context context) gets called
1.1 InputMethodManagerService is initialized
1.2 IMMS.Lifecycle#initializeUsersAsync() is called for existing
users, which initializes the above two data stores in the
I/O thread.
2. IMMS.Lifecycle#onBootPhase(int phase) gets called for
PHASE_ACTIVITY_MANAGER_READY
2.1 IMMS#systemRunning() first calls #waitForUserInitialization()
to make sure that initializeUsersAsync() is completed with
a certain timeout (3 sec).
2.2 IMMS#systemRunning() starts tasks with an assumption that the
above per-user data stores are initialized.
Here are useful guarantees we can start relying on with this CL.
* AdditionalSubtypeMap#load() is guaranteed to be called only once
for each user on the I/O thread without ImfLock.
* When IMMS#systemRunning() is running *Repository are already
initialized (unless it's timed out).
This CL should improve the resource utilizations during boot time
without changing the observable semantics.
Bug: 343601565
Fix: 352354308
Test: presubmit
Test: manually verified by checking logcat
Flag: EXEMPT refactor
Change-Id: I4400519f133638c03205f7a8902f7e00c291eda8
5 files changed