Merge "Update wallpaper target if the current target is gone" into tm-qpr-dev

This commit is contained in:
Riddle Hsu
2022-07-01 12:25:01 +00:00
committed by Android (Google) Code Review
2 changed files with 17 additions and 1 deletions

View File

@@ -2089,7 +2089,7 @@ public class WindowManagerService extends IWindowManager.Stub
if (win.mAttrs.type == TYPE_WALLPAPER) { if (win.mAttrs.type == TYPE_WALLPAPER) {
dc.mWallpaperController.clearLastWallpaperTimeoutTime(); dc.mWallpaperController.clearLastWallpaperTimeoutTime();
dc.pendingLayoutChanges |= FINISH_LAYOUT_REDO_WALLPAPER; dc.pendingLayoutChanges |= FINISH_LAYOUT_REDO_WALLPAPER;
} else if (win.hasWallpaper()) { } else if (dc.mWallpaperController.isWallpaperTarget(win)) {
dc.pendingLayoutChanges |= FINISH_LAYOUT_REDO_WALLPAPER; dc.pendingLayoutChanges |= FINISH_LAYOUT_REDO_WALLPAPER;
} }

View File

@@ -246,6 +246,22 @@ public class WallpaperControllerTests extends WindowTestsBase {
assertEquals(otherWindowInitialZoom, wallpaperWindow.mWallpaperZoomOut, .01f); assertEquals(otherWindowInitialZoom, wallpaperWindow.mWallpaperZoomOut, .01f);
} }
@Test
public void testUpdateWallpaperTarget() {
final DisplayContent dc = mDisplayContent;
final WindowState homeWin = createWallpaperTargetWindow(dc);
final WindowState appWin = createWindow(null, TYPE_BASE_APPLICATION, "app");
final RecentsAnimationController recentsController = mock(RecentsAnimationController.class);
doReturn(true).when(recentsController).isWallpaperVisible(eq(appWin));
mWm.setRecentsAnimationController(recentsController);
dc.mWallpaperController.adjustWallpaperWindows();
assertEquals(appWin, dc.mWallpaperController.getWallpaperTarget());
// The wallpaper target is gone, so it should adjust to the next target.
appWin.removeImmediately();
assertEquals(homeWin, dc.mWallpaperController.getWallpaperTarget());
}
/** /**
* Tests that the windowing mode of the wallpaper window must always be fullscreen. * Tests that the windowing mode of the wallpaper window must always be fullscreen.
*/ */