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

Commit 2dfb785e authored by Adrian Roos's avatar Adrian Roos
Browse files

DisplayCutout: Do not letterbox LAYOUT_FULLSCREEN windows

Bug: 65689439
Test: atest PhoneWindowManagerLayoutTest
Change-Id: I34fd6421461127954483b5eb2d7ee7540ce6491c
parent 865c70f5
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -4814,8 +4814,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        final int adjust = sim & SOFT_INPUT_MASK_ADJUST;

        final boolean requestedFullscreen = (fl & FLAG_FULLSCREEN) != 0
                || (requestedSysUiFl & View.SYSTEM_UI_FLAG_FULLSCREEN) != 0
                || (requestedSysUiFl & View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN) != 0;
                || (requestedSysUiFl & View.SYSTEM_UI_FLAG_FULLSCREEN) != 0;

        final boolean layoutInScreen = (fl & FLAG_LAYOUT_IN_SCREEN) == FLAG_LAYOUT_IN_SCREEN;
        final boolean layoutInsetDecor = (fl & FLAG_LAYOUT_INSET_DECOR) == FLAG_LAYOUT_INSET_DECOR;
+3 −3
Original line number Diff line number Diff line
@@ -1406,13 +1406,13 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
            mLetterbox.setDimensions(mPendingTransaction, getParent().getBounds(), w.mFrame);
        } else if (mLetterbox != null) {
            final SurfaceControl.Transaction t = new SurfaceControl.Transaction();
            // Make sure we have a transaction here, in case we're called outside of a transaction.
            // This does not use mPendingTransaction, because SurfaceAnimator uses a
            // global transaction in onAnimationEnd.
            SurfaceControl.openTransaction();
            try {
                mLetterbox.hide(t);
            } finally {
                // TODO: This should use pendingTransaction eventually, but right now things
                // happening on the animation finished callback are happening on the global
                // transaction.
                SurfaceControl.mergeToGlobalTransaction(t);
                SurfaceControl.closeTransaction();
            }
+1 −2
Original line number Diff line number Diff line
@@ -3002,8 +3002,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        // Letterbox if any fullscreen mode is set.
        final int fl = mAttrs.flags;
        final int sysui = mSystemUiVisibility;
        return (fl & FLAG_FULLSCREEN) != 0
                || (sysui & (SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | SYSTEM_UI_FLAG_FULLSCREEN)) != 0;
        return (fl & FLAG_FULLSCREEN) != 0 || (sysui & (SYSTEM_UI_FLAG_FULLSCREEN)) != 0;
    }

    boolean isDragResizeChanged() {
+19 −2
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.server.policy;
import static android.view.Surface.ROTATION_180;
import static android.view.Surface.ROTATION_270;
import static android.view.Surface.ROTATION_90;
import static android.view.View.SYSTEM_UI_FLAG_FULLSCREEN;
import static android.view.View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
import static android.view.WindowManager.LayoutParams.FLAG2_LAYOUT_IN_DISPLAY_CUTOUT_AREA;
@@ -128,7 +129,7 @@ public class PhoneWindowManagerLayoutTest extends PhoneWindowManagerTestBase {
    }

    @Test
    public void layoutWindowLw_withDisplayCutout_fullscreen() {
    public void layoutWindowLw_withDisplayCutout_layoutFullscreen() {
        addDisplayCutout();

        mAppWindow.attrs.subtreeSystemUiVisibility |= SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
@@ -137,6 +138,22 @@ public class PhoneWindowManagerLayoutTest extends PhoneWindowManagerTestBase {
        mPolicy.beginLayoutLw(mFrames, 0 /* UI mode */);
        mPolicy.layoutWindowLw(mAppWindow, null, mFrames);

        assertInsetByTopBottom(mAppWindow.parentFrame, 0, 0);
        assertInsetByTopBottom(mAppWindow.stableFrame, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
        assertInsetByTopBottom(mAppWindow.contentFrame, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
        assertInsetByTopBottom(mAppWindow.decorFrame, 0, 0);
    }

    @Test
    public void layoutWindowLw_withDisplayCutout_fullscreen() {
        addDisplayCutout();

        mAppWindow.attrs.subtreeSystemUiVisibility |= SYSTEM_UI_FLAG_FULLSCREEN;
        mPolicy.addWindow(mAppWindow);

        mPolicy.beginLayoutLw(mFrames, 0 /* UI mode */);
        mPolicy.layoutWindowLw(mAppWindow, null, mFrames);

        assertInsetByTopBottom(mAppWindow.parentFrame, STATUS_BAR_HEIGHT, 0);
        assertInsetByTopBottom(mAppWindow.stableFrame, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
        assertInsetByTopBottom(mAppWindow.contentFrame, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
@@ -147,7 +164,7 @@ public class PhoneWindowManagerLayoutTest extends PhoneWindowManagerTestBase {
    public void layoutWindowLw_withDisplayCutout_fullscreenInCutout() {
        addDisplayCutout();

        mAppWindow.attrs.subtreeSystemUiVisibility |= SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
        mAppWindow.attrs.subtreeSystemUiVisibility |= SYSTEM_UI_FLAG_FULLSCREEN;
        mAppWindow.attrs.flags2 |= FLAG2_LAYOUT_IN_DISPLAY_CUTOUT_AREA;
        mPolicy.addWindow(mAppWindow);