From 30a7dfa329e79bab20f3b85dd376f736ebc6292d Mon Sep 17 00:00:00 2001 From: Adrian Roos Date: Fri, 17 Jul 2015 12:29:53 -0700 Subject: Fix image wallpaper size Fixes a bug where the image wallpaper size would not correctly update. Suspected cause is checking the to-be-requested size against the current surface size instead of the requested surface size. Also removes an unused field. Bug: 21148936 Change-Id: Ief4585bd5aed5922337709d7ae0ca0bf948649d0 --- .../src/com/android/systemui/ImageWallpaper.java | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java b/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java index 9f6d8df1684b..8556afc30e9f 100644 --- a/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java +++ b/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java @@ -116,7 +116,6 @@ public class ImageWallpaper extends WallpaperService { private final DisplayInfo mTmpDisplayInfo = new DisplayInfo(); boolean mVisible = true; - boolean mRedrawNeeded; boolean mOffsetsChanged; int mLastXTranslation; int mLastYTranslation; @@ -153,6 +152,9 @@ public class ImageWallpaper extends WallpaperService { private int mDisplayWidthAtLastSurfaceSizeUpdate = -1; private int mDisplayHeightAtLastSurfaceSizeUpdate = -1; + private int mLastRequestedWidth = -1; + private int mLastRequestedHeight = -1; + public DrawableEngine() { super(); setFixedSizeAllowed(true); @@ -211,21 +213,13 @@ public class ImageWallpaper extends WallpaperService { int surfaceWidth = Math.max(displayInfo.logicalWidth, mBackgroundWidth); int surfaceHeight = Math.max(displayInfo.logicalHeight, mBackgroundHeight); - // If the surface dimensions haven't changed, then just return - final Rect frame = surfaceHolder.getSurfaceFrame(); - if (frame != null) { - final int dw = frame.width(); - final int dh = frame.height(); - if (surfaceWidth == dw && surfaceHeight == dh) { - return; - } - } - if (FIXED_SIZED_SURFACE) { // Used a fixed size surface, because we are special. We can do // this because we know the current design of window animations doesn't // cause this to break. surfaceHolder.setFixedSize(surfaceWidth, surfaceHeight); + mLastRequestedWidth = surfaceWidth; + mLastRequestedHeight = surfaceHeight; } else { surfaceHolder.setSizeFromLayout(); } @@ -387,7 +381,6 @@ public class ImageWallpaper extends WallpaperService { yPixels += (int) (availhUnscaled * (mYOffset - .5f) + .5f); mOffsetsChanged = false; - mRedrawNeeded = false; if (surfaceDimensionsChanged) { mLastSurfaceWidth = dw; mLastSurfaceHeight = dh; @@ -475,13 +468,15 @@ public class ImageWallpaper extends WallpaperService { out.print(" mYOffset="); out.println(mYOffset); out.print(prefix); out.print(" mVisible="); out.print(mVisible); - out.print(" mRedrawNeeded="); out.print(mRedrawNeeded); out.print(" mOffsetsChanged="); out.println(mOffsetsChanged); out.print(prefix); out.print(" mLastXTranslation="); out.print(mLastXTranslation); out.print(" mLastYTranslation="); out.print(mLastYTranslation); out.print(" mScale="); out.println(mScale); + out.print(prefix); out.print(" mLastRequestedWidth="); out.print(mLastRequestedWidth); + out.print(" mLastRequestedHeight="); out.println(mLastRequestedHeight); + out.print(prefix); out.println(" DisplayInfo at last updateSurfaceSize:"); out.print(prefix); out.print(" rotation="); out.print(mRotationAtLastSurfaceSizeUpdate); -- cgit v1.2.3-59-g8ed1b