From b575e09f0cdffbbc17a8697c70d01d0c0244f3b7 Mon Sep 17 00:00:00 2001 From: Ming-Shin Lu Date: Thu, 18 Feb 2021 15:42:50 +0800 Subject: Hide Keyboard when the remote input view became invisible To make hide IME with animation gracefully when collapsing the remote input view with pressing the home key. Fix: 179806766 Test: manual as below steps: 1) Make and install EditTextVariations 2) Launch EditTextVariations, select "Direct Reply" from menu to create remote input. 3) Tapping the remote input view from the notification shade to show keyboard. 4) Pressing home key to collapse the notification shade, verify if keyboard hides with animating. Change-Id: I4cd0b9fc729df952f30400d5138f73d9ad74b577 --- .../src/com/android/systemui/statusbar/policy/RemoteInputView.java | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'packages/SystemUI/src') diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java index 8e833c05b447..320b00af0fc5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java @@ -561,6 +561,11 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene super.onVisibilityChanged(changedView, visibility); if (changedView == this && mOnVisibilityChangedListener != null) { mOnVisibilityChangedListener.accept(visibility == VISIBLE); + // 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()) { + mEditText.hideIme(); + } } } -- cgit v1.2.3-59-g8ed1b