Merge "Adding workaround to allow shortcuts to skip the launch animation. (Bug 6447372)" into jb-dev
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/CellLayout.java b/src/com/android/launcher2/CellLayout.java
index 6f4759d..ba20a76 100644
--- a/src/com/android/launcher2/CellLayout.java
+++ b/src/com/android/launcher2/CellLayout.java
@@ -160,6 +160,9 @@
     private static final int INVALID_DIRECTION = -100;
     private DropTarget.DragEnforcer mDragEnforcer;
 
+    private final static PorterDuffXfermode sAddBlendMode =
+            new PorterDuffXfermode(PorterDuff.Mode.ADD);
+
     public CellLayout(Context context) {
         this(context, null);
     }
@@ -506,7 +509,7 @@
         if (mForegroundAlpha > 0) {
             mOverScrollForegroundDrawable.setBounds(mForegroundRect);
             Paint p = ((NinePatchDrawable) mOverScrollForegroundDrawable).getPaint();
-            p.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.ADD));
+            p.setXfermode(sAddBlendMode);
             mOverScrollForegroundDrawable.draw(canvas);
             p.setXfermode(null);
         }
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index ce855a1..8b6fee9 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -1182,6 +1182,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;
                     }
diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java
index ff4abc6..bae4c56 100644
--- a/src/com/android/launcher2/LauncherModel.java
+++ b/src/com/android/launcher2/LauncherModel.java
@@ -1684,7 +1684,7 @@
         for (ItemInfo i : sWorkspaceItems) {
             if (i instanceof ShortcutInfo) {
                 ShortcutInfo info = (ShortcutInfo) i;
-                if (info.intent.getPackage().equals(packageName)) {
+                if (info.intent.getComponent().getPackageName().equals(packageName)) {
                     infos.add(info);
                 }
             }
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index e946095..456224f 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -3708,7 +3708,7 @@
                         for (String intentStr : newApps) {
                             try {
                                 Intent intent = Intent.parseUri(intentStr, 0);
-                                if (packageNames.contains(intent.getPackage())) {
+                                if (packageNames.contains(intent.getComponent().getPackageName())) {
                                     newApps.remove(intentStr);
                                 }
                             } catch (URISyntaxException e) {}