Merge "Fix toggleSoftInput can't hide IME when the app in multi-window mode" into tm-qpr-dev am: a9fa413a21

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19600536

Change-Id: Ied238b5980f4609b5a0a9b77301f691a6dd0637d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Ming-Shin Lu
2022-08-19 16:14:11 +00:00
committed by Automerger Merge Worker

View File

@@ -89,6 +89,7 @@ import android.view.InputEventSender;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewRootImpl;
import android.view.WindowInsets;
import android.view.WindowManager.LayoutParams.SoftInputModeFlags;
import android.view.autofill.AutofillManager;
import android.window.ImeOnBackInvokedDispatcher;
@@ -2122,8 +2123,9 @@ public final class InputMethodManager {
null /* icProto */);
synchronized (mH) {
final View view = getServedViewLocked();
if (mImeInsetsConsumer != null && view != null) {
if (mImeInsetsConsumer.isRequestedVisible()) {
if (view != null) {
final WindowInsets rootInsets = view.getRootWindowInsets();
if (rootInsets != null && rootInsets.isVisible(WindowInsets.Type.ime())) {
hideSoftInputFromWindow(view.getWindowToken(), hideFlags, null,
SoftInputShowHideReason.HIDE_TOGGLE_SOFT_INPUT);
} else {