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

Commit a805ccf4 authored by Cosmin Băieș's avatar Cosmin Băieș Committed by Android (Google) Code Review
Browse files

Merge "Cleanup and documentation of ImeTargetWindowState" into main

parents fb7fd439 8d5731f0
Loading
Loading
Loading
Loading
+5 −3
Original line number Original line Diff line number Diff line
@@ -1117,7 +1117,8 @@ public final class InputMethodManager {


    private boolean startInputOnWindowFocusGainInternal(@StartInputReason int startInputReason,
    private boolean startInputOnWindowFocusGainInternal(@StartInputReason int startInputReason,
            View focusedView, @StartInputFlags int startInputFlags,
            View focusedView, @StartInputFlags int startInputFlags,
            @SoftInputModeFlags int softInputMode, int windowFlags) {
            @SoftInputModeFlags int softInputMode,
            @WindowManager.LayoutParams.Flags int windowFlags) {
        synchronized (mH) {
        synchronized (mH) {
            mCurrentEditorInfo = null;
            mCurrentEditorInfo = null;
            mCompletions = null;
            mCompletions = null;
@@ -3400,7 +3401,8 @@ public final class InputMethodManager {
    @RequiresPermission(value = Manifest.permission.INTERACT_ACROSS_USERS_FULL, conditional = true)
    @RequiresPermission(value = Manifest.permission.INTERACT_ACROSS_USERS_FULL, conditional = true)
    private boolean startInputInner(@StartInputReason int startInputReason,
    private boolean startInputInner(@StartInputReason int startInputReason,
            @Nullable IBinder windowGainingFocus, @StartInputFlags int startInputFlags,
            @Nullable IBinder windowGainingFocus, @StartInputFlags int startInputFlags,
            @SoftInputModeFlags int softInputMode, int windowFlags) {
            @SoftInputModeFlags int softInputMode,
            @WindowManager.LayoutParams.Flags int windowFlags) {
        final View view;
        final View view;
        synchronized (mH) {
        synchronized (mH) {
            view = getServedViewLocked();
            view = getServedViewLocked();
@@ -3673,7 +3675,7 @@ public final class InputMethodManager {
            @StartInputFlags int startInputFlags,
            @StartInputFlags int startInputFlags,
            @StartInputReason int startInputReason,
            @StartInputReason int startInputReason,
            @SoftInputModeFlags int softInputMode,
            @SoftInputModeFlags int softInputMode,
            int windowFlags) {
            @WindowManager.LayoutParams.Flags int windowFlags) {
        return (startInputFlags & StartInputFlags.WINDOW_GAINED_FOCUS) == 0
        return (startInputFlags & StartInputFlags.WINDOW_GAINED_FOCUS) == 0
                && (startInputFlags & StartInputFlags.IS_TEXT_EDITOR) == 0
                && (startInputFlags & StartInputFlags.IS_TEXT_EDITOR) == 0
                && previousViewFocusParameters != null
                && previousViewFocusParameters != null
+4 −3
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@
package android.view.inputmethod;
package android.view.inputmethod;


import android.annotation.Nullable;
import android.annotation.Nullable;
import android.view.WindowManager;
import android.view.WindowManager.LayoutParams.SoftInputModeFlags;
import android.view.WindowManager.LayoutParams.SoftInputModeFlags;


import com.android.internal.inputmethod.StartInputFlags;
import com.android.internal.inputmethod.StartInputFlags;
@@ -34,13 +35,13 @@ final class ViewFocusParameterInfo {
    @StartInputFlags final int mPreviousStartInputFlags;
    @StartInputFlags final int mPreviousStartInputFlags;
    @StartInputReason final int mPreviousStartInputReason;
    @StartInputReason final int mPreviousStartInputReason;
    @SoftInputModeFlags final int mPreviousSoftInputMode;
    @SoftInputModeFlags final int mPreviousSoftInputMode;
    final int mPreviousWindowFlags;
    @WindowManager.LayoutParams.Flags final int mPreviousWindowFlags;


    ViewFocusParameterInfo(@Nullable EditorInfo previousEditorInfo,
    ViewFocusParameterInfo(@Nullable EditorInfo previousEditorInfo,
            @StartInputFlags int previousStartInputFlags,
            @StartInputFlags int previousStartInputFlags,
            @StartInputReason int previousStartInputReason,
            @StartInputReason int previousStartInputReason,
            @SoftInputModeFlags int previousSoftInputMode,
            @SoftInputModeFlags int previousSoftInputMode,
            int previousWindowFlags) {
            @WindowManager.LayoutParams.Flags int previousWindowFlags) {
        mPreviousEditorInfo = previousEditorInfo;
        mPreviousEditorInfo = previousEditorInfo;
        mPreviousStartInputFlags = previousStartInputFlags;
        mPreviousStartInputFlags = previousStartInputFlags;
        mPreviousStartInputReason = previousStartInputReason;
        mPreviousStartInputReason = previousStartInputReason;
@@ -52,7 +53,7 @@ final class ViewFocusParameterInfo {
            @StartInputFlags int startInputFlags,
            @StartInputFlags int startInputFlags,
            @StartInputReason int startInputReason,
            @StartInputReason int startInputReason,
            @SoftInputModeFlags int softInputMode,
            @SoftInputModeFlags int softInputMode,
            int windowFlags) {
            @WindowManager.LayoutParams.Flags int windowFlags) {
        return mPreviousStartInputFlags == startInputFlags
        return mPreviousStartInputFlags == startInputFlags
                && mPreviousStartInputReason == startInputReason
                && mPreviousStartInputReason == startInputReason
                && mPreviousSoftInputMode == softInputMode
                && mPreviousSoftInputMode == softInputMode
+8 −6
Original line number Original line Diff line number Diff line
@@ -128,8 +128,9 @@ final class IInputMethodManagerImpl extends IInputMethodManager.Stub {
        void startInputOrWindowGainedFocusAsync(
        void startInputOrWindowGainedFocusAsync(
                @StartInputReason int startInputReason, IInputMethodClient client,
                @StartInputReason int startInputReason, IInputMethodClient client,
                IBinder windowToken, @StartInputFlags int startInputFlags,
                IBinder windowToken, @StartInputFlags int startInputFlags,
                @WindowManager.LayoutParams.SoftInputModeFlags int softInputMode, int windowFlags,
                @WindowManager.LayoutParams.SoftInputModeFlags int softInputMode,
                @Nullable EditorInfo editorInfo, IRemoteInputConnection inputConnection,
                @WindowManager.LayoutParams.Flags int windowFlags, @Nullable EditorInfo editorInfo,
                IRemoteInputConnection inputConnection,
                IRemoteAccessibilityInputConnection remoteAccessibilityInputConnection,
                IRemoteAccessibilityInputConnection remoteAccessibilityInputConnection,
                int unverifiedTargetSdkVersion, @UserIdInt int userId,
                int unverifiedTargetSdkVersion, @UserIdInt int userId,
                @NonNull ImeOnBackInvokedDispatcher imeDispatcher, boolean imeRequestedVisible,
                @NonNull ImeOnBackInvokedDispatcher imeDispatcher, boolean imeRequestedVisible,
@@ -138,8 +139,9 @@ final class IInputMethodManagerImpl extends IInputMethodManager.Stub {
        InputBindResult startInputOrWindowGainedFocus(
        InputBindResult startInputOrWindowGainedFocus(
                @StartInputReason int startInputReason, IInputMethodClient client,
                @StartInputReason int startInputReason, IInputMethodClient client,
                IBinder windowToken, @StartInputFlags int startInputFlags,
                IBinder windowToken, @StartInputFlags int startInputFlags,
                @WindowManager.LayoutParams.SoftInputModeFlags int softInputMode, int windowFlags,
                @WindowManager.LayoutParams.SoftInputModeFlags int softInputMode,
                @Nullable EditorInfo editorInfo, IRemoteInputConnection inputConnection,
                @WindowManager.LayoutParams.Flags int windowFlags, @Nullable EditorInfo editorInfo,
                IRemoteInputConnection inputConnection,
                IRemoteAccessibilityInputConnection remoteAccessibilityInputConnection,
                IRemoteAccessibilityInputConnection remoteAccessibilityInputConnection,
                int unverifiedTargetSdkVersion, @UserIdInt int userId,
                int unverifiedTargetSdkVersion, @UserIdInt int userId,
                @NonNull ImeOnBackInvokedDispatcher imeDispatcher, boolean imeRequestedVisible);
                @NonNull ImeOnBackInvokedDispatcher imeDispatcher, boolean imeRequestedVisible);
@@ -320,7 +322,7 @@ final class IInputMethodManagerImpl extends IInputMethodManager.Stub {
            @StartInputReason int startInputReason, IInputMethodClient client, IBinder windowToken,
            @StartInputReason int startInputReason, IInputMethodClient client, IBinder windowToken,
            @StartInputFlags int startInputFlags,
            @StartInputFlags int startInputFlags,
            @WindowManager.LayoutParams.SoftInputModeFlags int softInputMode,
            @WindowManager.LayoutParams.SoftInputModeFlags int softInputMode,
            int windowFlags, @Nullable EditorInfo editorInfo,
            @WindowManager.LayoutParams.Flags int windowFlags, @Nullable EditorInfo editorInfo,
            IRemoteInputConnection inputConnection,
            IRemoteInputConnection inputConnection,
            IRemoteAccessibilityInputConnection remoteAccessibilityInputConnection,
            IRemoteAccessibilityInputConnection remoteAccessibilityInputConnection,
            int unverifiedTargetSdkVersion, @UserIdInt int userId,
            int unverifiedTargetSdkVersion, @UserIdInt int userId,
@@ -336,7 +338,7 @@ final class IInputMethodManagerImpl extends IInputMethodManager.Stub {
            IInputMethodClient client, IBinder windowToken,
            IInputMethodClient client, IBinder windowToken,
            @StartInputFlags int startInputFlags,
            @StartInputFlags int startInputFlags,
            @WindowManager.LayoutParams.SoftInputModeFlags int softInputMode,
            @WindowManager.LayoutParams.SoftInputModeFlags int softInputMode,
            int windowFlags, @Nullable EditorInfo editorInfo,
            @WindowManager.LayoutParams.Flags int windowFlags, @Nullable EditorInfo editorInfo,
            IRemoteInputConnection inputConnection,
            IRemoteInputConnection inputConnection,
            IRemoteAccessibilityInputConnection remoteAccessibilityInputConnection,
            IRemoteAccessibilityInputConnection remoteAccessibilityInputConnection,
            int unverifiedTargetSdkVersion, @UserIdInt int userId,
            int unverifiedTargetSdkVersion, @UserIdInt int userId,
+3 −3
Original line number Original line Diff line number Diff line
@@ -43,9 +43,9 @@ final class ImeBindingState {
    final int mUserId;
    final int mUserId;


    /**
    /**
     * The last window token that we confirmed to be focused. This is always updated upon reports
     * The token of the last window that we confirmed to be focused. This is always updated upon
     * from the input method client. If the window state is already changed before the report is
     * reports from the input method client. If the window state is already changed before the
     * handled, this field just keeps the last value.
     * report is handled, this field just keeps the last value.
     */
     */
    @Nullable
    @Nullable
    final IBinder mFocusedWindow;
    final IBinder mFocusedWindow;
+97 −72
Original line number Original line Diff line number Diff line
@@ -87,7 +87,7 @@ public final class ImeVisibilityStateComputer {


    /**
    /**
     * A map used to track the requested IME target window and its state. The key represents the
     * A map used to track the requested IME target window and its state. The key represents the
     * token of the window and the value is the corresponding IME window state.
     * token of the window and the value is the corresponding IME target window state.
     */
     */
    @GuardedBy("ImfLock.class")
    @GuardedBy("ImfLock.class")
    private final WeakHashMap<IBinder, ImeTargetWindowState> mRequestWindowStateMap =
    private final WeakHashMap<IBinder, ImeTargetWindowState> mRequestWindowStateMap =
@@ -134,9 +134,9 @@ public final class ImeVisibilityStateComputer {
    private IBinder mCurVisibleImeInputTarget;
    private IBinder mCurVisibleImeInputTarget;


    /**
    /**
     * The last window token that we confirmed that IME started talking to.  This is always updated
     * The token of the last window that we confirmed that IME started talking to. This is always
     * upon reports from the input method.  If the window state is already changed before the report
     * updated upon reports from the input method. If the window state is already changed before
     * is handled, this field just keeps the last value.
     * the report is handled, this field just keeps the last value.
     */
     */
    @GuardedBy("ImfLock.class")
    @GuardedBy("ImfLock.class")
    @Nullable
    @Nullable
@@ -393,26 +393,28 @@ public final class ImeVisibilityStateComputer {
    ImeTargetWindowState getOrCreateWindowState(IBinder windowToken) {
    ImeTargetWindowState getOrCreateWindowState(IBinder windowToken) {
        ImeTargetWindowState state = mRequestWindowStateMap.get(windowToken);
        ImeTargetWindowState state = mRequestWindowStateMap.get(windowToken);
        if (state == null) {
        if (state == null) {
            state = new ImeTargetWindowState(SOFT_INPUT_STATE_UNSPECIFIED, 0, false, false, false);
            state = new ImeTargetWindowState(SOFT_INPUT_STATE_UNSPECIFIED, 0 /* windowFlags */,
                    false /* imeFocusChanged */, false /* hasFocusedEditor */,
                    false /* isStartInputByWindowGainFocus */, TOOL_TYPE_UNKNOWN);
        }
        }
        return state;
        return state;
    }
    }


    @GuardedBy("ImfLock.class")
    @GuardedBy("ImfLock.class")
    ImeTargetWindowState getWindowStateOrNull(IBinder windowToken) {
    @Nullable
        ImeTargetWindowState state = mRequestWindowStateMap.get(windowToken);
    ImeTargetWindowState getWindowStateOrNull(@Nullable IBinder windowToken) {
        return state;
        return mRequestWindowStateMap.get(windowToken);
    }
    }


    @GuardedBy("ImfLock.class")
    @GuardedBy("ImfLock.class")
    void setWindowState(IBinder windowToken, @NonNull ImeTargetWindowState newState) {
    void setWindowState(@NonNull IBinder windowToken, @NonNull ImeTargetWindowState newState) {
        final ImeTargetWindowState state = mRequestWindowStateMap.get(windowToken);
        final ImeTargetWindowState state = mRequestWindowStateMap.get(windowToken);
        if (state != null && newState.hasEditorFocused() && (
        if (state != null && newState.hasEditorFocused() && (
                newState.mToolType != MotionEvent.TOOL_TYPE_STYLUS
                newState.getToolType() != MotionEvent.TOOL_TYPE_STYLUS
                        || Flags.refactorInsetsController())) {
                        || Flags.refactorInsetsController())) {
            // Inherit the last requested IME visible state when the target window is still
            // Inherit the last requested IME visible state when the target window is still
            // focused with an editor.
            // focused with an editor.
            newState.setRequestedImeVisible(state.mRequestedImeVisible);
            newState.setRequestedImeVisible(state.isRequestedImeVisible());
        }
        }
        setWindowStateInner(windowToken, newState);
        setWindowStateInner(windowToken, newState);
    }
    }
@@ -442,11 +444,25 @@ public final class ImeVisibilityStateComputer {
        }
        }
    }
    }


    /**
     * Computes the IME visibility state from the given IME target window state.
     *
     * @param state               the state of the IME target window.
     * @param allowVisible        whether the soft input modes
     *                            {@link WindowManager.LayoutParams#SOFT_INPUT_STATE_VISIBLE} and
     *                            {@link WindowManager.LayoutParams#SOFT_INPUT_STATE_ALWAYS_VISIBLE}
     *                            are allowed.
     * @param imeRequestedVisible whether the IME target window has the IME insets type in the
     *                            requestedVisibleTypes (see
     *                            {@link InputMethodManager#hasViewImeRequestedVisible}).
     */
    @GuardedBy("ImfLock.class")
    @GuardedBy("ImfLock.class")
    ImeVisibilityResult computeState(ImeTargetWindowState state, boolean allowVisible,
    @Nullable
    ImeVisibilityResult computeState(@NonNull ImeTargetWindowState state, boolean allowVisible,
            boolean imeRequestedVisible) {
            boolean imeRequestedVisible) {
        // TODO: Output the request IME visibility state according to the requested window state
        // TODO: Output the request IME visibility state according to the requested window state
        final int softInputVisibility = state.mSoftInputModeState & SOFT_INPUT_MASK_STATE;
        final var softInputMode = state.getSoftInputModeState();
        final int softInputVisibility = softInputMode & SOFT_INPUT_MASK_STATE;
        // Should we auto-show the IME even if the caller has not
        // Should we auto-show the IME even if the caller has not
        // specified what should be done with it?
        // specified what should be done with it?
        // We only do this automatically if the window can resize
        // We only do this automatically if the window can resize
@@ -455,12 +471,12 @@ public final class ImeVisibilityStateComputer {
        // by the IME) or if running on a large screen where there
        // by the IME) or if running on a large screen where there
        // is more room for the target window + IME.
        // is more room for the target window + IME.
        final boolean doAutoShow =
        final boolean doAutoShow =
                (state.mSoftInputModeState & WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST)
                (softInputMode & WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST)
                        == WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE
                        == WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE
                        || mService.mRes.getConfiguration().isLayoutSizeAtLeast(
                        || mService.mRes.getConfiguration().isLayoutSizeAtLeast(
                        Configuration.SCREENLAYOUT_SIZE_LARGE);
                        Configuration.SCREENLAYOUT_SIZE_LARGE);
        final boolean isForwardNavigation = (state.mSoftInputModeState
        final boolean isForwardNavigation =
                & WindowManager.LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION) != 0;
                (softInputMode & WindowManager.LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION) != 0;


        // We shows the IME when the system allows the IME focused target window to restore the
        // We shows the IME when the system allows the IME focused target window to restore the
        // IME visibility (e.g. switching to the app task when last time the IME is visible).
        // IME visibility (e.g. switching to the app task when last time the IME is visible).
@@ -508,7 +524,7 @@ public final class ImeVisibilityStateComputer {
                // Do nothing but preserving the last IME requested visibility state.
                // Do nothing but preserving the last IME requested visibility state.
                final ImeTargetWindowState lastState = getWindowStateOrNull(mLastImeTargetWindow);
                final ImeTargetWindowState lastState = getWindowStateOrNull(mLastImeTargetWindow);
                if (lastState != null) {
                if (lastState != null) {
                    state.setRequestedImeVisible(lastState.mRequestedImeVisible);
                    state.setRequestedImeVisible(lastState.isRequestedImeVisible());
                }
                }
                break;
                break;
            case WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN:
            case WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN:
@@ -570,7 +586,7 @@ public final class ImeVisibilityStateComputer {
            // to rely on this behavior to hide the IME when the editor no longer has focus
            // to rely on this behavior to hide the IME when the editor no longer has focus
            // To maintain compatibility, we are now hiding the IME when we don't have
            // To maintain compatibility, we are now hiding the IME when we don't have
            // an editor upon refocusing a window.
            // an editor upon refocusing a window.
            if (state.isStartInputByGainFocus()) {
            if (state.isStartInputByWindowGainFocus()) {
                ProtoLog.v(IME_VIS_STATE_COMPUTER_DEBUG,
                ProtoLog.v(IME_VIS_STATE_COMPUTER_DEBUG,
                        "Same window without editor will hide input");
                        "Same window without editor will hide input");
                return new ImeVisibilityResult(STATE_HIDE_IME_EXPLICIT,
                return new ImeVisibilityResult(STATE_HIDE_IME_EXPLICIT,
@@ -578,7 +594,7 @@ public final class ImeVisibilityStateComputer {
            }
            }
        }
        }
        if (!state.hasEditorFocused() && (mInputShown || (Flags.refactorInsetsController()
        if (!state.hasEditorFocused() && (mInputShown || (Flags.refactorInsetsController()
                && imeRequestedVisible)) && state.isStartInputByGainFocus()
                && imeRequestedVisible)) && state.isStartInputByWindowGainFocus()
                && mService.mInputMethodDeviceConfigs.shouldHideImeWhenNoEditorFocus()) {
                && mService.mInputMethodDeviceConfigs.shouldHideImeWhenNoEditorFocus()) {
            // Hide the soft-keyboard when the system do nothing for softInputModeState
            // Hide the soft-keyboard when the system do nothing for softInputModeState
            // of the window being gained focus without an editor. This behavior benefits
            // of the window being gained focus without an editor. This behavior benefits
@@ -760,56 +776,59 @@ public final class ImeVisibilityStateComputer {
    }
    }


    /**
    /**
     * A class that represents the current state of the IME target window.
     * State information about an IME target window (i.e. a window for which we started an
     * input connection). One of the IME target windows is set as the current
     * {@link com.android.server.wm.DisplayContent#mImeInputTarget}.
     */
     */
    static class ImeTargetWindowState {
    static class ImeTargetWindowState {


        ImeTargetWindowState(@SoftInputModeFlags int softInputModeState, int windowFlags,
        ImeTargetWindowState(@SoftInputModeFlags int softInputModeState,
                boolean imeFocusChanged, boolean hasFocusedEditor,
                @WindowManager.LayoutParams.Flags int windowFlags, boolean imeFocusChanged,
                boolean isStartInputByGainFocus) {
                boolean hasFocusedEditor, boolean isStartInputByWindowGainFocus,
            this(softInputModeState, windowFlags, imeFocusChanged, hasFocusedEditor,
                @MotionEvent.ToolType int toolType) {
                    isStartInputByGainFocus, TOOL_TYPE_UNKNOWN);
        }

        ImeTargetWindowState(@SoftInputModeFlags int softInputModeState, int windowFlags,
                boolean imeFocusChanged, boolean hasFocusedEditor,
                boolean isStartInputByGainFocus, @MotionEvent.ToolType int toolType) {
            mSoftInputModeState = softInputModeState;
            mSoftInputModeState = softInputModeState;
            mWindowFlags = windowFlags;
            mWindowFlags = windowFlags;
            mImeFocusChanged = imeFocusChanged;
            mImeFocusChanged = imeFocusChanged;
            mHasFocusedEditor = hasFocusedEditor;
            mHasFocusedEditor = hasFocusedEditor;
            mIsStartInputByGainFocus = isStartInputByGainFocus;
            mIsStartInputByWindowGainFocus = isStartInputByWindowGainFocus;
            mToolType = toolType;
            mToolType = toolType;
        }
        }


        /**
        /** {@link WindowManager.LayoutParams#softInputMode} of the IME target window. */
         * Visibility state for this window. By default no state has been specified.
        @SoftInputModeFlags
         */
        private final int mSoftInputModeState;
        private final @SoftInputModeFlags int mSoftInputModeState;


        /** Window flags of the IME target window. */
        @WindowManager.LayoutParams.Flags
        private final int mWindowFlags;
        private final int mWindowFlags;


        /**
        /** Whether the IME focus changed from the previous window. */
         * {@link MotionEvent#getToolType(int)} that was used to click editor.
         */
        private final int mToolType;

        /**
         * {@code true} means the IME focus changed from the previous window, {@code false}
         * otherwise.
         */
        private final boolean mImeFocusChanged;
        private final boolean mImeFocusChanged;


        /**
        /**
         * {@code true} when the window has focused an editor, {@code false} otherwise.
         * Whether the window has a focused view that is a text editor.
         *
         * @see android.view.View#onCheckIsTextEditor
         */
         */
        private final boolean mHasFocusedEditor;
        private final boolean mHasFocusedEditor;


        private final boolean mIsStartInputByGainFocus;
        /**
         * Whether this became the IME target (started an input connection) due to the window
         * gaining input focus.
         *
         * @see com.android.internal.inputmethod.StartInputFlags#WINDOW_GAINED_FOCUS
         */
        private final boolean mIsStartInputByWindowGainFocus;


        /**
        /**
         * Set if the client has asked for the input method to be shown.
         * The type of tool that was used to click editor.
         *
         * @see MotionEvent#getToolType
         */
         */
        @MotionEvent.ToolType
        private final int mToolType;

        /** Whether the client of the window requested the IME to be visible. */
        @GuardedBy("ImfLock.class")
        @GuardedBy("ImfLock.class")
        private boolean mRequestedImeVisible;
        private boolean mRequestedImeVisible;


@@ -827,45 +846,38 @@ public final class ImeVisibilityStateComputer {
        private int mImeDisplayId = DEFAULT_DISPLAY;
        private int mImeDisplayId = DEFAULT_DISPLAY;


        @AnyThread
        @AnyThread
        boolean hasImeFocusChanged() {
        @SoftInputModeFlags
            return mImeFocusChanged;
        int getSoftInputModeState() {
            return mSoftInputModeState;
        }
        }


        @AnyThread
        @AnyThread
        boolean hasEditorFocused() {
        @WindowManager.LayoutParams.Flags
            return mHasFocusedEditor;
        int getWindowFlags() {
            return mWindowFlags;
        }
        }


        @AnyThread
        @AnyThread
        boolean isStartInputByGainFocus() {
        boolean hasImeFocusChanged() {
            return mIsStartInputByGainFocus;
            return mImeFocusChanged;
        }
        }


        @AnyThread
        @AnyThread
        int getSoftInputModeState() {
        boolean hasEditorFocused() {
            return mSoftInputModeState;
            return mHasFocusedEditor;
        }
        }


        @AnyThread
        @AnyThread
        int getWindowFlags() {
        boolean isStartInputByWindowGainFocus() {
            return mWindowFlags;
            return mIsStartInputByWindowGainFocus;
        }
        }


        @AnyThread
        @AnyThread
        @MotionEvent.ToolType
        int getToolType() {
        int getToolType() {
            return mToolType;
            return mToolType;
        }
        }


        @GuardedBy("ImfLock.class")
        private void setImeDisplayId(int imeDisplayId) {
            mImeDisplayId = imeDisplayId;
        }

        @GuardedBy("ImfLock.class")
        int getImeDisplayId() {
            return mImeDisplayId;
        }

        @GuardedBy("ImfLock.class")
        @GuardedBy("ImfLock.class")
        private void setRequestedImeVisible(boolean requestedImeVisible) {
        private void setRequestedImeVisible(boolean requestedImeVisible) {
            mRequestedImeVisible = requestedImeVisible;
            mRequestedImeVisible = requestedImeVisible;
@@ -877,7 +889,7 @@ public final class ImeVisibilityStateComputer {
        }
        }


        @GuardedBy("ImfLock.class")
        @GuardedBy("ImfLock.class")
        void setRequestImeToken(IBinder token) {
        void setRequestImeToken(@NonNull IBinder token) {
            mRequestImeToken = token;
            mRequestImeToken = token;
        }
        }


@@ -886,15 +898,28 @@ public final class ImeVisibilityStateComputer {
            return mRequestImeToken;
            return mRequestImeToken;
        }
        }


        @GuardedBy("ImfLock.class")
        private void setImeDisplayId(int imeDisplayId) {
            mImeDisplayId = imeDisplayId;
        }

        @GuardedBy("ImfLock.class")
        int getImeDisplayId() {
            return mImeDisplayId;
        }

        @Override
        @Override
        public String toString() {
        public String toString() {
            return "ImeTargetWindowState{ imeToken " + mRequestImeToken
            return "ImeTargetWindowState{"
                    + " softInputModeState " + softInputModeToString(mSoftInputModeState)
                    + " windowFlags: " + Integer.toHexString(mWindowFlags)
                    + " imeFocusChanged " + mImeFocusChanged
                    + " imeFocusChanged " + mImeFocusChanged
                    + " hasEditorFocused " + mHasFocusedEditor
                    + " hasFocusedEditor " + mHasFocusedEditor
                    + " isStartInputByWindowGainFocus " + mIsStartInputByWindowGainFocus
                    + " toolType: " + mToolType
                    + " requestedImeVisible " + mRequestedImeVisible
                    + " requestedImeVisible " + mRequestedImeVisible
                    + " requestImeToken " + mRequestImeToken
                    + " imeDisplayId " + mImeDisplayId
                    + " imeDisplayId " + mImeDisplayId
                    + " softInputModeState " + softInputModeToString(mSoftInputModeState)
                    + " isStartInputByGainFocus " + mIsStartInputByGainFocus
                    + "}";
                    + "}";
        }
        }
    }
    }
Loading