diff options
| author | 2024-05-15 21:50:07 +0900 | |
|---|---|---|
| committer | 2024-05-15 21:50:07 +0900 | |
| commit | db19711e043340805ea94548ed31012122d913a6 (patch) | |
| tree | e6f4b1d7cb5d33999f86afacd0adf916ab5bf4c1 /libs/androidfw/StringPool.cpp | |
| parent | 4e7848ccfc4ae3e79f1a4bee5bb57d123492bfbe (diff) | |
Avoid resource I/O when holding ImfLock
Loading InputMethodInfo from APK resources is full of disk I/O, which
can result in ANR as seen in Bug 340221861. This CL aims to avoid such
disk I/O when holding ImfLock.
With this CL
MyPackageMonitor#onFinishPackageChangesInternal()
updates IME list as follows.
1. Create List<InputMethodInfo> without additional subtypes
2. Acquire ImfLock.class
3. Finalize additional subtypes
4. Finalize List<InputMethodInfo>
5. Release ImfLock.class
The key idea is the fact that List<InputMethodInfo> can be
instantiated without ImfLock as long as we can ignore additional
subtypes at the step 1. Creating the final List<InputMethodInfo> at
the step 4 is a pure computatoin, which does not require any disk I/O.
There must be no user observable behavior change.
Fix: 340221861
Test: presubmit
Change-Id: I263cd49dd4d64b64136acc3dad469f83a862ce97
Diffstat (limited to 'libs/androidfw/StringPool.cpp')
0 files changed, 0 insertions, 0 deletions