From 2260ce4dafdd1fdaf8cbaf7579119ed7ecded088 Mon Sep 17 00:00:00 2001 From: Adrian Roos Date: Thu, 2 Jul 2020 18:57:22 +0200 Subject: Fix IME flicker: move hiding the surface into the control target Fixes a flicker that occurs during transitions between windows. This happens for two reasons: 1.) Control is immediately transferred to the new window, and the previous window didn't get a chance to play the animation. This is addressed by adding logic to keep control on the exiting window for the duration of the transition - similar to what we do with the target for z-ordering purposes. 2.) Upon the input connection being severed, the InputMethodService immediately hides its window, preventing any animations whenever the input connection changes This is addressed by moving hiding of the surface into the controlling windows - where upon receiving control, we now trigger removal of the IME surface if we don't show it. Additionally: - Now ensures that any requests from the ImeInsetsSourceConsumer ensure that they come from the window that is currently served by IMM. - Removes the transparancy clause from isImeTargetFromDisplayContentAndImeSame to match the updated IME target computation in DisplayContent in [1]. [1]: Iedd5f7407926167f4891ce9b7e9a79e22751e668 Fixes: 153145997 Fixes: 150902448 Test: atest WindowInsetsAnimationControllerTests Test: atest DisplayContentTests InsetsSourceConsumerTest Test: Open app with IME, press HOME button, verify IME smoothly animates away Test: Open Messages, open a thread, open IME. Click search icon, verify IME opens in the search activity Change-Id: I4910c2a06cc67b0470477b245fc1de54b75f10f9 --- core/java/android/inputmethodservice/InputMethodService.java | 3 --- 1 file changed, 3 deletions(-) (limited to 'core/java/android/inputmethodservice/InputMethodService.java') diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java index 5647bf90d2fb..c5a11abe1136 100644 --- a/core/java/android/inputmethodservice/InputMethodService.java +++ b/core/java/android/inputmethodservice/InputMethodService.java @@ -605,9 +605,6 @@ public class InputMethodService extends AbstractInputMethodService { if (DEBUG) Log.v(TAG, "unbindInput(): binding=" + mInputBinding + " ic=" + mInputConnection); // Unbind input is per process per display. - // TODO(b/150902448): free-up IME surface when target is changing. - // e.g. DisplayContent#setInputMethodTarget() - removeImeSurface(); onUnbindInput(); mInputBinding = null; mInputConnection = null; -- cgit v1.2.3