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

Commit 962709e2 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Always update wallpaper surface scale from explicit request

This combines the logic of setting wallpaper scale from [1] and [2].
So updateScaleIfNeeded is skipped in prepare surface if the window
is invisible-requested, but if someone calls setWallpaperZoomOut,
it can ensure the latest scale is applied to the surface. That avoids
showing an intermediate scale:
   Apply scale 0.8
   Request scale 0.9
   Wallpaper becomes completely invisible (not apply 0.9)
   Wallpaper becomes visible
   Request scale 1.0
   Scale jumps from 0.8 to 1.0.

[1]: I8e8e21fcd3b8f4ff0f9b22d04c1abb908e719422
[2]: I1db9207c79bc45dedd90e7b13af5517f09abe4a7

Bug: 416216706
Flag: EXEMPT bugfix
Test: Launch app from home and observe wallpaper scale.
Change-Id: Id192ee94610f48661f92ae1d17a18d62dea35197
parent 55cba851
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -5018,11 +5018,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
    }

    private void updateScaleIfNeeded() {
        if (!isVisibleRequested() && !(mIsWallpaper && mToken.isVisible())) {
            // Skip if it is requested to be invisible, but if it is wallpaper, it may be in
            // transition that still needs to update the scale for zoom effect.
            return;
        }
        float globalScale = mGlobalScale;
        final WindowState parent = getParentWindow();
        if (parent != null) {
@@ -5045,7 +5040,9 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
            updateSurfacePositionNonOrganized();
            // Send information to SurfaceFlinger about the priority of the current window.
            updateFrameRateSelectionPriorityIfNeeded();
            if (isVisibleRequested()) {
                updateScaleIfNeeded();
            }
            mWinAnimator.prepareSurfaceLocked(getPendingTransaction());
            applyDims();
        }
@@ -5844,6 +5841,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        mXOffset = dx;
        mYOffset = dy;
        mWallpaperScale = scale;
        updateScaleIfNeeded();
        scheduleAnimation();
        return true;
    }