Introduce Context.BIND_SCHEDULE_LIKE_TOP_APP for visible IMEs

This CL introduces a new @hide bind flag BIND_SCHEDULE_LIKE_TOP_APP so
that visible IMEs can have the same thread scheduling policy as the
actual top app, like SCHED_FIFO for UI and RenderThread when it's
available [1] and TOP_APP_PRIORITY_BOOST otherwise [2].

Hopefully this would provide more consistent UI performance and
responsiveness between the actual top app and IME.

 [1]: I7b8a31830ad80f7efa00236928d5476998ed4e00
      33eb07f5759b85a5617f8057d8a335019c7d24dd
 [2]: Iced88269f7e2d378d5870ded1a5ccf9f259fda57
      b783e7b44bf174075f6860d295808ee462b38451

Fix: 117274342
Test: Manually verified as follows.
  1. Build aosp_blueline-userdebug and flash it.
  2. make -j EditTextVariations
  3. adb install -r \
       $ANDROID_TARGET_OUT_TESTCASES/EditTextVariations/EditTextVariations.apk
  4. adb shell am start \
       -n com.android.inputmethod.tools.edittextvariations/.EditTextVariations
  5. Tap the first edit text field to bring up the AOSP Keyboard.
  6. Make sure that top app (EditTextVariations) and the IME (AOSP
     Keyboard) have the same thread priority / scheduler policy for
     their main UI threads and RenderThreads.
      adb shell ps -p \
          `adb shell pidof com.android.inputmethod.tools.edittextvariations` \
          -T -o PID,TID,PRI,SCH,CMD
      adb shell ps -p `adb shell pidof com.android.inputmethod.latin` \
          -T -o PID,TID,PRI,SCH,CMD
     For both UI threads and RenderThreads, Thread Priority should be 29 and
     Scheduler Policy should be 0.
  7. Tap the back button to dismiss AOSP Keyboard.
  8. Make sure that Thread Priority of AOSP Keyboard is no longer boosted.
      adb shell ps -p `adb shell pidof com.android.inputmethod.latin` \
          -T -o PID,TID,PRI,SCH,CMD
     For both UI threads and RenderThreads, Thread Priority should be 19 and
     Scheduler Policy should be 0.
Change-Id: I143fb39cec55351b097e835cf8bbf9668e02d86d
5 files changed