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

Commit dd3eb607 authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Always set BIND_SCHEDULE_LIKE_TOP_APP for IMEs

With this CL, IME services will be always bound with
BIND_SCHEDULE_LIKE_TOP_APP regardless of their visibility.

Rationales are:

 * IME's cold startup is becoming a more common scenario (e.g. for
   work profile case discussed in Bug 197848765). Its main thread need
   to be scheduled like a top app to complete its initial setup
   (e.g. layout inflations) without waiting for the visibility binding
   that already has BIND_SCHEDULE_LIKE_TOP_APP [1].
   * This may also be able to compensate the additional layout
     inflation cost for navigation bar buttons rendered by the IME
     process (Bug 223741613).
 * InputMethodService#onKeyDown() is expected to be responsive for
   better hardware keyboard experience even when the IME is not
   visible to users.
 * IME authors can already do the same thing by explicitly calling the
   following code in their InputMethodService#onCreate() code.
     Process.setThreadPriority(
             Process.myTid(), Process.THREAD_PRIORITY_TOP_APP_BOOST);
   In other words, this is an existing capability that has been
   available for IMEs.

 [1]: I143fb39cec55351b097e835cf8bbf9668e02d86d
      59730961

Bug: 223741613
Test: Manually done as follows.
 1. Build aosp_coral-userdebug and flash it
 2. adb shell wm dismiss-keyguard
 3. adb shell dumpsys activity processes com.android.inputmethod.latin
 4. Confirm "mCurSchedGroup=3", which is SCHED_GROUP_TOP_APP
 5. adb shell ps -p `adb shell pidof com.android.inputmethod.latin` \
     -T -o PID,TID,PRI,SCH,CMD
 6. Confirm its main thread and RenderThread have priority 29.
    (Without this CL, they are 19 and 23)
Change-Id: I8941b5cd0690ba45e05f914e8ed7286ee9ee9c6f
parent d6ae9b14
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment