Offload I/O writes to a bg thread in AdditionalSubtypeMapRepository
This is a part of our on-going effort to ensure that slow I/O operations will not block the entire system in InputMethodManagerService (Bug 343601565). This CL introduces a dedicated worker thread to enable AdditionalSubtypeMapRepository to A. reduce potential lock contentions and the risk of ANRs around ImfLock.class due to slow I/O. B. merge multiple write operations into a single write operation. without changing user-observable semantics. Of course there is a risk that additional subtypes can be lost if the system_server is unexpectedly rebooted before the pending write operations are fulfilled, but the overall benefits are supposed to be much larger than such a risk, which can be easily recovered when the IME calls InputMethodManager#setAdditionalInputMethodSubtypes() again. Bug: 341158961 Test: presubmit Test: Manually verified as follows 1. Build aosp_cf_x86_64_only_phone-trunk_staging-eng and run it 2. Wait until the device fully boots up 3. adb reboot # to avoid Bug 121259290 4. adb root 5. adb shell "abx2xml /data/system/inputmethod/subtypes.xml -" -> make sure the content looks as follows: <subtypes> <imi id="com.android.inputmethod.latin/.LatinIME"> <subtype ....> <subtype ....> </imi/> </subtypes> 6. Open AOSP Keyboard settings 7. Go to "Appearance & Layouts" -> "Custom input styles" 8. Remove all layouts 9. adb shell "abx2xml /data/system/inputmethod/subtypes.xml -" -> make sure the file no longer exists 10. adb shell ls /data/system/inputmethod -> make sure the directory no longer exists 11. adb reboot 12. adb logcat -s InputMethodManagerService:* -> no error message about /data/system/inputmethod 13. Open AOSP Keyboard settings 14. Go to "Appearance & Layouts" -> "Custom input styles" 15. Add English (US) - Dvorak 16. adb shell ls /data/system/inputmethod -> make sure the directory exists and only the system user can access it Change-Id: If51063a272317907505964cf2947e239661cc4ae
Loading
Please register or sign in to comment