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

Commit fbcf72fa authored by Pablo Gamito's avatar Pablo Gamito
Browse files

Update condition for when to show letterbox

Makes sure we show the letterbox even during the period a window is
requesting to be redrawn because of a layout change (i.e. orientation
change) or for any other reason, if the window's associated surface
is still visible.

This avoids seeing a letterbox flicker when this happens.

Bug: 256052489
Bug: 266635069
Test: Launch the dialer for a phone call or Google wallet app on a large
screen device and make sure the letterbox doesn't flicker on launch.

Change-Id: I7911ddc45c1ff839cc22be09caa5cc7ddc022d45
parent 3fb52a63
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -1001,7 +1001,7 @@ final class LetterboxUiController {

    @VisibleForTesting
    boolean shouldShowLetterboxUi(WindowState mainWindow) {
        return isSurfaceReadyAndVisible(mainWindow) && mainWindow.areAppWindowBoundsLetterboxed()
        return isSurfaceVisible(mainWindow) && mainWindow.areAppWindowBoundsLetterboxed()
                // Check for FLAG_SHOW_WALLPAPER explicitly instead of using
                // WindowContainer#showWallpaper because the later will return true when this
                // activity is using blurred wallpaper for letterbox background.
@@ -1009,11 +1009,8 @@ final class LetterboxUiController {
    }

    @VisibleForTesting
    boolean isSurfaceReadyAndVisible(WindowState mainWindow) {
        boolean surfaceReady = mainWindow.isDrawn() // Regular case
                // Waiting for relayoutWindow to call preserveSurface
                || mainWindow.isDragResizeChanged();
        return surfaceReady && (mActivityRecord.isVisible()
    boolean isSurfaceVisible(WindowState mainWindow) {
        return mainWindow.isOnScreen() && (mActivityRecord.isVisible()
                || mActivityRecord.isVisibleRequested());
    }

+1 −0
Original line number Diff line number Diff line
@@ -494,6 +494,7 @@ public class LetterboxUiControllerTest extends WindowTestsBase {
        doReturn(insets).when(mainWindow).getInsetsState();
        doReturn(attrs).when(mainWindow).getAttrs();
        doReturn(true).when(mainWindow).isDrawn();
        doReturn(true).when(mainWindow).isOnScreen();
        doReturn(false).when(mainWindow).isLetterboxedForDisplayCutout();
        doReturn(true).when(mainWindow).areAppWindowBoundsLetterboxed();
        doReturn(true).when(mLetterboxConfiguration).isLetterboxActivityCornersRounded();
+1 −1
Original line number Diff line number Diff line
@@ -502,7 +502,7 @@ public class SizeCompatTests extends WindowTestsBase {

        spyOn(mActivity.mLetterboxUiController);
        doReturn(true).when(mActivity.mLetterboxUiController)
                .isSurfaceReadyAndVisible(any());
                .isSurfaceVisible(any());

        assertTrue(mActivity.mLetterboxUiController.shouldShowLetterboxUi(
                mActivity.findMainWindow()));