Keying off the Launcher state to determine wallpaper visibility (Bug 6396752)

Change-Id: I00c457d9c07113bf8ff4c7102e486efcb030ddc4
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 0d4b0d0..ff8e785 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -1180,6 +1180,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;
                     }