Merge "DO NOT MERGE Pass focusableMode when adding focusables from PagedView." into jb-dev
diff --git a/res/layout-port/launcher.xml b/res/layout-port/launcher.xml
index 34301a3..f60a204 100644
--- a/res/layout-port/launcher.xml
+++ b/res/layout-port/launcher.xml
@@ -80,6 +80,7 @@
         android:layout_gravity="right"
         android:clickable="true"
         android:onClick="onClickVoiceButton"
+        android:importantForAccessibility="no"
         launcher:sourceViewId="@+id/voice_button" />
 
     <include layout="@layout/apps_customize_pane"
diff --git a/res/values-ja/strings.xml b/res/values-ja/strings.xml
index 6fa6b28..0fc144d 100644
--- a/res/values-ja/strings.xml
+++ b/res/values-ja/strings.xml
@@ -20,7 +20,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="application_name" msgid="8424725141379931883">"ランチャー"</string>
-    <string name="home" msgid="5921706419368316758">"ホーム"</string>
+    <string name="home" msgid="5921706419368316758">"Home"</string>
     <string name="uid_name" msgid="3371120195364560632">"Android Core Apps"</string>
     <string name="folder_name" msgid="8551881338202938211"></string>
     <string name="chooser_wallpaper" msgid="6063168087625352235">"壁紙の選択"</string>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index d9fbba2..1416d40 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -213,10 +213,13 @@
     <!-- Accessibility -->
     <skip />
 
+    <!-- The format string for Workspace descriptions [CHAR_LIMIT=none] -->
+    <string name="workspace_description_format">Home screen %1$d</string>
+
     <!-- The format string for default page scroll text [CHAR_LIMIT=none] -->
     <string name="default_scroll_format">Page %1$d of %2$d</string>
     <!-- The format string for Workspace page scroll text [CHAR_LIMIT=none] -->
-    <string name="workspace_scroll_format">Workspace %1$d of %2$d</string>
+    <string name="workspace_scroll_format">Home screen %1$d of %2$d</string>
     <!-- The format string for AppsCustomize Apps page scroll text [CHAR_LIMIT=none] -->
     <string name="apps_customize_apps_scroll_format">Apps page %1$d of %2$d</string>
     <!-- The format string for AppsCustomize Apps page scroll text [CHAR_LIMIT=none] -->
diff --git a/src/com/android/launcher2/ApplicationInfo.java b/src/com/android/launcher2/ApplicationInfo.java
index 1fc1d1f..281d59c 100644
--- a/src/com/android/launcher2/ApplicationInfo.java
+++ b/src/com/android/launcher2/ApplicationInfo.java
@@ -102,6 +102,12 @@
         firstInstallTime = info.firstInstallTime;
     }
 
+    /** Returns the package name that the shortcut's intent will resolve to, or an empty string if
+     *  none exists. */
+    String getPackageName() {
+        return super.getPackageName(intent);
+    }
+
     /**
      * Creates the application intent based on a component name and various launch flags.
      * Sets {@link #itemType} to {@link LauncherSettings.BaseLauncherColumns#ITEM_TYPE_APPLICATION}.
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index fe9334b..5bd0ac6 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -524,10 +524,6 @@
                 mPressedIcon.lockDrawableState();
             }
 
-            // NOTE: we need to re-enable the wallpaper visibility if we want correct transitions
-            // between items that are launched from the workspace and all apps.  It will be disabled
-            // correctly the next time the window is visible in AppsCustomizeTabHost.
-            mLauncher.updateWallpaperVisibility(true);
             mLauncher.startActivitySafely(v, appInfo.intent, appInfo);
 
         } else if (v instanceof PagedViewWidget) {
diff --git a/src/com/android/launcher2/AppsCustomizeTabHost.java b/src/com/android/launcher2/AppsCustomizeTabHost.java
index 7a2c247..d3afc3b 100644
--- a/src/com/android/launcher2/AppsCustomizeTabHost.java
+++ b/src/com/android/launcher2/AppsCustomizeTabHost.java
@@ -471,17 +471,6 @@
             // Load the current page synchronously, and the neighboring pages asynchronously
             mAppsCustomizePane.loadAssociatedPages(mAppsCustomizePane.getCurrentPage(), true);
             mAppsCustomizePane.loadAssociatedPages(mAppsCustomizePane.getCurrentPage());
-
-            // We had to enable the wallpaper visibility when launching apps from all apps (so that
-            // the transitions would be the same as when launching from workspace) so we need to
-            // re-disable the wallpaper visibility to ensure performance.
-            int duration = getResources().getInteger(android.R.integer.config_shortAnimTime);
-            postDelayed(new Runnable() {
-                @Override
-                public void run() {
-                    mLauncher.updateWallpaperVisibility(false);
-                }
-            }, duration);
         }
     }
 
diff --git a/src/com/android/launcher2/DragController.java b/src/com/android/launcher2/DragController.java
index b9d7dd4..b4b20c6 100644
--- a/src/com/android/launcher2/DragController.java
+++ b/src/com/android/launcher2/DragController.java
@@ -381,8 +381,8 @@
                     if (dragInfo != null &&
                         dragInfo.intent != null &&
                         info.intent != null) {
-                        boolean isSamePackage = dragInfo.intent.getPackage().equals(
-                                info.intent.getPackage());
+                        boolean isSamePackage = dragInfo.getPackageName().equals(
+                                info.getPackageName());
                         if (isSamePackage) {
                             cancelDrag();
                             return;
diff --git a/src/com/android/launcher2/Folder.java b/src/com/android/launcher2/Folder.java
index 0389264..f63e9bc 100644
--- a/src/com/android/launcher2/Folder.java
+++ b/src/com/android/launcher2/Folder.java
@@ -200,6 +200,9 @@
     }
 
     public boolean onLongClick(View v) {
+        // Return if global dragging is not enabled
+        if (!mLauncher.isDraggingEnabled()) return true;
+
         Object tag = v.getTag();
         if (tag instanceof ShortcutInfo) {
             ShortcutInfo item = (ShortcutInfo) tag;
diff --git a/src/com/android/launcher2/ItemInfo.java b/src/com/android/launcher2/ItemInfo.java
index 11a6c0d..d34b87e 100644
--- a/src/com/android/launcher2/ItemInfo.java
+++ b/src/com/android/launcher2/ItemInfo.java
@@ -16,13 +16,14 @@
 
 package com.android.launcher2;
 
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
 import android.content.ContentValues;
+import android.content.Intent;
 import android.graphics.Bitmap;
 import android.util.Log;
 
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
 /**
  * Represents an item in the launcher.
  */
@@ -109,6 +110,21 @@
         container = info.container;
     }
 
+    /** Returns the package name that the intent will resolve to, or an empty string if
+     *  none exists. */
+    static String getPackageName(Intent intent) {
+        if (intent != null) {
+            String packageName = intent.getPackage();
+            if (packageName == null) {
+                packageName = intent.getComponent().getPackageName();
+            }
+            if (packageName != null) {
+                return packageName;
+            }
+        }
+        return "";
+    }
+
     /**
      * Write the fields of this item to the DB
      * 
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 0d4b0d0..d0f4b86 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -33,8 +33,6 @@
 import android.appwidget.AppWidgetProviderInfo;
 import android.content.ActivityNotFoundException;
 import android.content.BroadcastReceiver;
-import android.content.ClipData;
-import android.content.ClipDescription;
 import android.content.ComponentCallbacks2;
 import android.content.ComponentName;
 import android.content.ContentResolver;
@@ -144,6 +142,10 @@
     private static final String PREFERENCES = "launcher.preferences";
     static final String FORCE_ENABLE_ROTATION_PROPERTY = "launcher.force_enable_rotation";
 
+    // The Intent extra that defines whether to ignore the launch animation
+    static final String INTENT_EXTRA_IGNORE_LAUNCH_ANIMATION =
+            "com.android.launcher.intent.extra.shortcut.INGORE_LAUNCH_ANIMATION";
+
     // Type: int
     private static final String RUNTIME_STATE_CURRENT_SCREEN = "launcher.current_screen";
     // Type: int
@@ -494,6 +496,12 @@
         return mDragLayer;
     }
 
+    boolean isDraggingEnabled() {
+        // We prevent dragging when we are loading the workspace as it is possible to pick up a view
+        // that is subsequently removed from the workspace in startBinding().
+        return !mModel.isLoadingWorkspace();
+    }
+
     static int getScreen() {
         synchronized (sLock) {
             return sScreen;
@@ -663,6 +671,11 @@
 
     @Override
     protected void onPause() {
+        // NOTE: We want all transitions from launcher to act as if the wallpaper were enabled
+        // to be consistent.  So re-enable the flag here, and we will re-disable it as necessary
+        // when Launcher resumes and we are still in AllApps.
+        updateWallpaperVisibility(true);
+
         super.onPause();
         mPaused = true;
         mDragController.cancelDrag();
@@ -1180,6 +1193,23 @@
                         // currently shown, because doing that may involve
                         // some communication back with the app.
                         mWorkspace.postDelayed(mBuildLayersRunnable, 500);
+
+                        // We had to enable the wallpaper visibility when launching apps from all
+                        // apps (so that the transitions would be the same as when launching from
+                        // workspace) so take this time to see if we need to re-disable the
+                        // wallpaper visibility to ensure performance.
+                        mWorkspace.post(new Runnable() {
+                            @Override
+                            public void run() {
+                                if (mState == State.APPS_CUSTOMIZE) {
+                                    if (mAppsCustomizeTabHost != null &&
+                                            !mAppsCustomizeTabHost.isTransitioning()) {
+                                        updateWallpaperVisibility(false);
+                                    }
+                                }
+                            }
+                        });
+
                         observer.removeOnPreDrawListener(this);
                         return true;
                     }
@@ -1890,7 +1920,11 @@
         intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
 
         try {
-            if (v != null) {
+            // Only launch using the new animation if the shortcut has not opted out (this is a
+            // private contract between launcher and may be ignored in the future).
+            boolean useLaunchAnimation = (v != null) &&
+                    !intent.hasExtra(INTENT_EXTRA_IGNORE_LAUNCH_ANIMATION);
+            if (useLaunchAnimation) {
                 ActivityOptions opts = ActivityOptions.makeScaleUpAnimation(v, 0, 0,
                         v.getMeasuredWidth(), v.getMeasuredHeight());
 
@@ -2054,14 +2088,9 @@
     }
 
     public boolean onLongClick(View v) {
-
-        if (mState != State.WORKSPACE) {
-            return false;
-        }
-
-        if (isWorkspaceLocked()) {
-            return false;
-        }
+        if (!isDraggingEnabled()) return false;
+        if (isWorkspaceLocked()) return false;
+        if (mState != State.WORKSPACE) return false;
 
         if (!(v instanceof CellLayout)) {
             v = (View) v.getParent().getParent();
@@ -2808,7 +2837,9 @@
             if (voiceButtonContainer != null) voiceButtonContainer.setVisibility(View.GONE);
             searchButton.setVisibility(View.GONE);
             voiceButton.setVisibility(View.GONE);
-            voiceButtonProxy.setVisibility(View.GONE);
+            if (voiceButtonProxy != null) {
+                voiceButtonProxy.setVisibility(View.GONE);
+            }
             return false;
         }
     }
diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java
index ff4abc6..bc88a98 100644
--- a/src/com/android/launcher2/LauncherModel.java
+++ b/src/com/android/launcher2/LauncherModel.java
@@ -745,6 +745,15 @@
         return mAllAppsLoaded;
     }
 
+    boolean isLoadingWorkspace() {
+        synchronized (mLock) {
+            if (mLoaderTask != null) {
+                return mLoaderTask.isLoadingWorkspace();
+            }
+        }
+        return false;
+    }
+
     /**
      * Runnable for the thread that loads the contents of the launcher:
      *   - workspace icons
@@ -755,6 +764,7 @@
         private Context mContext;
         private Thread mWaitThread;
         private boolean mIsLaunching;
+        private boolean mIsLoadingAndBindingWorkspace;
         private boolean mStopped;
         private boolean mLoadAndBindStepFinished;
         private HashMap<Object, CharSequence> mLabelCache;
@@ -769,7 +779,13 @@
             return mIsLaunching;
         }
 
+        boolean isLoadingWorkspace() {
+            return mIsLoadingAndBindingWorkspace;
+        }
+
         private void loadAndBindWorkspace() {
+            mIsLoadingAndBindingWorkspace = true;
+
             // Load the workspace
             if (DEBUG_LOADERS) {
                 Log.d(TAG, "loadAndBindWorkspace mWorkspaceLoaded=" + mWorkspaceLoaded);
@@ -1374,13 +1390,16 @@
                     }
                 }
             });
-            // If we're profiling, this is the last thing in the queue.
+            // Cleanup
             mHandler.post(new Runnable() {
                 public void run() {
+                    // If we're profiling, ensure this is the last thing in the queue.
                     if (DEBUG_LOADERS) {
                         Log.d(TAG, "bound workspace in "
                             + (SystemClock.uptimeMillis()-t) + "ms");
                     }
+
+                    mIsLoadingAndBindingWorkspace = false;
                 }
             });
         }
@@ -1684,7 +1703,7 @@
         for (ItemInfo i : sWorkspaceItems) {
             if (i instanceof ShortcutInfo) {
                 ShortcutInfo info = (ShortcutInfo) i;
-                if (info.intent.getPackage().equals(packageName)) {
+                if (packageName.equals(info.getPackageName())) {
                     infos.add(info);
                 }
             }
diff --git a/src/com/android/launcher2/LauncherProvider.java b/src/com/android/launcher2/LauncherProvider.java
index 5e572a5..4cf87d2 100644
--- a/src/com/android/launcher2/LauncherProvider.java
+++ b/src/com/android/launcher2/LauncherProvider.java
@@ -66,7 +66,7 @@
 
     private static final String DATABASE_NAME = "launcher.db";
 
-    private static final int DATABASE_VERSION = 10;
+    private static final int DATABASE_VERSION = 11;
 
     static final String AUTHORITY = "com.android.launcher2.settings";
 
@@ -477,12 +477,14 @@
                 version = 9;
             }
 
-            if (version < 10) {
+            // We bumped the version twice during JB, once to update the launch flags, and once to
+            // update the override for the default launch animation.
+            if (version < 11) {
                 // Contact shortcuts need a different set of flags to be launched now
                 // The updateContactsShortcuts change is idempotent, so we can keep using it like
                 // back in the Donut days
                 updateContactsShortcuts(db);
-                version = 10;
+                version = 11;
             }
 
             if (version != DATABASE_VERSION) {
@@ -535,7 +537,8 @@
                                     // detail activities.
                                     newIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
                                             Intent.FLAG_ACTIVITY_CLEAR_TASK);
-
+                                    newIntent.putExtra(
+                                            Launcher.INTENT_EXTRA_IGNORE_LAUNCH_ANIMATION, true);
                                     newIntent.setData(uri);
 
                                     final ContentValues values = new ContentValues();
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index a5539db..a3080a8 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -627,7 +627,9 @@
         if (isScrollingIndicatorEnabled()) {
             updateScrollingIndicator();
         }
-        if (mFadeInAdjacentScreens) {
+        boolean isInOverscroll = mOverScrollX < 0 || mOverScrollX > mMaxScrollX;
+
+        if (mFadeInAdjacentScreens && !isInOverscroll) {
             for (int i = 0; i < getChildCount(); i++) {
                 View child = getChildAt(i);
                 if (child != null) {
diff --git a/src/com/android/launcher2/PagedViewWithDraggableItems.java b/src/com/android/launcher2/PagedViewWithDraggableItems.java
index a047970..22fd82b 100644
--- a/src/com/android/launcher2/PagedViewWithDraggableItems.java
+++ b/src/com/android/launcher2/PagedViewWithDraggableItems.java
@@ -107,6 +107,8 @@
         // When we have exited all apps or are in transition, disregard long clicks
         if (!mLauncher.isAllAppsCustomizeOpen() ||
                 mLauncher.getWorkspace().isSwitchingState()) return false;
+        // Return if global dragging is not enabled
+        if (!mLauncher.isDraggingEnabled()) return false;
 
         return beginDragging(v);
     }
diff --git a/src/com/android/launcher2/ShortcutInfo.java b/src/com/android/launcher2/ShortcutInfo.java
index 76892db..533059f 100644
--- a/src/com/android/launcher2/ShortcutInfo.java
+++ b/src/com/android/launcher2/ShortcutInfo.java
@@ -98,6 +98,12 @@
         return mIcon;
     }
 
+    /** Returns the package name that the shortcut's intent will resolve to, or an empty string if
+     *  none exists. */
+    String getPackageName() {
+        return super.getPackageName(intent);
+    }
+
     public void updateIcon(IconCache iconCache) {
         mIcon = iconCache.getIcon(intent);
         usingFallbackIcon = iconCache.isDefaultIcon(mIcon);
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index e946095..f0d3395 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -182,6 +182,7 @@
     private float mOverscrollFade = 0;
     private boolean mOverscrollTransformsSet;
     public static final int DRAG_BITMAP_PADDING = 2;
+    private boolean mWorkspaceFadeInAdjacentScreens;
 
     // Camera and Matrix used to determine the final position of a neighboring CellLayout
     private final Matrix mMatrix = new Matrix();
@@ -247,7 +248,6 @@
     private float[] mOldScaleXs;
     private float[] mOldScaleYs;
     private float[] mOldBackgroundAlphas;
-    private float[] mOldBackgroundAlphaMultipliers;
     private float[] mOldAlphas;
     private float[] mOldRotationYs;
     private float[] mNewTranslationXs;
@@ -255,7 +255,6 @@
     private float[] mNewScaleXs;
     private float[] mNewScaleYs;
     private float[] mNewBackgroundAlphas;
-    private float[] mNewBackgroundAlphaMultipliers;
     private float[] mNewAlphas;
     private float[] mNewRotationYs;
     private float mTransitionProgress;
@@ -286,7 +285,8 @@
         setDataIsReady();
 
         final Resources res = getResources();
-        mFadeInAdjacentScreens = res.getBoolean(R.bool.config_workspaceFadeAdjacentScreens);
+        mWorkspaceFadeInAdjacentScreens = res.getBoolean(R.bool.config_workspaceFadeAdjacentScreens);
+        mFadeInAdjacentScreens = false;
         mWallpaperManager = WallpaperManager.getInstance(context);
 
         int cellCountX = DEFAULT_CELL_COUNT_X;
@@ -442,6 +442,8 @@
         cl.setOnInterceptTouchListener(this);
         cl.setClickable(true);
         cl.enableHardwareLayers();
+        cl.setContentDescription(getContext().getString(
+                R.string.workspace_description_format, getChildCount()));
     }
 
     @Override
@@ -721,7 +723,7 @@
 
         // If we are not fading in adjacent screens, we still need to restore the alpha in case the
         // user scrolls while we are transitioning (should not affect dispatchDraw optimizations)
-        if (!mFadeInAdjacentScreens) {
+        if (!mWorkspaceFadeInAdjacentScreens) {
             for (int i = 0; i < getChildCount(); ++i) {
                 ((CellLayout) getPageAt(i)).setShortcutAndWidgetAlpha(1f);
             }
@@ -1192,55 +1194,26 @@
         return Math.min(r / threshold, 1.0f);
     }
 
-    private void screenScrolledLargeUI(int screenCenter) {
-        if (isSwitchingState()) return;
-        boolean isInOverscroll = false;
-        for (int i = 0; i < getChildCount(); i++) {
-            CellLayout cl = (CellLayout) getChildAt(i);
-            if (cl != null) {
-                float scrollProgress = getScrollProgress(screenCenter, cl, i);
-                float rotation = WORKSPACE_ROTATION * scrollProgress;
-                float translationX = getOffsetXForRotation(rotation, cl.getWidth(), cl.getHeight());
+    @Override
+    protected void screenScrolled(int screenCenter) {
+        super.screenScrolled(screenCenter);
 
-                // If the current page (i) is being over scrolled, we use a different
-                // set of rules for setting the background alpha multiplier.
-                if (!isSmall()) {
-                    if ((mOverScrollX < 0 && i == 0) || (mOverScrollX > mMaxScrollX &&
-                            i == getChildCount() -1)) {
-                        isInOverscroll = true;
-                        rotation *= -1;
-                        cl.setBackgroundAlphaMultiplier(
-                                overScrollBackgroundAlphaInterpolator(Math.abs(scrollProgress)));
-                        mOverScrollPageIndex = i;
-                        cl.setOverScrollAmount(Math.abs(scrollProgress), i == 0);
-                        if (!mOverscrollTransformsSet) {
-                            mOverscrollTransformsSet = true;
-                            cl.setPivotX(cl.getMeasuredWidth() * (i == 0 ? 0.75f : 0.25f));
-                            cl.setPivotY(cl.getMeasuredHeight() * 0.5f);
-                            cl.setOverscrollTransformsDirty(true);
-                        }
-                    } else if (mOverScrollPageIndex != i) {
-                        cl.setBackgroundAlphaMultiplier(
-                                backgroundAlphaInterpolator(Math.abs(scrollProgress)));
-                    }
-                }
-                cl.setTranslationX(translationX);
-                cl.setRotationY(rotation);
-                if (mFadeInAdjacentScreens && !isSmall()) {
+        boolean isInOverscroll = mOverScrollX < 0 || mOverScrollX > mMaxScrollX;
+        if (mWorkspaceFadeInAdjacentScreens &&
+                mState == State.NORMAL &&
+                !mIsSwitchingState &&
+                !isInOverscroll) {
+            for (int i = 0; i < getChildCount(); i++) {
+                CellLayout child = (CellLayout) getChildAt(i);
+                if (child != null) {
+                    float scrollProgress = getScrollProgress(screenCenter, child, i);
                     float alpha = 1 - Math.abs(scrollProgress);
-                    cl.setShortcutAndWidgetAlpha(alpha);
+                    child.getShortcutsAndWidgets().setAlpha(alpha);
                 }
             }
+            invalidate();
         }
-        if (mOverscrollTransformsSet && !isInOverscroll) {
-            mOverscrollTransformsSet = false;
-            ((CellLayout) getChildAt(0)).resetOverscrollTransforms();
-            ((CellLayout) getChildAt(getChildCount() - 1)).resetOverscrollTransforms();
-        }
-        invalidate();
-    }
 
-    private void screenScrolledStandardUI(int screenCenter) {
         if (mOverScrollX < 0 || mOverScrollX > mMaxScrollX) {
             int index = mOverScrollX < 0 ? 0 : getChildCount() - 1;
             CellLayout cl = (CellLayout) getChildAt(index);
@@ -1269,24 +1242,8 @@
     }
 
     @Override
-    protected void screenScrolled(int screenCenter) {
-        if (LauncherApplication.isScreenLarge()) {
-            // We don't call super.screenScrolled() here because we handle the adjacent pages alpha
-            // ourselves (for efficiency), and there are no scrolling indicators to update.
-            screenScrolledLargeUI(screenCenter);
-        } else {
-            super.screenScrolled(screenCenter);
-            screenScrolledStandardUI(screenCenter);
-        }
-    }
-
-    @Override
     protected void overScroll(float amount) {
-        if (LauncherApplication.isScreenLarge()) {
-            dampedOverScroll(amount);
-        } else {
-            acceleratedOverScroll(amount);
-        }
+        acceleratedOverScroll(amount);
     }
 
     protected void onAttachedToWindow() {
@@ -1519,7 +1476,6 @@
         mOldScaleXs = new float[childCount];
         mOldScaleYs = new float[childCount];
         mOldBackgroundAlphas = new float[childCount];
-        mOldBackgroundAlphaMultipliers = new float[childCount];
         mOldAlphas = new float[childCount];
         mOldRotationYs = new float[childCount];
         mNewTranslationXs = new float[childCount];
@@ -1527,7 +1483,6 @@
         mNewScaleXs = new float[childCount];
         mNewScaleYs = new float[childCount];
         mNewBackgroundAlphas = new float[childCount];
-        mNewBackgroundAlphaMultipliers = new float[childCount];
         mNewAlphas = new float[childCount];
         mNewRotationYs = new float[childCount];
     }
@@ -1582,11 +1537,10 @@
                 getResources().getInteger(R.integer.config_appsCustomizeWorkspaceShrinkTime);
         for (int i = 0; i < getChildCount(); i++) {
             final CellLayout cl = (CellLayout) getChildAt(i);
-            float rotation = 0f;
-            float initialAlpha = cl.getAlpha();
-            float finalAlphaMultiplierValue = 1f;
-            float finalAlpha = (!mFadeInAdjacentScreens || stateIsSpringLoaded ||
+            float finalAlpha = (!mWorkspaceFadeInAdjacentScreens || stateIsSpringLoaded ||
                     (i == mCurrentPage)) ? 1f : 0f;
+            float currentAlpha = cl.getShortcutsAndWidgets().getAlpha();
+            float initialAlpha = currentAlpha;
 
             // Determine the pages alpha during the state transition
             if ((oldStateIsSmall && stateIsNormal) ||
@@ -1596,29 +1550,12 @@
                 //                     or, if we're in spring-loaded mode
                 if (i == mCurrentPage || !animated || oldStateIsSpringLoaded) {
                     finalAlpha = 1f;
-                    finalAlphaMultiplierValue = 0f;
                 } else {
                     initialAlpha = 0f;
                     finalAlpha = 0f;
                 }
             }
 
-            // Update the rotation of the screen (don't apply rotation on Phone UI)
-            if (LauncherApplication.isScreenLarge()) {
-                if (i < mCurrentPage) {
-                    rotation = WORKSPACE_ROTATION;
-                } else if (i > mCurrentPage) {
-                    rotation = -WORKSPACE_ROTATION;
-                }
-            }
-
-            // If the screen is not xlarge, then don't rotate the CellLayouts
-            // NOTE: If we don't update the side pages alpha, then we should not hide the side
-            //       pages. see unshrink().
-            if (LauncherApplication.isScreenLarge()) {
-                translationX = getOffsetXForRotation(rotation, cl.getWidth(), cl.getHeight());
-            }
-
             mOldAlphas[i] = initialAlpha;
             mNewAlphas[i] = finalAlpha;
             if (animated) {
@@ -1627,25 +1564,19 @@
                 mOldScaleXs[i] = cl.getScaleX();
                 mOldScaleYs[i] = cl.getScaleY();
                 mOldBackgroundAlphas[i] = cl.getBackgroundAlpha();
-                mOldBackgroundAlphaMultipliers[i] = cl.getBackgroundAlphaMultiplier();
-                mOldRotationYs[i] = cl.getRotationY();
 
                 mNewTranslationXs[i] = translationX;
                 mNewTranslationYs[i] = translationY;
                 mNewScaleXs[i] = finalScaleFactor;
                 mNewScaleYs[i] = finalScaleFactor;
                 mNewBackgroundAlphas[i] = finalBackgroundAlpha;
-                mNewBackgroundAlphaMultipliers[i] = finalAlphaMultiplierValue;
-                mNewRotationYs[i] = rotation;
             } else {
                 cl.setTranslationX(translationX);
                 cl.setTranslationY(translationY);
                 cl.setScaleX(finalScaleFactor);
                 cl.setScaleY(finalScaleFactor);
                 cl.setBackgroundAlpha(finalBackgroundAlpha);
-                cl.setBackgroundAlphaMultiplier(finalAlphaMultiplierValue);
                 cl.setShortcutAndWidgetAlpha(finalAlpha);
-                cl.setRotationY(rotation);
             }
         }
 
@@ -1653,13 +1584,13 @@
             for (int index = 0; index < getChildCount(); index++) {
                 final int i = index;
                 final CellLayout cl = (CellLayout) getChildAt(i);
+                float currentAlpha = cl.getShortcutsAndWidgets().getAlpha();
                 if (mOldAlphas[i] == 0 && mNewAlphas[i] == 0) {
                     cl.setTranslationX(mNewTranslationXs[i]);
                     cl.setTranslationY(mNewTranslationYs[i]);
                     cl.setScaleX(mNewScaleXs[i]);
                     cl.setScaleY(mNewScaleYs[i]);
                     cl.setBackgroundAlpha(mNewBackgroundAlphas[i]);
-                    cl.setBackgroundAlphaMultiplier(mNewBackgroundAlphaMultipliers[i]);
                     cl.setShortcutAndWidgetAlpha(mNewAlphas[i]);
                     cl.setRotationY(mNewRotationYs[i]);
                 } else {
@@ -1672,7 +1603,7 @@
                         .setInterpolator(mZoomInInterpolator);
                     anim.play(a);
 
-                    if (mOldAlphas[i] != mNewAlphas[i]) {
+                    if (mOldAlphas[i] != mNewAlphas[i] || currentAlpha != mNewAlphas[i]) {
                         LauncherViewPropertyAnimator alphaAnim =
                             new LauncherViewPropertyAnimator(cl.getShortcutsAndWidgets());
                         alphaAnim.alpha(mNewAlphas[i])
@@ -1680,20 +1611,8 @@
                             .setInterpolator(mZoomInInterpolator);
                         anim.play(alphaAnim);
                     }
-                    if (mOldRotationYs[i] != 0 || mNewRotationYs[i] != 0) {
-                        ValueAnimator rotate = ValueAnimator.ofFloat(0f, 1f).setDuration(duration);
-                        rotate.setInterpolator(new DecelerateInterpolator(2.0f));
-                        rotate.addUpdateListener(new LauncherAnimatorUpdateListener() {
-                                public void onAnimationUpdate(float a, float b) {
-                                    cl.setRotationY(a * mOldRotationYs[i] + b * mNewRotationYs[i]);
-                                }
-                            });
-                        anim.play(rotate);
-                    }
                     if (mOldBackgroundAlphas[i] != 0 ||
-                        mNewBackgroundAlphas[i] != 0 ||
-                        mOldBackgroundAlphaMultipliers[i] != 0 ||
-                        mNewBackgroundAlphaMultipliers[i] != 0) {
+                        mNewBackgroundAlphas[i] != 0) {
                         ValueAnimator bgAnim = ValueAnimator.ofFloat(0f, 1f).setDuration(duration);
                         bgAnim.setInterpolator(mZoomInInterpolator);
                         bgAnim.addUpdateListener(new LauncherAnimatorUpdateListener() {
@@ -1701,9 +1620,6 @@
                                     cl.setBackgroundAlpha(
                                             a * mOldBackgroundAlphas[i] +
                                             b * mNewBackgroundAlphas[i]);
-                                    cl.setBackgroundAlphaMultiplier(
-                                            a * mOldBackgroundAlphaMultipliers[i] +
-                                            b * mNewBackgroundAlphaMultipliers[i]);
                                 }
                             });
                         anim.play(bgAnim);
@@ -1751,7 +1667,7 @@
         // ensure that only the current page is visible during (and subsequently, after) the
         // transition animation.  If fade adjacent pages is disabled, then re-enable the page
         // visibility after the transition animation.
-        if (!mFadeInAdjacentScreens) {
+        if (!mWorkspaceFadeInAdjacentScreens) {
             for (int i = 0; i < getChildCount(); i++) {
                 final CellLayout cl = (CellLayout) getChildAt(i);
                 cl.setShortcutAndWidgetAlpha(1f);
@@ -3708,7 +3624,8 @@
                         for (String intentStr : newApps) {
                             try {
                                 Intent intent = Intent.parseUri(intentStr, 0);
-                                if (packageNames.contains(intent.getPackage())) {
+                                String pn = ItemInfo.getPackageName(intent);
+                                if (packageNames.contains(pn)) {
                                     newApps.remove(intentStr);
                                 }
                             } catch (URISyntaxException e) {}