Use push from script. Remove old readback and instant animation code.
diff --git a/res/raw/rollo.c b/res/raw/rollo.c
index 2b15d7f..e60b8a2 100644
--- a/res/raw/rollo.c
+++ b/res/raw/rollo.c
@@ -19,11 +19,31 @@
 int g_LastTime;
 int g_PageCount;
 float g_Zoom;
-float g_ZoomTarget;
 
 // Drawing constants, should be parameters ======
 #define VIEW_ANGLE 1.28700222f
 
+float g_OldPosPage;
+float g_OldPosVelocity;
+float g_OldZoom;
+
+void updateReadback() {
+    if ((g_OldPosPage != g_PosPage) ||
+        (g_OldPosVelocity != g_PosVelocity) ||
+        (g_OldZoom != g_Zoom)) {
+
+        g_OldPosPage = g_PosPage;
+        g_OldPosVelocity = g_PosVelocity;
+        g_OldZoom = g_Zoom;
+
+        int i[3];
+        i[0] = g_PosPage * (1 << 16);
+        i[1] = g_PosVelocity * (1 << 16);
+        i[2] = g_OldZoom * (1 << 16);
+        sendToClient(&i[0], 1, 12, 1);
+    }
+}
+
 void init() {
     g_AttractionTable[0] = 6.5f;
     g_AttractionTable[1] = 6.5f;
@@ -50,7 +70,6 @@
     g_LastTouchDown = 0;
     g_LastPositionX = 0;
     g_Zoom = 0;
-    g_ZoomTarget = 0;
 }
 
 void move() {
@@ -97,16 +116,6 @@
     g_LastTouchDown = 0;
 }
 
-void setZoomTarget() {
-    g_ZoomTarget = state->zoomTarget;
-    //debugF("zoom target", g_ZoomTarget);
-}
-
-void setZoom() {
-    readback->zoom = g_Zoom = g_ZoomTarget = state->zoom;
-    //debugF("zoom", g_ZoomTarget);
-}
-
 int
 count_pages(int iconCount)
 {
@@ -301,8 +310,8 @@
     g_LastTime = newTime;
 
     //debugF("zoom", g_Zoom);
-    if (g_Zoom != g_ZoomTarget) {
-        float dz = (g_ZoomTarget - g_Zoom) * g_DT * 5;
+    if (g_Zoom != state->zoomTarget) {
+        float dz = (state->zoomTarget - g_Zoom) * g_DT * 5;
         if (dz && (fabsf(dz) < 0.03f)) {
             if (dz > 0) {
                 dz = 0.03f;
@@ -310,22 +319,22 @@
                 dz = -0.03f;
             }
         }
-        if (fabsf(g_Zoom - g_ZoomTarget) < fabsf(dz)) {
-            g_Zoom = g_ZoomTarget;
+        if (fabsf(g_Zoom - state->zoomTarget) < fabsf(dz)) {
+            g_Zoom = state->zoomTarget;
         } else {
             g_Zoom += dz;
         }
-        readback->zoom = g_Zoom;
+        updateReadback();
     }
 
     // Set clear value to dim the background based on the zoom position.
-    if (g_Zoom < 0.001f) {
+    if ((g_Zoom < 0.001f) && (state->zoomTarget < 0.001f)) {
         pfClearColor(0.0f, 0.0f, 0.0f, 0.0f);
         // When we're zoomed out and not tracking motion events, reset the pos to 0.
         if (!g_LastTouchDown) {
             g_PosPage = 0;
         }
-        return 1; // 0;
+        return 1;//0;
     } else if (g_Zoom < 0.85f) {
         pfClearColor(0.0f, 0.0f, 0.0f, g_Zoom);
     } else {
@@ -337,8 +346,7 @@
     g_PageCount = count_pages(iconCount);
 
     updatePos(0.1f);
-    readback->posX = g_PosPage;
-    readback->velocity = g_PosVelocity;
+    updateReadback();
 
     //debugF("    draw g_PosPage", g_PosPage);
 
@@ -393,6 +401,6 @@
 
     // Bug workaround where the last frame is not always displayed
     // So we keep rendering until the bug is fixed.
-    return 1; //(g_PosVelocity != 0) || fracf(g_PosPage) || g_Zoom != g_ZoomTarget);
+    return 1;//(g_PosVelocity != 0) || fracf(g_PosPage) || (g_Zoom != state->zoomTarget);
 }
 
diff --git a/src/com/android/launcher2/AllAppsView.java b/src/com/android/launcher2/AllAppsView.java
index 93a6701..4cd017b 100644
--- a/src/com/android/launcher2/AllAppsView.java
+++ b/src/com/android/launcher2/AllAppsView.java
@@ -45,7 +45,6 @@
 import android.graphics.Paint;
 import android.graphics.drawable.BitmapDrawable;
 import android.graphics.drawable.Drawable;
-import android.os.Handler;
 import android.os.Message;
 import android.os.SystemClock;
 import android.util.AttributeSet;
@@ -95,12 +94,10 @@
     private int mMotionDownRawY;
     private int mHomeButtonTop;
     private long mTouchTime;
-    private boolean mZoomSwipeInProgress;
 
     static class Defines {
         public static final int ALLOC_PARAMS = 0;
         public static final int ALLOC_STATE = 1;
-        public static final int ALLOC_READBACK = 2;
         public static final int ALLOC_ICON_IDS = 3;
         public static final int ALLOC_LABEL_IDS = 4;
         public static final int ALLOC_X_BORDERS = 5;
@@ -224,7 +221,6 @@
                 mMotionDownRawX = (int)ev.getRawX();
                 mMotionDownRawY = (int)ev.getRawY();
                 mLastMotionX = x;
-                mRollo.mReadback.read();
 
                 mRollo.mState.newPositionX = ev.getRawX() / mDefines.SCREEN_WIDTH_PX;
                 mRollo.mState.newTouchDown = 1;
@@ -232,7 +228,7 @@
                 if (!mRollo.checkClickOK()) {
                     mRollo.clearSelectedIcon();
                 } else {
-                    mRollo.selectIcon(x, y, mRollo.mReadback.posX);
+                    mRollo.selectIcon(x, y, mRollo.mMessageProc.mPosX);
                 }
                 mRollo.mState.save();
                 mRollo.mInvokeMove.execute();
@@ -276,17 +272,12 @@
                 mRollo.mState.newTouchDown = 0;
                 mRollo.mState.newPositionX = ev.getRawX() / mDefines.SCREEN_WIDTH_PX;
 
-                if (!mZoomSwipeInProgress) {
-                    mVelocity.computeCurrentVelocity(1000 /* px/sec */, mMaxFlingVelocity);
-                    mRollo.mState.flingVelocityX
-                            = mVelocity.getXVelocity() / mDefines.SCREEN_WIDTH_PX;
-                    mRollo.clearSelectedIcon();
-                    mRollo.mState.save();
-                    mRollo.mInvokeFling.execute();
-                } else {
-                    mRollo.mState.save();
-                    mRollo.mInvokeMove.execute();
-                }
+                mVelocity.computeCurrentVelocity(1000 /* px/sec */, mMaxFlingVelocity);
+                mRollo.mState.flingVelocityX
+                        = mVelocity.getXVelocity() / mDefines.SCREEN_WIDTH_PX;
+                mRollo.clearSelectedIcon();
+                mRollo.mState.save();
+                mRollo.mInvokeFling.execute();
 
                 mLastMotionX = -10000;
                 if (mVelocity != null) {
@@ -316,7 +307,7 @@
             return true;
         }
         int index = mRollo.mState.selectedIconIndex;
-        Log.d(TAG, "long click! velocity=" + mRollo.mReadback.velocity + " index=" + index);
+        Log.d(TAG, "long click! velocity=" + mRollo.mMessageProc.mVelocity + " index=" + index);
         if (mRollo.checkClickOK() && index >= 0 && index < mAllAppsList.size()) {
             ApplicationInfo app = mAllAppsList.get(index);
 
@@ -348,7 +339,7 @@
      * @param amount [0..1] 0 is hidden, 1 is open
      * @param animate Whether to animate.
      */
-    public void zoom(float amount, boolean animate) {
+    public void zoom(float amount) {
         if (mRollo == null) {
             return;
         }
@@ -357,43 +348,18 @@
         mRollo.clearSelectedIcon();
         if (amount > 0.001f) {
             // set in readback, so we're correct even before the next frame
-            mRollo.mReadback.zoom = mRollo.mState.zoomTarget = amount;
-            if (!animate) {
-                mRollo.mState.zoom = amount;
-                mRollo.mReadback.save();
-            }
+            mRollo.mState.zoomTarget = amount;
         } else {
             mRollo.mState.zoomTarget = 0;
-            if (!animate) {
-                mRollo.mReadback.zoom = mRollo.mState.zoom = 0;
-                mRollo.mReadback.save();
-            }
         }
         mRollo.mState.save();
-        if (!animate) {
-            mRollo.mInvokeSetZoom.execute();
-        } else {
-            mRollo.mInvokeSetZoomTarget.execute();
-        }
-        mReadZoom.removeMessages(1);
-        mReadZoom.sendEmptyMessageDelayed(1, 1000);
     }
 
-    Handler mReadZoom = new Handler() {
-        public void handleMessage(Message msg) {
-            if(mRollo != null && mRollo.mReadback != null) {
-                // FIXME: These checks may indicate other problems.
-                mRollo.mReadback.read();
-            }
-        }
-    };
-
     public boolean isVisible() {
         if (mRollo == null) {
             return false;
         }
-        //mRollo.mReadback.read();
-        return mRollo.mReadback.zoom > 0.001f;
+        return mRollo.mMessageProc.mZoom > 0.001f;
     }
 
     @Override
@@ -444,8 +410,6 @@
 
         private Script.Invokable mInvokeMove;
         private Script.Invokable mInvokeFling;
-        private Script.Invokable mInvokeSetZoomTarget;
-        private Script.Invokable mInvokeSetZoom;
         private Script.Invokable mInvokeTouchUp;
 
         private ProgramStore mPSIcons;
@@ -478,7 +442,6 @@
 
         Params mParams;
         State mState;
-        Readback mReadback;
 
         class BaseAlloc {
             Allocation mAlloc;
@@ -489,10 +452,23 @@
             }
         }
 
+        class AAMessage extends RenderScript.RSMessage {
+            public void run() {
+                mPosX = ((float)mData[0]) / (1 << 16);
+                mVelocity = ((float)mData[1]) / (1 << 16);
+                mZoom = ((float)mData[2]) / (1 << 16);
+                //Log.d("rs", "new msg " + mPosX + "  " + mVelocity + "  " + mZoom);
+            }
+            float mZoom;
+            float mPosX;
+            float mVelocity;
+        }
+        AAMessage mMessageProc;
+
         private boolean checkClickOK() {
             //android.util.Log.e("rs", "check click " + Float.toString(mReadback.velocity) + ", " + Float.toString(mReadback.posX));
-            return (Math.abs(mReadback.velocity) < 0.1f) &&
-                   (Math.abs(mReadback.posX - Math.round(mReadback.posX)) < 0.1f);
+            return (Math.abs(mMessageProc.mVelocity) < 0.1f) &&
+                   (Math.abs(mMessageProc.mPosX - Math.round(mMessageProc.mPosX)) < 0.1f);
         }
 
         class Params extends BaseAlloc {
@@ -521,7 +497,6 @@
             public int selectedIconIndex = -1;
             public int selectedIconTexture;
             public float zoomTarget;
-            public float zoom;
 
             State() {
                 mType = Type.createFromClass(mRS, State.class, 1, "StateClass");
@@ -530,24 +505,6 @@
             }
         }
 
-        class Readback extends BaseAlloc {
-            public float posX;
-            public float velocity;
-            public float zoom;
-
-            Readback() {
-                mType = Type.createFromClass(mRS, Readback.class, 1, "ReadbackClass");
-                mAlloc = Allocation.createTyped(mRS, mType);
-                save();
-            }
-
-            void read() {
-                if(mAlloc != null) {
-                    mAlloc.read(this);
-                }
-            }
-        }
-
         public RolloRS() {
         }
 
@@ -670,6 +627,7 @@
         private void initProgramStore() {
             ProgramStore.Builder bs = new ProgramStore.Builder(mRS, null, null);
             bs.setDepthFunc(ProgramStore.DepthFunc.ALWAYS);
+            bs.setColorMask(true,true,true,false);
             bs.setDitherEnable(true);
             bs.setBlendFunc(ProgramStore.BlendSrcFunc.SRC_ALPHA,
                             ProgramStore.BlendDstFunc.ONE_MINUS_SRC_ALPHA);
@@ -696,7 +654,6 @@
         private void initData() {
             mParams = new Params();
             mState = new State();
-            mReadback = new Readback();
 
             final Utilities.BubbleText bubble = new Utilities.BubbleText(getContext());
 
@@ -716,7 +673,6 @@
 
             mParams.save();
             mState.save();
-            mReadback.save();
 
             mSelectionBitmap = Bitmap.createBitmap(Defines.ICON_TEXTURE_WIDTH_PX,
                     Defines.ICON_TEXTURE_HEIGHT_PX, Bitmap.Config.ARGB_8888);
@@ -734,23 +690,21 @@
             sb.addDefines(mDefines);
             sb.setType(mParams.mType, "params", Defines.ALLOC_PARAMS);
             sb.setType(mState.mType, "state", Defines.ALLOC_STATE);
-            sb.setType(mReadback.mType, "readback", Defines.ALLOC_READBACK);
             mInvokeMove = sb.addInvokable("move");
             mInvokeFling = sb.addInvokable("fling");
-            mInvokeSetZoomTarget = sb.addInvokable("setZoomTarget");
-            mInvokeSetZoom = sb.addInvokable("setZoom");
             mInvokeTouchUp = sb.addInvokable("touchUp");
             mScript = sb.create();
             mScript.setClearColor(0.0f, 0.0f, 0.0f, 0.0f);
 
             mScript.bindAllocation(mParams.mAlloc, Defines.ALLOC_PARAMS);
             mScript.bindAllocation(mState.mAlloc, Defines.ALLOC_STATE);
-            mScript.bindAllocation(mReadback.mAlloc, Defines.ALLOC_READBACK);
             mScript.bindAllocation(mAllocIconID, Defines.ALLOC_ICON_IDS);
             mScript.bindAllocation(mAllocLabelID, Defines.ALLOC_LABEL_IDS);
             mScript.bindAllocation(mAllocTouchXBorders, Defines.ALLOC_X_BORDERS);
             mScript.bindAllocation(mAllocTouchYBorders, Defines.ALLOC_Y_BORDERS);
 
+            mMessageProc = new AAMessage();
+            mRS.mMessageCallback = mMessageProc;
             mRS.contextBindRootScript(mScript);
         }
 
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 9360113..8f03402 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -1595,7 +1595,7 @@
     }
 
     void showAllApps() {
-        mAllAppsGrid.zoom(1.0f, true);
+        mAllAppsGrid.zoom(1.0f);
         //mWorkspace.hide();
 
         // TODO: fade these two too
@@ -1605,7 +1605,7 @@
 
     void closeAllApps(boolean animated) {
         if (mAllAppsGrid.isVisible()) {
-            mAllAppsGrid.zoom(0.0f, animated);
+            mAllAppsGrid.zoom(0.0f);
             mWorkspace.getChildAt(mWorkspace.getCurrentScreen()).requestFocus();
 
             // TODO: fade these two too