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
This commit is contained in:
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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()));
|
||||
|
||||
Reference in New Issue
Block a user