Merge "Update condition for when to show letterbox" into tm-qpr-dev am: 69d2637f22

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21380983

Change-Id: I5fd9511bab58c502e1f33e87282a293fc9985542
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Pablo Gamito
2023-02-15 13:12:46 +00:00
committed by Automerger Merge Worker
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()));