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

Commit a0876641 authored by Santiago Etchebehere's avatar Santiago Etchebehere
Browse files

Account for wallpaper scale in prepareSurfaceLocked

This fixes a flicker in the wallpaper when rotating the
screen that was caused because prepareSurface was scaling
and translating the surface without considering the zoom-in
scale that is applied everywhere else to wallpapers so the
end result was the surface being scaled down then up again.

Also clean up a bit the usages of setWallpaperPositionAndScale

Bug: 152002715
Fixes: 152376185
Test: manual
Change-Id: I2d2d74a411bee13bee1a7b4cce3744ee450ac549
parent 2328849c
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
@@ -1066,14 +1066,15 @@ class WindowStateAnimator {


        if (!w.mSeamlesslyRotated) {
            // Wallpaper is already updated above when calling setWallpaperPositionAndScale so
            // we only need to consider the non-wallpaper case here.
            if (!mIsWallpaper) {
                applyCrop(clipRect, recoveringMemory);
                mSurfaceController.setMatrixInTransaction(mDsDx * w.mHScale * mExtraHScale,
                mSurfaceController.setMatrixInTransaction(
                        mDsDx * w.mHScale * mExtraHScale,
                        mDtDx * w.mVScale * mExtraVScale,
                        mDtDy * w.mHScale * mExtraHScale,
                        mDsDy * w.mVScale * mExtraVScale, recoveringMemory);
            } else {
                setWallpaperPositionAndScale(mXOffset, mYOffset, mWallpaperScale, recoveringMemory);
            }
        }

@@ -1152,13 +1153,20 @@ class WindowStateAnimator {
                            mSurfaceController, mShownAlpha, mDsDx, w.mHScale, mDtDx, w.mVScale,
                            mDtDy, w.mHScale, mDsDy, w.mVScale, w);

            boolean prepared =
            boolean prepared = true;

            if (mIsWallpaper) {
                setWallpaperPositionAndScale(
                        mXOffset, mYOffset, mWallpaperScale, recoveringMemory);
            } else {
                prepared =
                    mSurfaceController.prepareToShowInTransaction(mShownAlpha,
                        mDsDx * w.mHScale * mExtraHScale,
                        mDtDx * w.mVScale * mExtraVScale,
                        mDtDy * w.mHScale * mExtraHScale,
                        mDsDy * w.mVScale * mExtraVScale,
                        recoveringMemory);
            }

            if (prepared && mDrawState == HAS_DRAWN) {
                if (mLastHidden) {