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

Commit 7377f584 authored by Adrian Roos's avatar Adrian Roos
Browse files

DisplayCutout: make dock divider cutout aware

Fixes an issue where the insets given to SystemUI's dock divider
did not include the display cutout insets, which would lead to the
minimized view being laid out wrong.

Bug: 75277581
Test: Enter landscape, enter splitscreen, press home. Verify that there is no extra space between home and the divider.
Change-Id: I85107f147381aaceb01dfcad329662d54d72bbf7
parent 51d2cc45
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import static android.view.WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
import static android.view.WindowManager.LayoutParams.FLAG_SLIPPERY;
import static android.view.WindowManager.LayoutParams.FLAG_SPLIT_TOUCH;
import static android.view.WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH;
import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION;
import static android.view.WindowManager.LayoutParams.TYPE_DOCK_DIVIDER;

@@ -55,6 +56,7 @@ public class DividerWindowManager {
        mLp.token = new Binder();
        mLp.setTitle(WINDOW_TITLE);
        mLp.privateFlags |= PRIVATE_FLAG_NO_MOVE_ANIMATION;
        mLp.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
        view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
+10 −4
Original line number Diff line number Diff line
@@ -1030,15 +1030,21 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        if (mAttrs.type == TYPE_DOCK_DIVIDER) {
            // For the docked divider, we calculate the stable insets like a full-screen window
            // so it can use it to calculate the snap positions.
            mStableInsets.set(Math.max(mStableFrame.left - mDisplayFrame.left, 0),
                    Math.max(mStableFrame.top - mDisplayFrame.top, 0),
                    Math.max(mDisplayFrame.right - mStableFrame.right, 0),
                    Math.max(mDisplayFrame.bottom - mStableFrame.bottom, 0));
            final WmDisplayCutout c = displayCutout.calculateRelativeTo(mDisplayFrame);
            mTmpRect.set(mDisplayFrame);
            mTmpRect.inset(c.getDisplayCutout().getSafeInsets());
            mTmpRect.intersectUnchecked(mStableFrame);

            mStableInsets.set(Math.max(mTmpRect.left - mDisplayFrame.left, 0),
                    Math.max(mTmpRect.top - mDisplayFrame.top, 0),
                    Math.max(mDisplayFrame.right - mTmpRect.right, 0),
                    Math.max(mDisplayFrame.bottom - mTmpRect.bottom, 0));

            // The divider doesn't care about insets in any case, so set it to empty so we don't
            // trigger a relayout when moving it.
            mContentInsets.setEmpty();
            mVisibleInsets.setEmpty();
            displayCutout = WmDisplayCutout.NO_CUTOUT;
        } else {
            getDisplayContent().getBounds(mTmpRect);
            // Override right and/or bottom insets in case if the frame doesn't fit the screen in