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

Commit 33a32995 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Do not apply taskbar insets for overlay case." into tm-dev

parents 408b90ff c6b845de
Loading
Loading
Loading
Loading
+10 −6
Original line number Original line Diff line number Diff line
@@ -332,25 +332,29 @@ final class LetterboxUiController {
        if (windowSurface != null && windowSurface.isValid()) {
        if (windowSurface != null && windowSurface.isValid()) {
            Transaction transaction = mActivityRecord.getSyncTransaction();
            Transaction transaction = mActivityRecord.getSyncTransaction();


            final InsetsState insetsState = mainWindow.getInsetsState();
            final InsetsSource taskbarInsetsSource =
                    insetsState.peekSource(InsetsState.ITYPE_EXTRA_NAVIGATION_BAR);

            if (!isLetterboxedNotForDisplayCutout(mainWindow)
            if (!isLetterboxedNotForDisplayCutout(mainWindow)
                    || !mLetterboxConfiguration.isLetterboxActivityCornersRounded()) {
                    || !mLetterboxConfiguration.isLetterboxActivityCornersRounded()
                    || taskbarInsetsSource == null) {
                transaction
                transaction
                        .setWindowCrop(windowSurface, null)
                        .setWindowCrop(windowSurface, null)
                        .setCornerRadius(windowSurface, 0);
                        .setCornerRadius(windowSurface, 0);
                return;
                return;
            }
            }


            final InsetsState insetsState = mainWindow.getInsetsState();
            final InsetsSource taskbarInsetsSource =
                    insetsState.getSource(InsetsState.ITYPE_EXTRA_NAVIGATION_BAR);

            Rect cropBounds = null;
            Rect cropBounds = null;


            // Rounded corners should be displayed above the taskbar. When taskbar is hidden,
            // Rounded corners should be displayed above the taskbar. When taskbar is hidden,
            // an insets frame is equal to a navigation bar which shouldn't affect position of
            // an insets frame is equal to a navigation bar which shouldn't affect position of
            // rounded corners since apps are expected to handle navigation bar inset.
            // rounded corners since apps are expected to handle navigation bar inset.
            // This condition checks whether the taskbar is visible.
            // This condition checks whether the taskbar is visible.
            if (taskbarInsetsSource.getFrame().height() >= mExpandedTaskBarHeight) {
            // Do not crop the taskbar inset if the window is in immersive mode - the user can
            // swipe to show/hide the taskbar as an overlay.
            if (taskbarInsetsSource.getFrame().height() >= mExpandedTaskBarHeight
                    && taskbarInsetsSource.isVisible()) {
                cropBounds = new Rect(mActivityRecord.getBounds());
                cropBounds = new Rect(mActivityRecord.getBounds());
                // Activity bounds are in screen coordinates while (0,0) for activity's surface
                // Activity bounds are in screen coordinates while (0,0) for activity's surface
                // control is at the top left corner of an app window so offsetting bounds
                // control is at the top left corner of an app window so offsetting bounds