Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 528fdf29 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Passing Ime statsToken from InputMethodManager to InsetsController" into main

parents e196412f f23c3bfe
Loading
Loading
Loading
Loading
+6 −1
Original line number Original line Diff line number Diff line
@@ -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);
                        }
                        }
                    }
                    }


+4 −0
Original line number Original line Diff line number Diff line
@@ -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. */
@@ -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;
}
}