diff options
| author | 2022-06-23 09:43:21 +0000 | |
|---|---|---|
| committer | 2022-06-23 15:01:14 +0000 | |
| commit | d037a1d895486c50815096807ba2cf2f921947ff (patch) | |
| tree | 28f46105e5722bf419db03e6ce8e84d4287fec90 | |
| parent | 91136787f617838c94577390a1704e91a9dd8d3c (diff) | |
Fix IME picker dialog being dismissed by the app overlay
In CL[1] we introduced InputMethodManagerInternal#onImeParentChanged
for WM to callback the IME surface parent change event as the signal
to make the decision if the IME picker dialog should dismiss.
In mostly, the IME surface parent could happen when the IME input
target changed. However, it could also possible when the app overlay
window specified NOT_FOCUSABLE | ALT_FOCUSABLE_IM without starting
the input, so if the overlay window has changed its visibility while
taping the picker icon in the meantime, it will cause IME picker
dialog mistakenly dismissed.
Add a check in onImeParentChanged callback to only dismiss the picker
dialog when the IME surface parent is changed by the input target
changed.
[1]: Ib0813e2c12909ede4e582eb3499599e3cc253490
Fix: 236101545
Test: manual as steps:
0) install and run "Panels - SideBar" 3rd-party app
0-1) install another 3rd-party IME app (e.g. SwiftKey)
1) launch a app with showing the keyboard (e.g. Messaging app)
2) tapping the IME picker icon from navigation bar
3) selecting IME apps from the picker dialog
4) repeat step 2-3 several times, expect the picker dialog
should not be dismissed.
Test: atest InputMethodPickerTest InputMethodManagerTest
Change-Id: I56fe9735f48c92c4291700d8e2ff0111b909df80
| -rw-r--r-- | services/core/java/com/android/server/inputmethod/InputMethodManagerService.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java index 1a1c265f568d..9d15ed33797f 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java @@ -5754,10 +5754,12 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub @Override public void onImeParentChanged() { synchronized (ImfLock.class) { - // Hide the IME method menu when the IME surface parent will change in - // case seeing the dialog dismiss flickering during the next focused window - // starting the input connection. - mMenuController.hideInputMethodMenu(); + // Hide the IME method menu only when the IME surface parent is changed by the + // input target changed, in case seeing the dialog dismiss flickering during + // the next focused window starting the input connection. + if (mLastImeTargetWindow != mCurFocusedWindow) { + mMenuController.hideInputMethodMenu(); + } } } |