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

Commit 033f63a1 authored by Jeff Brown's avatar Jeff Brown
Browse files

Fix a regression in the wallpaper drawing.

We should not lock and post the surface if we don't intend to
draw anything into it.

Change-Id: Idfd1cf127bdc1f5e1f5e783a8991d44de90878da
parent a6ce0819
Loading
Loading
Loading
Loading
+26 −23
Original line number Diff line number Diff line
@@ -187,9 +187,6 @@ public class ImageWallpaper extends WallpaperService {
            }

            SurfaceHolder sh = getSurfaceHolder();
            Canvas c = sh.lockCanvas();
            if (c != null) {
                try {
            final Rect frame = sh.getSurfaceFrame();
            final Drawable background = mBackground;
            final int dw = frame.width();
@@ -202,19 +199,25 @@ public class ImageWallpaper extends WallpaperService {
            int yPixels = availh < 0 ? (int)(availh * mYOffset + .5f) : (availh / 2);

            mOffsetsChanged = false;
                    if (!mRedrawNeeded) {
                        if (xPixels == mLastXTranslation && yPixels == mLastYTranslation) {
            if (!mRedrawNeeded
                    && xPixels == mLastXTranslation && yPixels == mLastYTranslation) {
                if (DEBUG) {
                    Log.d(TAG, "Suppressed drawFrame since the image has not "
                            + "actually moved an integral number of pixels.");
                }
                return;
            }
                    }
            mRedrawNeeded = false;
            mLastXTranslation = xPixels;
            mLastYTranslation = yPixels;

            Canvas c = sh.lockCanvas();
            if (c != null) {
                try {
                    if (DEBUG) {
                        Log.d(TAG, "Redrawing: xPixels=" + xPixels + ", yPixels=" + yPixels);
                    }

                    c.translate(xPixels, yPixels);
                    if (availw < 0 || availh < 0) {
                        c.save(Canvas.CLIP_SAVE_FLAG);