Loading core/java/android/view/inputmethod/InputMethodManager.java +6 −1 Original line number Original line Diff line number Diff line Loading @@ -946,11 +946,16 @@ public final class InputMethodManager { if (state == WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN) { if (state == WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN) { // when losing focus (e.g., by going to another window), we reset the // when losing focus (e.g., by going to another window), we reset the // requestedVisibleTypes of WindowInsetsController by hiding the IME // requestedVisibleTypes of WindowInsetsController by hiding the IME final var statsToken = ImeTracker.forLogging().onStart( ImeTracker.TYPE_HIDE, ImeTracker.ORIGIN_CLIENT, SoftInputShowHideReason.REASON_HIDE_WINDOW_LOST_FOCUS, false /* fromUser */); if (DEBUG) { if (DEBUG) { Log.d(TAG, "onWindowLostFocus, hiding IME because " Log.d(TAG, "onWindowLostFocus, hiding IME because " + "of STATE_ALWAYS_HIDDEN"); + "of STATE_ALWAYS_HIDDEN"); } } mCurRootView.getInsetsController().hide(WindowInsets.Type.ime()); mCurRootView.getInsetsController().hide(WindowInsets.Type.ime(), false /* fromIme */, statsToken); } } } } Loading core/java/com/android/internal/inputmethod/SoftInputShowHideReason.java +4 −0 Original line number Original line Diff line number Diff line Loading @@ -91,6 +91,7 @@ import java.lang.annotation.Retention; SoftInputShowHideReason.CONTROL_WINDOW_INSETS_ANIMATION, SoftInputShowHideReason.CONTROL_WINDOW_INSETS_ANIMATION, SoftInputShowHideReason.SHOW_INPUT_TARGET_CHANGED, SoftInputShowHideReason.SHOW_INPUT_TARGET_CHANGED, SoftInputShowHideReason.HIDE_INPUT_TARGET_CHANGED, SoftInputShowHideReason.HIDE_INPUT_TARGET_CHANGED, SoftInputShowHideReason.REASON_HIDE_WINDOW_LOST_FOCUS, }) }) public @interface SoftInputShowHideReason { public @interface SoftInputShowHideReason { /** Default, undefined reason. */ /** Default, undefined reason. */ Loading Loading @@ -418,4 +419,7 @@ public @interface SoftInputShowHideReason { * {@link android.view.InsetsController#controlWindowInsetsAnimation}. * {@link android.view.InsetsController#controlWindowInsetsAnimation}. */ */ int CONTROL_WINDOW_INSETS_ANIMATION = ImeProtoEnums.REASON_CONTROL_WINDOW_INSETS_ANIMATION; int CONTROL_WINDOW_INSETS_ANIMATION = ImeProtoEnums.REASON_CONTROL_WINDOW_INSETS_ANIMATION; /** Hide soft input when the window lost focus. */ int REASON_HIDE_WINDOW_LOST_FOCUS = ImeProtoEnums.REASON_HIDE_WINDOW_LOST_FOCUS; } } Loading
core/java/android/view/inputmethod/InputMethodManager.java +6 −1 Original line number Original line Diff line number Diff line Loading @@ -946,11 +946,16 @@ public final class InputMethodManager { if (state == WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN) { if (state == WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN) { // when losing focus (e.g., by going to another window), we reset the // when losing focus (e.g., by going to another window), we reset the // requestedVisibleTypes of WindowInsetsController by hiding the IME // requestedVisibleTypes of WindowInsetsController by hiding the IME final var statsToken = ImeTracker.forLogging().onStart( ImeTracker.TYPE_HIDE, ImeTracker.ORIGIN_CLIENT, SoftInputShowHideReason.REASON_HIDE_WINDOW_LOST_FOCUS, false /* fromUser */); if (DEBUG) { if (DEBUG) { Log.d(TAG, "onWindowLostFocus, hiding IME because " Log.d(TAG, "onWindowLostFocus, hiding IME because " + "of STATE_ALWAYS_HIDDEN"); + "of STATE_ALWAYS_HIDDEN"); } } mCurRootView.getInsetsController().hide(WindowInsets.Type.ime()); mCurRootView.getInsetsController().hide(WindowInsets.Type.ime(), false /* fromIme */, statsToken); } } } } Loading
core/java/com/android/internal/inputmethod/SoftInputShowHideReason.java +4 −0 Original line number Original line Diff line number Diff line Loading @@ -91,6 +91,7 @@ import java.lang.annotation.Retention; SoftInputShowHideReason.CONTROL_WINDOW_INSETS_ANIMATION, SoftInputShowHideReason.CONTROL_WINDOW_INSETS_ANIMATION, SoftInputShowHideReason.SHOW_INPUT_TARGET_CHANGED, SoftInputShowHideReason.SHOW_INPUT_TARGET_CHANGED, SoftInputShowHideReason.HIDE_INPUT_TARGET_CHANGED, SoftInputShowHideReason.HIDE_INPUT_TARGET_CHANGED, SoftInputShowHideReason.REASON_HIDE_WINDOW_LOST_FOCUS, }) }) public @interface SoftInputShowHideReason { public @interface SoftInputShowHideReason { /** Default, undefined reason. */ /** Default, undefined reason. */ Loading Loading @@ -418,4 +419,7 @@ public @interface SoftInputShowHideReason { * {@link android.view.InsetsController#controlWindowInsetsAnimation}. * {@link android.view.InsetsController#controlWindowInsetsAnimation}. */ */ int CONTROL_WINDOW_INSETS_ANIMATION = ImeProtoEnums.REASON_CONTROL_WINDOW_INSETS_ANIMATION; int CONTROL_WINDOW_INSETS_ANIMATION = ImeProtoEnums.REASON_CONTROL_WINDOW_INSETS_ANIMATION; /** Hide soft input when the window lost focus. */ int REASON_HIDE_WINDOW_LOST_FOCUS = ImeProtoEnums.REASON_HIDE_WINDOW_LOST_FOCUS; } }