From 6762a441ef9c764f3bfee4201742e80aa6621b89 Mon Sep 17 00:00:00 2001 From: Michael Wright Date: Tue, 15 Oct 2013 14:43:32 -0700 Subject: [PATCH] Fix conditional for glClear call Previously the call to glClear was executed when there was no available space (i.e. space which the Bitmap would *not* be drawn in on the background of the launcher), rather than when there was. Inverting the checks fixes this problem. Also, remove unnecessary Handler since the call to updateWallpapers is done via one-way binder interface and wrapped in a synchronize block anyways. Putting it on the Handler just put it on the main looper of the context that created WallpaperManager, which isn't necessary. Change-Id: Ic7a323303ec6e354d1ef245eec3434ff7128432d --- core/java/android/app/WallpaperManager.java | 21 ++++--------------- .../com/android/systemui/ImageWallpaper.java | 2 +- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/core/java/android/app/WallpaperManager.java b/core/java/android/app/WallpaperManager.java index ced72f80a0295..99eecb0fa9f26 100644 --- a/core/java/android/app/WallpaperManager.java +++ b/core/java/android/app/WallpaperManager.java @@ -221,24 +221,9 @@ public class WallpaperManager { private static final int MSG_CLEAR_WALLPAPER = 1; - private final Handler mHandler; - Globals(Looper looper) { IBinder b = ServiceManager.getService(Context.WALLPAPER_SERVICE); mService = IWallpaperManager.Stub.asInterface(b); - mHandler = new Handler(looper) { - @Override - public void handleMessage(Message msg) { - switch (msg.what) { - case MSG_CLEAR_WALLPAPER: - synchronized (this) { - mWallpaper = null; - mDefaultWallpaper = null; - } - break; - } - } - }; } public void onWallpaperChanged() { @@ -247,7 +232,10 @@ public class WallpaperManager { * to null so if the user requests the wallpaper again then we'll * fetch it. */ - mHandler.sendEmptyMessage(MSG_CLEAR_WALLPAPER); + synchronized (this) { + mWallpaper = null; + mDefaultWallpaper = null; + } } public Bitmap peekWallpaperBitmap(Context context, boolean returnDefault) { @@ -280,7 +268,6 @@ public class WallpaperManager { synchronized (this) { mWallpaper = null; mDefaultWallpaper = null; - mHandler.removeMessages(MSG_CLEAR_WALLPAPER); } } diff --git a/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java b/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java index 4b0c2cb31ee86..c7f4828e85c41 100644 --- a/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java +++ b/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java @@ -471,7 +471,7 @@ public class ImageWallpaper extends WallpaperService { checkGlError(); - if (w < 0 || h < 0) { + if (w > 0 || h > 0) { glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClear(GL_COLOR_BUFFER_BIT); }