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

Commit 4d4fc565 authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Add HIDE_CLOSE_CURRENT_SESSION

Currently an IME hide request is issued upon IMM#closeCurrentInput().

This CL makes it possible for us to distinguish such requests from
ones from IMM#hideSoftInputFromWindow().

Fix: 296430072
Test: presubmit
Change-Id: I0ed70a13224ee478983b982eaaceaf803a11c16e
parent 6162ea96
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -3019,9 +3019,10 @@ public final class InputMethodManager {
    void closeCurrentInput() {
        final ImeTracker.Token statsToken = ImeTracker.forLogging().onRequestHide(
                null /* component */, Process.myUid(), ImeTracker.ORIGIN_CLIENT_HIDE_SOFT_INPUT,
                SoftInputShowHideReason.HIDE_SOFT_INPUT);
                SoftInputShowHideReason.HIDE_CLOSE_CURRENT_SESSION);
        ImeTracker.forLatency().onRequestHide(statsToken, ImeTracker.ORIGIN_CLIENT_HIDE_SOFT_INPUT,
                SoftInputShowHideReason.HIDE_SOFT_INPUT, ActivityThread::currentApplication);
                SoftInputShowHideReason.HIDE_CLOSE_CURRENT_SESSION,
                ActivityThread::currentApplication);

        synchronized (mH) {
            if (mCurRootView == null || mCurRootView.getView() == null) {
@@ -3040,7 +3041,7 @@ public final class InputMethodManager {
                    statsToken,
                    HIDE_NOT_ALWAYS,
                    null,
                    SoftInputShowHideReason.HIDE_SOFT_INPUT);
                    SoftInputShowHideReason.HIDE_CLOSE_CURRENT_SESSION);
        }
    }

+2 −0
Original line number Diff line number Diff line
@@ -261,6 +261,8 @@ public final class InputMethodDebug {
                return "REMOVE_IME_SCREENSHOT_FROM_IMMS";
            case SoftInputShowHideReason.HIDE_WHEN_INPUT_TARGET_INVISIBLE:
                return "HIDE_WHEN_INPUT_TARGET_INVISIBLE";
            case SoftInputShowHideReason.HIDE_CLOSE_CURRENT_SESSION:
                return "HIDE_SOFT_INPUT_CLOSE_CURRENT_SESSION";
            default:
                return "Unknown=" + reason;
        }
+6 −0
Original line number Diff line number Diff line
@@ -69,6 +69,7 @@ import java.lang.annotation.Retention;
        SoftInputShowHideReason.SHOW_IME_SCREENSHOT_FROM_IMMS,
        SoftInputShowHideReason.REMOVE_IME_SCREENSHOT_FROM_IMMS,
        SoftInputShowHideReason.HIDE_WHEN_INPUT_TARGET_INVISIBLE,
        SoftInputShowHideReason.HIDE_CLOSE_CURRENT_SESSION,
})
public @interface SoftInputShowHideReason {
    /** Show soft input by {@link android.view.inputmethod.InputMethodManager#showSoftInput}. */
@@ -278,4 +279,9 @@ public @interface SoftInputShowHideReason {
     * focusable overlay window.
     */
    int HIDE_WHEN_INPUT_TARGET_INVISIBLE = ImeProtoEnums.REASON_HIDE_WHEN_INPUT_TARGET_INVISIBLE;

    /**
     * Hide soft input when {@link InputMethodManager#closeCurrentInput()} gets called.
     */
    int HIDE_CLOSE_CURRENT_SESSION = ImeProtoEnums.REASON_HIDE_CLOSE_CURRENT_SESSION;
}