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
This commit is contained in:
Taran Singh
2020-03-16 11:53:05 -07:00
parent e88d949e0a
commit e68d6f53ce

View File

@@ -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;