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

Commit 4a6cd190 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Update wallpaper target if the current target is gone

The condition was not accurate that a window with wallpaper
flag doesn't mean it is the wallpaper target. And a window
can be wallpaper target without wallpaper flag such as
animating task by recents.

Fixes: 212940778
Fixes: 234206675
Test: atest WallpaperControllerTests#testUpdateWallpaperTarget
Test: Swipe up a task with 2 activities. And after the top one
      is terminated, the wallpaper should be still visible.

Change-Id: Ia861c44cfba448fe6aab0b6ea72595e9ab3a2a6f
parent df74b6dd
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2089,7 +2089,7 @@ public class WindowManagerService extends IWindowManager.Stub
        if (win.mAttrs.type == TYPE_WALLPAPER) {
            dc.mWallpaperController.clearLastWallpaperTimeoutTime();
            dc.pendingLayoutChanges |= FINISH_LAYOUT_REDO_WALLPAPER;
        } else if (win.hasWallpaper()) {
        } else if (dc.mWallpaperController.isWallpaperTarget(win)) {
            dc.pendingLayoutChanges |= FINISH_LAYOUT_REDO_WALLPAPER;
        }

+16 −0
Original line number Diff line number Diff line
@@ -246,6 +246,22 @@ public class WallpaperControllerTests extends WindowTestsBase {
        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.
     */