summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Adam Cohen <adamcohen@google.com> 2011-11-09 20:10:27 -0800
committer Adam Cohen <adamcohen@google.com> 2011-11-10 16:53:26 -0800
commit041a0baba7f075ab3aba9c075dd75695a51617e4 (patch)
tree1018008b16c35680185ecf049a62826f0935828d
parent4c96a59b4354c4a593a07a3273c186b51597bcc1 (diff)
Deferring wallpaper update to improve workspace scrolling (issue 5506959)
-> On the Xoom, this change gets us back up to 60 fps. The change is really more of a workaround for the fact that we don't have vsync, and we ought to be able to change it back once we do. Change-Id: I80888f18887bf5f2fed72c19641ed430ef6dbfcf
-rw-r--r--core/java/android/app/WallpaperManager.java33
1 files changed, 22 insertions, 11 deletions
diff --git a/core/java/android/app/WallpaperManager.java b/core/java/android/app/WallpaperManager.java
index f81ea81be237..91398bce21f3 100644
--- a/core/java/android/app/WallpaperManager.java
+++ b/core/java/android/app/WallpaperManager.java
@@ -212,7 +212,11 @@ public class WallpaperManager {
*/
mHandler.sendEmptyMessage(MSG_CLEAR_WALLPAPER);
}
-
+
+ public Handler getHandler() {
+ return mHandler;
+ }
+
public Bitmap peekWallpaperBitmap(Context context, boolean returnDefault) {
synchronized (this) {
if (mWallpaper != null) {
@@ -604,7 +608,7 @@ public class WallpaperManager {
// Ignore
}
}
-
+
/**
* Set the position of the current wallpaper within any larger space, when
* that wallpaper is visible behind the given window. The X and Y offsets
@@ -619,16 +623,23 @@ public class WallpaperManager {
* @param yOffset The offset along the Y dimension, from 0 to 1.
*/
public void setWallpaperOffsets(IBinder windowToken, float xOffset, float yOffset) {
- try {
- //Log.v(TAG, "Sending new wallpaper offsets from app...");
- ViewRootImpl.getWindowSession(mContext.getMainLooper()).setWallpaperPosition(
- windowToken, xOffset, yOffset, mWallpaperXStep, mWallpaperYStep);
- //Log.v(TAG, "...app returning after sending offsets!");
- } catch (RemoteException e) {
- // Ignore.
- }
+ final IBinder fWindowToken = windowToken;
+ final float fXOffset = xOffset;
+ final float fYOffset = yOffset;
+ sGlobals.getHandler().post(new Runnable() {
+ public void run() {
+ try {
+ //Log.v(TAG, "Sending new wallpaper offsets from app...");
+ ViewRootImpl.getWindowSession(mContext.getMainLooper()).setWallpaperPosition(
+ fWindowToken, fXOffset, fYOffset, mWallpaperXStep, mWallpaperYStep);
+ //Log.v(TAG, "...app returning after sending offsets!");
+ } catch (RemoteException e) {
+ // Ignore.
+ }
+ }
+ });
}
-
+
/**
* For applications that use multiple virtual screens showing a wallpaper,
* specify the step size between virtual screens. For example, if the