Further improving performance of All Apps transition

Change-Id: Ie8a2af004acba4c13066dd636842a71793064688
diff --git a/res/layout-xlarge-land/all_apps_tabbed.xml b/res/layout-xlarge-land/all_apps_tabbed.xml
index 39c966b..9244213 100644
--- a/res/layout-xlarge-land/all_apps_tabbed.xml
+++ b/res/layout-xlarge-land/all_apps_tabbed.xml
@@ -16,12 +16,15 @@
 <com.android.launcher2.AllAppsTabbed
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher">
+    <com.android.launcher2.AllAppsBackground
+        android:id="@+id/all_apps_background"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent" />
     <LinearLayout
         android:orientation="vertical"
         android:layout_width="match_parent"
         android:layout_height="match_parent">
         <RelativeLayout
-            android:id="@+id/all_apps_tab_bar"
             android:layout_width="952dp"
             android:layout_height="wrap_content"
             android:layout_gravity="center_horizontal"
diff --git a/res/layout-xlarge-land/customization_drawer.xml b/res/layout-xlarge-land/customization_drawer_tab_contents.xml
similarity index 100%
rename from res/layout-xlarge-land/customization_drawer.xml
rename to res/layout-xlarge-land/customization_drawer_tab_contents.xml
diff --git a/res/layout-xlarge-port/all_apps_tabbed.xml b/res/layout-xlarge-port/all_apps_tabbed.xml
index 7673984..3b83bc7 100644
--- a/res/layout-xlarge-port/all_apps_tabbed.xml
+++ b/res/layout-xlarge-port/all_apps_tabbed.xml
@@ -16,12 +16,14 @@
 <com.android.launcher2.AllAppsTabbed
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher">
+    <com.android.launcher2.AllAppsBackground
+        android:layout_width="match_parent"
+        android:layout_height="match_parent" />
     <LinearLayout
         android:orientation="vertical"
         android:layout_width="match_parent"
         android:layout_height="match_parent">
         <RelativeLayout
-            android:id="@+id/all_apps_tab_bar"
             android:layout_width="700dp"
             android:layout_height="wrap_content"
             android:layout_gravity="center_horizontal"
diff --git a/res/layout-xlarge-port/customization_drawer.xml b/res/layout-xlarge-port/customization_drawer_tab_contents.xml
similarity index 100%
rename from res/layout-xlarge-port/customization_drawer.xml
rename to res/layout-xlarge-port/customization_drawer_tab_contents.xml
diff --git a/res/layout-xlarge/button_bar.xml b/res/layout-xlarge/button_bar.xml
new file mode 100644
index 0000000..6cd8e88
--- /dev/null
+++ b/res/layout-xlarge/button_bar.xml
@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<RelativeLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher">
+
+   <!-- Global search icon -->
+   <ImageView
+       android:id="@+id/search_button"
+       android:layout_width="wrap_content"
+       android:layout_height="wrap_content"
+       android:layout_alignParentTop="true"
+       android:layout_alignParentLeft="true"
+       android:paddingLeft="@dimen/toolbar_button_horizontal_padding"
+       android:paddingRight="@dimen/toolbar_button_horizontal_padding"
+       android:paddingTop="@dimen/toolbar_button_vertical_padding"
+       android:paddingBottom="@dimen/toolbar_button_vertical_padding"
+       android:src="@drawable/ic_generic_search"
+       android:background="@drawable/button_bg"
+       android:onClick="onClickSearchButton"
+       android:focusable="true"
+       android:clickable="true" />
+
+    <ImageView
+        android:id="@+id/search_divider"
+        android:src="@drawable/divider_launcher_holo"
+        android:layout_width="wrap_content"
+        android:layout_height="match_parent"
+        android:layout_toRightOf="@id/search_button"
+        android:paddingTop="@dimen/toolbar_button_vertical_padding"
+        android:paddingBottom="@dimen/toolbar_button_vertical_padding"
+
+        android:onClick="onClickSearchButton"
+        android:focusable="false"
+        android:clickable="true" />
+
+    <!-- Voice search icon -->
+    <ImageView
+        android:id="@+id/voice_button"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_toRightOf="@id/search_divider"
+        android:paddingLeft="@dimen/toolbar_button_horizontal_padding"
+        android:paddingRight="@dimen/toolbar_button_horizontal_padding"
+        android:paddingTop="@dimen/toolbar_button_vertical_padding"
+        android:paddingBottom="@dimen/toolbar_button_vertical_padding"
+        android:src="@drawable/ic_voice_search"
+        android:background="@drawable/button_bg"
+        android:onClick="onClickVoiceButton"
+        android:focusable="true"
+        android:clickable="true"/>
+
+    <ImageView
+        android:id="@+id/configure_button"
+        android:src="@drawable/ic_home_add_holo_dark"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignParentTop="true"
+        android:layout_alignParentRight="true"
+        android:paddingLeft="@dimen/toolbar_button_horizontal_padding"
+        android:paddingRight="@dimen/toolbar_button_horizontal_padding"
+        android:paddingTop="@dimen/toolbar_button_vertical_padding"
+        android:paddingBottom="@dimen/toolbar_button_vertical_padding"
+        android:background="@drawable/button_bg"
+
+        android:focusable="true"
+        android:clickable="true" />
+    <ImageView
+        android:id="@+id/divider"
+        android:src="@drawable/divider_launcher_holo"
+        android:layout_width="wrap_content"
+        android:layout_height="match_parent"
+        android:layout_toLeftOf="@id/configure_button"
+        android:paddingTop="@dimen/toolbar_button_vertical_padding"
+        android:paddingBottom="@dimen/toolbar_button_vertical_padding"
+
+        android:focusable="false"
+        android:clickable="true" />
+    <TextView
+        android:id="@+id/all_apps_button"
+        android:text="@string/all_apps_button_label"
+        android:drawablePadding="@dimen/all_apps_button_drawable_padding"
+        android:drawableLeft="@drawable/ic_home_all_apps_holo_dark"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_toLeftOf="@id/divider"
+        android:paddingLeft="@dimen/toolbar_button_horizontal_padding"
+        android:paddingRight="@dimen/toolbar_button_horizontal_padding"
+        android:paddingTop="@dimen/all_apps_button_vertical_padding"
+        android:paddingBottom="@dimen/all_apps_button_vertical_padding"
+        android:background="@drawable/button_bg"
+
+        android:gravity="center_horizontal|center_vertical"
+        android:textColor="#CCFFFFFF"
+        android:textSize="18sp"
+
+        android:shadowColor="#DA000000"
+        android:shadowDx="0.0"
+        android:shadowDy="0.0"
+        android:shadowRadius="2.5"
+
+        android:focusable="true"
+        android:clickable="true" />
+    <ImageView
+        android:id="@+id/divider_during_drag"
+        android:src="@drawable/divider_launcher_holo"
+        android:layout_width="wrap_content"
+        android:layout_height="match_parent"
+        android:layout_toLeftOf="@id/configure_button"
+        android:paddingTop="@dimen/toolbar_button_vertical_padding"
+        android:paddingBottom="@dimen/toolbar_button_vertical_padding"
+        android:visibility="gone" />
+    <com.android.launcher2.DeleteZone
+        android:id="@+id/delete_zone"
+        android:text="@string/delete_zone_label_workspace"
+        android:drawablePadding="@dimen/delete_zone_drawable_padding"
+        android:drawableLeft="@drawable/delete_zone_selector"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignRight="@id/configure_button"
+        android:paddingLeft="@dimen/toolbar_button_horizontal_padding"
+        android:paddingRight="@dimen/toolbar_button_horizontal_padding"
+        android:paddingTop="@dimen/toolbar_button_vertical_padding"
+        android:paddingBottom="@dimen/toolbar_button_vertical_padding"
+        android:background="@drawable/button_bg"
+
+        android:gravity="center_horizontal|center_vertical"
+        android:textColor="@color/workspace_all_apps_and_delete_zone_text_color"
+        android:textSize="18sp"
+        android:shadowColor="@color/workspace_all_apps_and_delete_zone_text_shadow_color"
+        android:shadowDx="0.0"
+        android:shadowDy="0.0"
+        android:shadowRadius="2.0"
+
+        android:visibility="gone"
+        launcher:direction="horizontal" />
+</RelativeLayout>
\ No newline at end of file
diff --git a/res/layout-xlarge/customization_drawer.xml b/res/layout-xlarge/customization_drawer.xml
new file mode 100644
index 0000000..dd1234c
--- /dev/null
+++ b/res/layout-xlarge/customization_drawer.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<TabHost xmlns:android="http://schemas.android.com/apk/res/android">
+    <LinearLayout
+        android:orientation="vertical"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent">
+        <TabWidget
+            android:id="@android:id/tabs"
+            android:layout_width="@dimen/customization_drawer_tab_widget_width"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center_horizontal"
+            android:background="@drawable/tab_unselected_holo"
+            android:tabStripEnabled="false" />
+        <FrameLayout
+            android:id="@android:id/tabcontent"
+            android:layout_width="match_parent"
+            android:layout_height="@dimen/customization_drawer_content_height">
+         </FrameLayout>
+      </LinearLayout>
+</TabHost>
\ No newline at end of file
diff --git a/res/layout-xlarge/launcher.xml b/res/layout-xlarge/launcher.xml
index a7cf321..acf62f9 100644
--- a/res/layout-xlarge/launcher.xml
+++ b/res/layout-xlarge/launcher.xml
@@ -48,165 +48,15 @@
         android:layout_height="match_parent"
         android:layout_gravity="top" />
 
-    <RelativeLayout
+    <include layout="@layout/button_bar"
         android:id="@+id/all_apps_button_cluster"
         android:layout_width="fill_parent"
         android:layout_height="?android:attr/actionBarSize"
-        android:layout_gravity="top">
+        android:layout_gravity="top" />
 
-       <!-- Global search icon -->
-       <ImageView
-           android:id="@+id/search_button"
-           android:layout_width="wrap_content"
-           android:layout_height="wrap_content"
-           android:layout_alignParentTop="true"
-           android:layout_alignParentLeft="true"
-           android:paddingLeft="@dimen/toolbar_button_horizontal_padding"
-           android:paddingRight="@dimen/toolbar_button_horizontal_padding"
-           android:paddingTop="@dimen/toolbar_button_vertical_padding"
-           android:paddingBottom="@dimen/toolbar_button_vertical_padding"
-           android:src="@drawable/ic_generic_search"
-           android:background="@drawable/button_bg"
-           android:onClick="onClickSearchButton"
-           android:focusable="true"
-           android:clickable="true" />
-
-        <ImageView
-            android:id="@+id/search_divider"
-            android:src="@drawable/divider_launcher_holo"
-            android:layout_width="wrap_content"
-            android:layout_height="match_parent"
-            android:layout_toRightOf="@id/search_button"
-            android:paddingTop="@dimen/toolbar_button_vertical_padding"
-            android:paddingBottom="@dimen/toolbar_button_vertical_padding"
-
-            android:onClick="onClickSearchButton"
-            android:focusable="false"
-            android:clickable="true" />
-
-        <!-- Voice search icon -->
-        <ImageView
-            android:id="@+id/voice_button"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_toRightOf="@id/search_divider"
-            android:paddingLeft="@dimen/toolbar_button_horizontal_padding"
-            android:paddingRight="@dimen/toolbar_button_horizontal_padding"
-            android:paddingTop="@dimen/toolbar_button_vertical_padding"
-            android:paddingBottom="@dimen/toolbar_button_vertical_padding"
-            android:src="@drawable/ic_voice_search"
-            android:background="@drawable/button_bg"
-            android:onClick="onClickVoiceButton"
-            android:focusable="true"
-            android:clickable="true"/>
-
-        <ImageView
-            android:id="@+id/configure_button"
-            android:src="@drawable/ic_home_add_holo_dark"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_alignParentTop="true"
-            android:layout_alignParentRight="true"
-            android:paddingLeft="@dimen/toolbar_button_horizontal_padding"
-            android:paddingRight="@dimen/toolbar_button_horizontal_padding"
-            android:paddingTop="@dimen/toolbar_button_vertical_padding"
-            android:paddingBottom="@dimen/toolbar_button_vertical_padding"
-            android:background="@drawable/button_bg"
-
-            android:focusable="true"
-            android:clickable="true" />
-        <ImageView
-            android:id="@+id/divider"
-            android:src="@drawable/divider_launcher_holo"
-            android:layout_width="wrap_content"
-            android:layout_height="match_parent"
-            android:layout_toLeftOf="@id/configure_button"
-            android:paddingTop="@dimen/toolbar_button_vertical_padding"
-            android:paddingBottom="@dimen/toolbar_button_vertical_padding"
-
-            android:focusable="false"
-            android:clickable="true" />
-        <TextView
-            android:id="@+id/all_apps_button"
-            android:text="@string/all_apps_button_label"
-            android:drawablePadding="@dimen/all_apps_button_drawable_padding"
-            android:drawableLeft="@drawable/ic_home_all_apps_holo_dark"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_toLeftOf="@id/divider"
-            android:paddingLeft="@dimen/toolbar_button_horizontal_padding"
-            android:paddingRight="@dimen/toolbar_button_horizontal_padding"
-            android:paddingTop="@dimen/all_apps_button_vertical_padding"
-            android:paddingBottom="@dimen/all_apps_button_vertical_padding"
-            android:background="@drawable/button_bg"
-
-            android:gravity="center_horizontal|center_vertical"
-            android:textColor="#CCFFFFFF"
-            android:textSize="18sp"
-
-            android:shadowColor="#DA000000"
-            android:shadowDx="0.0"
-            android:shadowDy="0.0"
-            android:shadowRadius="2.5"
-
-            android:focusable="true"
-            android:clickable="true" />
-        <ImageView
-            android:id="@+id/divider_during_drag"
-            android:src="@drawable/divider_launcher_holo"
-            android:layout_width="wrap_content"
-            android:layout_height="match_parent"
-            android:layout_toLeftOf="@id/configure_button"
-            android:paddingTop="@dimen/toolbar_button_vertical_padding"
-            android:paddingBottom="@dimen/toolbar_button_vertical_padding"
-            android:visibility="gone" />
-        <com.android.launcher2.DeleteZone
-            android:id="@+id/delete_zone"
-            android:text="@string/delete_zone_label_workspace"
-            android:drawablePadding="@dimen/delete_zone_drawable_padding"
-            android:drawableLeft="@drawable/delete_zone_selector"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_alignRight="@id/configure_button"
-            android:paddingLeft="@dimen/toolbar_button_horizontal_padding"
-            android:paddingRight="@dimen/toolbar_button_horizontal_padding"
-            android:paddingTop="@dimen/toolbar_button_vertical_padding"
-            android:paddingBottom="@dimen/toolbar_button_vertical_padding"
-            android:background="@drawable/button_bg"
-
-            android:gravity="center_horizontal|center_vertical"
-            android:textColor="@color/workspace_all_apps_and_delete_zone_text_color"
-            android:textSize="18sp"
-            android:shadowColor="@color/workspace_all_apps_and_delete_zone_text_shadow_color"
-            android:shadowDx="0.0"
-            android:shadowDy="0.0"
-            android:shadowRadius="2.0"
-
-            android:visibility="gone"
-            launcher:direction="horizontal" />
-    </RelativeLayout>
-
-    <TabHost
+    <include layout="@layout/customization_drawer"
         android:id="@+id/customization_drawer"
         android:layout_width="match_parent"
         android:layout_height="@dimen/customization_drawer_height"
-        android:layout_gravity="bottom">
-        <LinearLayout
-            android:orientation="vertical"
-            android:layout_width="match_parent"
-            android:layout_height="match_parent">
-            <TabWidget
-                android:id="@android:id/tabs"
-                android:layout_width="@dimen/customization_drawer_tab_widget_width"
-                android:layout_height="wrap_content"
-                android:layout_gravity="center_horizontal"
-                android:background="@drawable/tab_unselected_holo"
-                android:tabStripEnabled="false" />
-            <FrameLayout
-                android:id="@android:id/tabcontent"
-                android:layout_width="match_parent"
-                android:layout_height="@dimen/customization_drawer_content_height">
-             </FrameLayout>
-          </LinearLayout>
-    </TabHost>
+        android:layout_gravity="bottom" />
 </com.android.launcher2.DragLayer>
diff --git a/res/values-xlarge/config.xml b/res/values-xlarge/config.xml
index 90d8dc4..56c7bc6 100644
--- a/res/values-xlarge/config.xml
+++ b/res/values-xlarge/config.xml
@@ -9,7 +9,8 @@
 
     <!-- Duration in milliseconds of the all apps / configuration zoom-in animation. -->
     <!-- NB: This should be less than the workspaceShrinkTime as they happen together. -->
-    <integer name="config_allAppsZoomInTime">1211</integer>
+    <integer name="config_allAppsZoomInTime">1000</integer>
+    <integer name="config_allAppsFadeInTime">250</integer>
 
     <!-- Duration in milliseconds of the transition between tabs in the all apps/customize
          tray -->
@@ -25,6 +26,7 @@
     <!-- Duration in milliseconds of the all apps / configuration zoom-in animation. -->
     <!-- NB: This should be less than the workspaceShrinkTime as they happen together. -->
     <integer name="config_customizeZoomInTime">800</integer>
+    <integer name="config_customizeFadeInTime">800</integer>
 
     <!-- Duration in milliseconds of the all apps zoom-out animation -->
     <!-- NB: This should be less than the workspaceUnshrinkTime as they happen together. -->
@@ -37,7 +39,7 @@
          NOTE: If these are changed, the toolbar animation times below should also be. -->
     <integer name="config_allAppsFadeOutTime">500</integer>
     <integer name="config_customizeWorkspaceShrinkTime">800</integer>
-    <integer name="config_allAppsWorkspaceShrinkTime">1211</integer>
+    <integer name="config_allAppsWorkspaceShrinkTime">1000</integer>
     <integer name="config_workspaceUnshrinkTime">650</integer>
 
     <!-- Duration in milliseconds toolbar fade in and fade out animations.
diff --git a/src/com/android/launcher2/AllAppsBackground.java b/src/com/android/launcher2/AllAppsBackground.java
new file mode 100644
index 0000000..5292d0a
--- /dev/null
+++ b/src/com/android/launcher2/AllAppsBackground.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.launcher2;
+
+import com.android.launcher.R;
+
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.drawable.Drawable;
+import android.util.AttributeSet;
+import android.view.View;
+
+/**
+ * An implementation of PagedView that populates the pages of the workspace
+ * with all of the user's applications.
+ */
+public class AllAppsBackground extends View {
+    private Drawable mBackground;
+
+    public AllAppsBackground(Context context) {
+        this(context, null);
+    }
+
+    public AllAppsBackground(Context context, AttributeSet attrs) {
+        this(context, attrs, 0);
+    }
+
+    public AllAppsBackground(Context context, AttributeSet attrs, int defStyle) {
+        super(context, attrs, defStyle);
+        mBackground = getResources().getDrawable(R.drawable.all_apps_bg_gradient);
+    }
+
+    @Override
+    public void onDraw(Canvas canvas) {
+        mBackground.setBounds(mScrollX, 0, mScrollX + getMeasuredWidth(),
+                getMeasuredHeight());
+        mBackground.draw(canvas);
+    }
+}
diff --git a/src/com/android/launcher2/AllAppsTabbed.java b/src/com/android/launcher2/AllAppsTabbed.java
index 36594dd..6619150 100644
--- a/src/com/android/launcher2/AllAppsTabbed.java
+++ b/src/com/android/launcher2/AllAppsTabbed.java
@@ -49,7 +49,8 @@
     private static final String TAG_DOWNLOADED = "DOWNLOADED";
 
     private AllAppsPagedView mAllApps;
-    private View mTabBar;
+    private AllAppsBackground mBackground;
+    private Launcher mLauncher;
     private Context mContext;
     private final LayoutInflater mInflater;
     private boolean mFirstLayout = true;
@@ -68,8 +69,8 @@
         try {
             mAllApps = (AllAppsPagedView) findViewById(R.id.all_apps_paged_view);
             if (mAllApps == null) throw new Resources.NotFoundException();
-            mTabBar = findViewById(R.id.all_apps_tab_bar);
-            if (mTabBar == null) throw new Resources.NotFoundException();
+            mBackground = (AllAppsBackground) findViewById(R.id.all_apps_background);
+            if (mBackground == null) throw new Resources.NotFoundException();
         } catch (Resources.NotFoundException e) {
             Log.e(TAG, "Can't find necessary layout elements for AllAppsTabbed");
         }
@@ -126,6 +127,7 @@
     @Override
     public void setLauncher(Launcher launcher) {
         mAllApps.setLauncher(launcher);
+        mLauncher = launcher;
     }
 
     @Override
@@ -170,25 +172,21 @@
     }
 
     @Override
-    public void setFastAlpha(float alpha) {
-        final ViewGroup allAppsParent = (ViewGroup) mAllApps.getParent();
-        final ViewGroup tabBarParent = (ViewGroup) mAllApps.getParent();
-        mAllApps.setFastAlpha(alpha);
-        allAppsParent.fastInvalidate();
-        mTabBar.setFastAlpha(alpha);
-        tabBarParent.fastInvalidate();
-    }
-
-    @Override
     public void onLauncherAnimationStart() {
-        mTabBar.setLayerType(LAYER_TYPE_HARDWARE, null);
-        mAllApps.setLayerType(LAYER_TYPE_HARDWARE, null);
+        // Turn on hardware layers for performance
+        setLayerType(LAYER_TYPE_HARDWARE, null);
+        // Re-enable the rendering of the dimmed background in All Apps for performance reasons
+        mLauncher.getWorkspace().disableBackground();
+        mBackground.setVisibility(VISIBLE);
     }
 
     @Override
     public void onLauncherAnimationEnd() {
-        mTabBar.setLayerType(LAYER_TYPE_NONE, null);
-        mAllApps.setLayerType(LAYER_TYPE_NONE, null);
+        setLayerType(LAYER_TYPE_NONE, null);
+        // Move the rendering of the dimmed background to workspace after the all apps animation
+        // is done, so that the background is not rendered *above* the mini workspace screens
+        mLauncher.getWorkspace().enableBackground();
+        mBackground.setVisibility(GONE);
     }
 
     @Override
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 63982ba..e2bddde 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -330,7 +330,7 @@
 
             // share the same customization workspace across all the tabs
             mCustomizePagedView = (CustomizePagedView) mInflater.inflate(
-                    R.layout.customization_drawer, mHomeCustomizationDrawer, false);
+                    R.layout.customization_drawer_tab_contents, mHomeCustomizationDrawer, false);
             TabContentFactory contentFactory = new TabContentFactory() {
                 public View createTabContent(String tag) {
                     return mCustomizePagedView;
@@ -2738,6 +2738,9 @@
         final int duration = toAllApps ?
                 res.getInteger(R.integer.config_allAppsZoomInTime) :
                 res.getInteger(R.integer.config_customizeZoomInTime);
+        final int fadeDuration = toAllApps ?
+                res.getInteger(R.integer.config_allAppsFadeInTime) :
+                res.getInteger(R.integer.config_customizeFadeInTime);
 
         final float scale = toAllApps ?
                 (float) res.getInteger(R.integer.config_allAppsZoomScaleFactor) :
@@ -2768,7 +2771,7 @@
 
             if (toAllApps) {
                 toView.setFastAlpha(0f);
-                ValueAnimator alphaAnim = ValueAnimator.ofFloat(0f, 1f).setDuration(duration);
+                ValueAnimator alphaAnim = ValueAnimator.ofFloat(0f, 1f).setDuration(fadeDuration);
                 alphaAnim.setInterpolator(new DecelerateInterpolator(1.5f));
                 alphaAnim.addUpdateListener(new AnimatorUpdateListener() {
                     public void onAnimationUpdate(ValueAnimator animation) {
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index b1dd088..263aaad 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -114,6 +114,7 @@
     private ValueAnimator mBackgroundFadeOutAnimation;
     private Drawable mBackground;
     private Drawable mCustomizeTrayBackground;
+    boolean mDrawBackground;
     private boolean mDrawCustomizeTrayBackground;
     private float mBackgroundAlpha = 0;
     private float mOverScrollMaxBackgroundAlpha = 0.0f;
@@ -125,6 +126,7 @@
     private float[] mCustomizationDrawerTransformedPos = new float[2];
 
     private final WallpaperManager mWallpaperManager;
+    private IBinder mWindowToken;
 
     private int mDefaultPage;
 
@@ -785,9 +787,8 @@
             updateNow = keepUpdating = mWallpaperOffset.computeScrollOffset();
         }
         if (updateNow) {
-            IBinder token = getWindowToken();
-            if (token != null) {
-                mWallpaperManager.setWallpaperOffsets(getWindowToken(),
+            if (mWindowToken != null) {
+                mWallpaperManager.setWallpaperOffsets(mWindowToken,
                         mWallpaperOffset.getCurrX(), mWallpaperOffset.getCurrY());
             }
         }
@@ -954,6 +955,13 @@
         return mChildrenOutlineAlpha;
     }
 
+    void disableBackground() {
+        mDrawBackground = false;
+    }
+    void enableBackground() {
+        mDrawBackground = true;
+    }
+
     private void showBackgroundGradientForAllApps() {
         showBackgroundGradient();
         mDrawCustomizeTrayBackground = false;
@@ -995,8 +1003,10 @@
     }
 
     public void setBackgroundAlpha(float alpha) {
-        mBackgroundAlpha = alpha;
-        invalidate();
+        if (alpha != mBackgroundAlpha) {
+            mBackgroundAlpha = alpha;
+            invalidate();
+        }
     }
 
     public float getBackgroundAlpha() {
@@ -1090,8 +1100,13 @@
 
     protected void onAttachedToWindow() {
         super.onAttachedToWindow();
+        mWindowToken = getWindowToken();
         computeScroll();
-        mDragController.setWindowToken(getWindowToken());
+        mDragController.setWindowToken(mWindowToken);
+    }
+
+    protected void onDetachedFromWindow() {
+        mWindowToken = null;
     }
 
     @Override
@@ -1126,7 +1141,7 @@
         updateWallpaperOffsets();
 
         // Draw the background gradient if necessary
-        if (mBackground != null && mBackgroundAlpha > 0.0f) {
+        if (mBackground != null && mBackgroundAlpha > 0.0f && mDrawBackground) {
             int alpha = (int) (mBackgroundAlpha * 255);
             if (mDrawCustomizeTrayBackground) {
                 // Find out where to offset the gradient for the customization tray content