Merge "Adding hardware layers to All Apps" into honeycomb
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index faf9bc6..7e69681 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -2919,6 +2919,10 @@
         // Change the state *after* we've called all the transition code
         mState = State.ALL_APPS;
 
+        // Pause the auto-advance of widgets until we are out of AllApps
+        mUserPresent = false;
+        updateRunning();
+
         // send an accessibility event to announce the context change
         getWindow().getDecorView().sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
     }
@@ -2944,6 +2948,10 @@
         // Change the state *after* we've called all the transition code
         mState = State.WORKSPACE;
 
+        // Resume the auto-advance of widgets
+        mUserPresent = true;
+        updateRunning();
+
         // send an accessibility event to announce the context change
         getWindow().getDecorView().sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
     }
@@ -3044,6 +3052,10 @@
         }
         // Change the state *after* we've called all the transition code
         mState = State.CUSTOMIZE;
+
+        // Pause the auto-advance of widgets until we are out of Customization drawer
+        mUserPresent = false;
+        updateRunning();
     }
 
     // Hide the customization drawer (only exists in x-large configuration)
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index 490417a..e65c196 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -273,12 +273,12 @@
         }
     }
 
-    private void pageBeginMoving() {
+    protected void pageBeginMoving() {
         mIsPageMoving = true;
         onPageBeginMoving();
     }
 
-    private void pageEndMoving() {
+    protected void pageEndMoving() {
         onPageEndMoving();
         mIsPageMoving = false;
     }
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index 2800b02..f37ac1f 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -306,10 +306,15 @@
                 }
                 mWallpaperOffset.setOverrideHorizontalCatchupConstant(false);
                 mAnimator = null;
+                enableChildrenLayers(false);
             }
         };
         mShrinkAnimationListener = new AnimatorListenerAdapter() {
             @Override
+            public void onAnimationStart(Animator animation) {
+                enableChildrenLayers(true);
+            }
+            @Override
             public void onAnimationEnd(Animator animation) {
                 mWallpaperOffset.setOverrideHorizontalCatchupConstant(false);
                 mAnimator = null;
@@ -1253,6 +1258,25 @@
         return super.onTouchEvent(ev);
     }
 
+    protected void enableChildrenLayers(boolean enable) {
+        for (int i = 0; i < getPageCount(); i++) {
+            ((ViewGroup)getChildAt(i)).setChildrenLayersEnabled(enable);
+        }
+    }
+    @Override
+    protected void pageBeginMoving() {
+        enableChildrenLayers(true);
+        super.pageBeginMoving();
+    }
+
+    @Override
+    protected void pageEndMoving() {
+        if (!mIsSmall && !mIsInUnshrinkAnimation) {
+            enableChildrenLayers(false);
+        }
+        super.pageEndMoving();
+    }
+
     @Override
     protected void onWallpaperTap(MotionEvent ev) {
         final int[] position = mTempCell;