Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit db19711e authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

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
parent 4e7848cc
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment