Merge "Update condition for when to show letterbox" into tm-qpr-dev

This commit is contained in:
Pablo Gamito
2023-02-15 12:08:54 +00:00
committed by Android (Google) Code Review
3 changed files with 5 additions and 7 deletions

View File

@@ -1000,7 +1000,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.
@@ -1008,11 +1008,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());
}

View File

@@ -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();

View File

@@ -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()));