@@ -212,7 +212,11 @@ public void onWallpaperChanged() {
212212 */
213213 mHandler .sendEmptyMessage (MSG_CLEAR_WALLPAPER );
214214 }
215-
215+
216+ public Handler getHandler () {
217+ return mHandler ;
218+ }
219+
216220 public Bitmap peekWallpaperBitmap (Context context , boolean returnDefault ) {
217221 synchronized (this ) {
218222 if (mWallpaper != null ) {
@@ -604,7 +608,7 @@ public void suggestDesiredDimensions(int minimumWidth, int minimumHeight) {
604608 // Ignore
605609 }
606610 }
607-
611+
608612 /**
609613 * Set the position of the current wallpaper within any larger space, when
610614 * that wallpaper is visible behind the given window. The X and Y offsets
@@ -619,16 +623,23 @@ public void suggestDesiredDimensions(int minimumWidth, int minimumHeight) {
619623 * @param yOffset The offset along the Y dimension, from 0 to 1.
620624 */
621625 public void setWallpaperOffsets (IBinder windowToken , float xOffset , float yOffset ) {
622- try {
623- //Log.v(TAG, "Sending new wallpaper offsets from app...");
624- ViewRootImpl .getWindowSession (mContext .getMainLooper ()).setWallpaperPosition (
625- windowToken , xOffset , yOffset , mWallpaperXStep , mWallpaperYStep );
626- //Log.v(TAG, "...app returning after sending offsets!");
627- } catch (RemoteException e ) {
628- // Ignore.
629- }
626+ final IBinder fWindowToken = windowToken ;
627+ final float fXOffset = xOffset ;
628+ final float fYOffset = yOffset ;
629+ sGlobals .getHandler ().post (new Runnable () {
630+ public void run () {
631+ try {
632+ //Log.v(TAG, "Sending new wallpaper offsets from app...");
633+ ViewRootImpl .getWindowSession (mContext .getMainLooper ()).setWallpaperPosition (
634+ fWindowToken , fXOffset , fYOffset , mWallpaperXStep , mWallpaperYStep );
635+ //Log.v(TAG, "...app returning after sending offsets!");
636+ } catch (RemoteException e ) {
637+ // Ignore.
638+ }
639+ }
640+ });
630641 }
631-
642+
632643 /**
633644 * For applications that use multiple virtual screens showing a wallpaper,
634645 * specify the step size between virtual screens. For example, if the
0 commit comments