Minimize invocations of queryIntentServices() in IMMS
This CL reworks how updates on user locking state and additional subtypes are reflected into the InputMethodSettingsRepository. Previously we have called InputMethodManagerService#queryInputMethodServicesInternal() in a relatively ad-hoc manner, meaning that we have called it whenever we need a new InputMethodMap that is different from the one stored in InputMethodSettingsRepository. With this CL UserData#mRawInputMethodMap keeps track of the raw results of Context#queryIntentServices() for both direct-boot aware IMEs and direct-boot unaware IMEs in a form that additional subtypes are not yet taken into account. The cache allows us to reconstruct the required InputMethodMap on the fly without calling Context#queryIntentServices() again. This is a huge win in terms of both performance and code simplicity. For instance, the following IME APIs no longer need to rely on Context#queryIntentServices() internally, which means that these APIs will return much sooner than before, and more importantly without depending on ActivityManagerService global lock. * InputMethodManager#setAdditionalInputMethodSubtypes() * InputMethodManager#getInputMethodListAsUser() with DirectBootAwareness.ANY Overall there should be no observable behavior change, and wxisting end-to-end CTS tests should verify such expectations. Fix: 354256119 Test: atest CtsInputMethodTestCases Test: atest CtsInputMethodInstallTestCases Test: atest FrameworksInputMethodSystemServerTest Flag: EXEMPT refactor Change-Id: I4cb07b0c776143b2f477ef8bb383ad4e0ed0b204
Loading
Please register or sign in to comment