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

Get InputMethodManager in View only if needed

The perf regression found in my initial attempt [1] to instantiate
InputMethodManager (IMM) for each display revieled that when a Window
gained/lost focus,
  getContext().getSystemService(InputMethodManager.class)
gets called for all the View objects that belong to the Window.

This CL introduces a private utility method
  View.notifyFocusChangeToInputMethodManager()
to replace existing unnecessary acquisitions of IMM in View.java,
including the most concerning one View.onWindowFocusChanged().

There should be no negative side-effect in doing this optimization.

LatencyTests results:
  testExpandNotificationsLatency on taimen-userdebug
    without this CL:
      results=[43, 46, 58, 47, 52, 59, 55, 59, 58, 46]
      min: 43.0, max:59.0, avg:54.7, median:53.5, std_dev:5.967
    with this CL:
      results=[41, 58, 55, 59, 60, 67, 51, 55, 55, 55]
      min: 41.0, max:67.0, avg:55.6, median:55.0, std_dev:6.344

 [1]: I7242e765426353672823fcc8277f20ac361930d7
      c53d78e9

Bug: 115893206
Test: atest ActivityManagerMultiDisplayTests
Test: atest CtsInputMethodTestCases CtsInputMethodServiceHostTestCases
Test: atest FrameworksCoreTests:android.view.inputmethod.InputMethodManagerTest
Test: No perf regression observed in Bug 117434607
Change-Id: I5c64b23c3f5cb16f7f3fb9cdc2be063083566050
parent 24222202
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