From e68d6f53ce120c433d7b3741c16f06695751dadc Mon Sep 17 00:00:00 2001 From: Taran Singh Date: Mon, 16 Mar 2020 11:53:05 -0700 Subject: Handle IME hide internal state correctly. IME process is notified after client has hidden the IME. At this point IME should call doHideWindow() so internal lifecycle methods are called the way they were called earlier. Also, with insets we don't hide the decorView of IME window till client is unbound, so to be consistent with previous behavior, call windowVisibilityChanged(View.GONE) explicitly. Fix: 151125925 Test: atest KeyboardVisibilityTest InputMethodServiceTest Change-Id: Ibe9a02b93489370b6ae9b497993e366f88791a62 --- core/java/android/inputmethodservice/InputMethodService.java | 7 ++++--- 1 file changed, 4 insertions(+), 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 7e4d68d9925e..2cafcdb9f4aa 100644 --- a/core/java/android/inputmethodservice/InputMethodService.java +++ b/core/java/android/inputmethodservice/InputMethodService.java @@ -878,8 +878,7 @@ public class InputMethodService extends AbstractInputMethodService { } private void notifyImeHidden() { - setImeWindowStatus(IME_ACTIVE | IME_INVISIBLE, mBackDisposition); - onPreRenderedWindowVisibilityChanged(false /* setVisible */); + doHideWindow(); } private void removeImeSurface() { @@ -2284,7 +2283,9 @@ public class InputMethodService extends AbstractInputMethodService { if (mDecorViewVisible) { // When insets API is enabled, it is responsible for client and server side // visibility of IME window. - if (!isVisibilityAppliedUsingInsetsConsumer()) { + if (isVisibilityAppliedUsingInsetsConsumer()) { + mInputView.dispatchWindowVisibilityChanged(View.GONE); + } else { mWindow.hide(); } mDecorViewVisible = false; -- cgit v1.2.3