OSDN Git Service

Make IMM more robust for window focus stealing
authorYohei Yukawa <yukawa@google.com>
Fri, 15 Dec 2017 23:47:33 +0000 (15:47 -0800)
committerYohei Yukawa <yukawa@google.com>
Fri, 15 Dec 2017 23:47:33 +0000 (15:47 -0800)
commit2553e48886958039f038d4d10cfb0f7f22b3eb5b
tree00772e86fe5d8457d659c2277fea416ec40ea3ca
parent14b1f3ede6e40606733156c431792b390cac5d17
Make IMM more robust for window focus stealing

This CL is a generalized version of my previous CL [1], which addresed
Bug 31056744 where InputMethodManager (IMM) fails to recover from
failure mode when IMMS#startInputOrWindowGainedFocus() failes because
the app's window is no longer eligible to be the IME target.

This CL finally addressed one TODO in that CL. InputBindResult now has
the error code, which allows us to force restart input upon the next
window-focus-in event.  This should make IMM much more robust for
that kind of failure modes.  For instance, Bug 70629102 is fixed as
demonstrated in a newly added CTS test case [2].  Hopefully this may
also fix Bug 31056744, which we still do not know how to reproduce.

 [1]: I60adb38013b063918b074c7b947649eada77b2c8
      8e9214b4bd7e6a9d944ad1527199226e575a7530
 [2]: I4ea24c87cbbd05e4e68ad7dfafb774c8520188e2

Bug: 31056744
Fixes: 70629102
Test: Added a test case for Bug 70629102
      atest CtsInputMethodTestCases
Test: Manually made sure that Bug 28281870 is still fixed:
      1. Open app that has EditText.
      2. Start Input.
      3. Long press the task switch button to start multi-window mode.
      4. Tap the EditText that is used in step 2.
      5. Make sure that the IME still works as expected
Test: atest CtsViewTestCates
Change-Id: I7572d4b9d678f3669ca54d55718877b145015777
core/java/android/view/inputmethod/InputMethodManager.java
core/java/com/android/internal/view/IInputMethodManager.aidl
core/java/com/android/internal/view/InputBindResult.java
services/core/java/com/android/server/InputMethodManagerService.java