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

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

Merge "Only apply IME insets to the floating window that has focus" into main

parents 1c0f9aa6 0dab5e84
Loading
Loading
Loading
Loading
+10 −8
Original line number Diff line number Diff line
@@ -258,16 +258,13 @@ class InsetsPolicy {
     * We also need to exclude certain types of insets source for client within specific windowing
     * modes.
     *
     * @param attrs the LayoutParams of the target
     * @param windowingMode the windowing mode of the target
     * @param isAlwaysOnTop is the target always on top
     * @param target the target on which the policy is applied
     * @param state the input inset state containing all the sources
     * @return The state stripped of the necessary information.
     */
    InsetsState enforceInsetsPolicyForTarget(WindowManager.LayoutParams attrs,
            @WindowConfiguration.WindowingMode int windowingMode, boolean isAlwaysOnTop,
            InsetsState state) {
    InsetsState enforceInsetsPolicyForTarget(WindowState target, InsetsState state) {
        final InsetsState originalState = state;
        final WindowManager.LayoutParams attrs = target.getAttrs();

        // The caller should not receive the visible insets provided by itself.
        if (attrs.type == TYPE_INPUT_METHOD) {
@@ -316,13 +313,18 @@ class InsetsPolicy {
            }
        }

        final @WindowConfiguration.WindowingMode int windowingMode = target.getWindowingMode();
        if (WindowConfiguration.isFloating(windowingMode)
                || (windowingMode == WINDOWING_MODE_MULTI_WINDOW && isAlwaysOnTop)) {
                || (windowingMode == WINDOWING_MODE_MULTI_WINDOW && target.isAlwaysOnTop())) {
            // Keep frames, caption, and IME.
            int types = WindowInsets.Type.captionBar();
            if (windowingMode != WINDOWING_MODE_PINNED) {
                if (!Flags.refactorInsetsController() || (mDisplayContent != null
                        && target == mDisplayContent.getImeInputTarget()
                        && (WindowInsets.Type.ime() & target.getRequestedVisibleTypes()) != 0)) {
                    types |= WindowInsets.Type.ime();
                }
            }
            final InsetsState newState = new InsetsState();
            newState.set(state, types);
            state = newState;
+2 −2
Original line number Diff line number Diff line
@@ -1631,8 +1631,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        }
        final InsetsState rawInsetsState =
                mFrozenInsetsState != null ? mFrozenInsetsState : getMergedInsetsState();
        final InsetsState insetsStateForWindow = insetsPolicy.enforceInsetsPolicyForTarget(
                mAttrs, getWindowingMode(), isAlwaysOnTop(), rawInsetsState);
        final InsetsState insetsStateForWindow = insetsPolicy.enforceInsetsPolicyForTarget(this,
                rawInsetsState);
        return insetsPolicy.adjustInsetsForWindow(this, insetsStateForWindow,
                includeTransient);
    }