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

Commit e41d1c6d authored by Vishnu Nair's avatar Vishnu Nair
Browse files

Mirror WallpaperWindowToken instead of WindowState

Mirroring a heirarchy does not preseve the root layer's transform
causing a flicker when switching wallpapers. Fix this by mirroring
at the WindowToken level preserving any scale and translation set
on the wallpaper.

Flag: EXEMPT bugfix
Fixes: 341830039
Test: switch wallpaper in homescreen
Change-Id: I4b81cbde1d486b1e2c952f6d59961d89314465a3
parent 641baee6
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -1064,13 +1064,17 @@ class WallpaperController {

    /**
     * Mirrors the visible wallpaper if it's available.
     * <p>
     * We mirror at the WallpaperWindowToken level because scale and translation is applied at
     * the WindowState level and mirroring the WindowState's SurfaceControl will remove any local
     * scale and translation.
     *
     * @return A SurfaceControl for the parent of the mirrored wallpaper.
     */
    SurfaceControl mirrorWallpaperSurface() {
        final WindowState wallpaperWindowState = getTopVisibleWallpaper();
        return wallpaperWindowState != null
                ? SurfaceControl.mirrorSurface(wallpaperWindowState.getSurfaceControl())
                ? SurfaceControl.mirrorSurface(wallpaperWindowState.mToken.getSurfaceControl())
                : null;
    }