Merge "Fix Keyboard not hiding when dismissing remote input from shade"

This commit is contained in:
TreeHugger Robot
2022-01-20 18:57:26 +00:00
committed by Android (Google) Code Review

View File

@@ -51,6 +51,7 @@ import android.view.ViewAnimationUtils;
import android.view.ViewGroup;
import android.view.WindowInsets;
import android.view.WindowInsetsAnimation;
import android.view.WindowInsetsController;
import android.view.accessibility.AccessibilityEvent;
import android.view.inputmethod.CompletionInfo;
import android.view.inputmethod.EditorInfo;
@@ -665,8 +666,7 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
}
// Hide soft-keyboard when the input view became invisible
// (i.e. The notification shade collapsed by pressing the home key)
if (visibility != VISIBLE && !mEditText.isVisibleToUser()
&& !mController.isRemoteInputActive()) {
if (visibility != VISIBLE && !mController.isRemoteInputActive()) {
mEditText.hideIme();
}
}
@@ -779,8 +779,9 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
}
private void hideIme() {
if (mInputMethodManager != null) {
mInputMethodManager.hideSoftInputFromWindow(getWindowToken(), 0);
final WindowInsetsController insetsController = getWindowInsetsController();
if (insetsController != null) {
insetsController.hide(WindowInsets.Type.ime());
}
}