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

Commit 84b30d2c authored by GyeHun Jeon's avatar GyeHun Jeon Committed by Vishnu Nair
Browse files

[wm] Adjust freeform header not to be overlapped with stable insets

freeform bounds should not be overlapped with statusBar and navigationBar.
If it is overlapped, we can't control freeform anymore. So we adjusted
freeform bounds not to be overlapped on launching and moving task.

Test: move freeform to navigationBar & launching below navigationBar
Test: atest WmTests:TaskRecordTests WmTests:TaskPositionerTests
Bug: 129521219
Change-Id: I353ba930269ec753c97d719819364436bda280cb
(cherry picked from commit 55fbe465f2b40e0f1886691488825a243a3acf79)
parent 6805b6ae
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -438,6 +438,11 @@ class TaskPositioner {

        // This is a moving or scrolling operation.
        mTask.mStack.getDimBounds(mTmpRect);
        // If a target window is covered by system bar, there is no way to move it again by touch.
        // So we exclude them from stack bounds. and then it will be shown inside stable area.
        Rect stableBounds = new Rect();
        mDisplayContent.getStableRect(stableBounds);
        mTmpRect.intersect(stableBounds);

        int nX = (int) x;
        int nY = (int) y;
+19 −1
Original line number Diff line number Diff line
@@ -2244,9 +2244,27 @@ class TaskRecord extends ConfigurationContainer {
            // by policy, make sure the window remains within parent somewhere
            final float density =
                    ((float) newParentConfig.densityDpi) / DisplayMetrics.DENSITY_DEFAULT;
            fitWithinBounds(outOverrideBounds, newParentConfig.windowConfiguration.getBounds(),
            final Rect parentBounds =
                    new Rect(newParentConfig.windowConfiguration.getBounds());
            final ActivityDisplay display = mStack.getDisplay();
            if (display != null && display.mDisplayContent != null) {
                // If a freeform window moves below system bar, there is no way to move it again
                // by touch. Because its caption is covered by system bar. So we exclude them
                // from stack bounds. and then caption will be shown inside stable area.
                final Rect stableBounds = new Rect();
                display.mDisplayContent.getStableRect(stableBounds);
                parentBounds.intersect(stableBounds);
            }

            fitWithinBounds(outOverrideBounds, parentBounds,
                    (int) (density * WindowState.MINIMUM_VISIBLE_WIDTH_IN_DP),
                    (int) (density * WindowState.MINIMUM_VISIBLE_HEIGHT_IN_DP));

            // Prevent to overlap caption with stable insets.
            final int offsetTop = parentBounds.top - outOverrideBounds.top;
            if (offsetTop > 0) {
                outOverrideBounds.offset(0, offsetTop);
            }
        }
        computeConfigResourceOverrides(getResolvedOverrideConfiguration(), newParentConfig);
    }