Fix issue #2097189: can't set custom wallpaper

My deadlock fix was only half done.

Change-Id: If9f286030894a60cd71851fb784bb61045f08185
diff --git a/core/java/android/app/WallpaperManager.java b/core/java/android/app/WallpaperManager.java
index a6bbaa6..c40fe69 100644
--- a/core/java/android/app/WallpaperManager.java
+++ b/core/java/android/app/WallpaperManager.java
@@ -62,22 +62,23 @@
         
         private static final int MSG_CLEAR_WALLPAPER = 1;
         
-        private final Handler mHandler = new Handler() {
-            @Override
-            public void handleMessage(Message msg) {
-                switch (msg.what) {
-                    case MSG_CLEAR_WALLPAPER:
-                        synchronized (this) {
-                            mWallpaper = null;
-                        }
-                        break;
-                }
-            }
-        };
+        private final Handler mHandler;
         
-        Globals() {
+        Globals(Looper looper) {
             IBinder b = ServiceManager.getService(Context.WALLPAPER_SERVICE);
             mService = IWallpaperManager.Stub.asInterface(b);
+            mHandler = new Handler() {
+                @Override
+                public void handleMessage(Message msg) {
+                    switch (msg.what) {
+                        case MSG_CLEAR_WALLPAPER:
+                            synchronized (this) {
+                                mWallpaper = null;
+                            }
+                            break;
+                    }
+                }
+            };
         }
         
         public void onWallpaperChanged() {
@@ -188,7 +189,7 @@
     static void initGlobals(Looper looper) {
         synchronized (mSync) {
             if (sGlobals == null) {
-                sGlobals = new Globals();
+                sGlobals = new Globals(looper);
             }
         }
     }