From 18f41f8327860d7e257d063888d08b6b5c528fe9 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Wed, 9 May 2012 13:28:10 -0700 Subject: [PATCH] More work to ensure that the wallpaper is visible before transitions take place. (Bug 6445085) Change-Id: Ic8435ba946949674a986aa4eaa879d33044c7884 --- .../launcher2/AppsCustomizePagedView.java | 4 +++ src/com/android/launcher2/Launcher.java | 29 +++++++++++++++---- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java index 5bd0ac655a..54af0803ef 100644 --- a/src/com/android/launcher2/AppsCustomizePagedView.java +++ b/src/com/android/launcher2/AppsCustomizePagedView.java @@ -524,6 +524,10 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen mPressedIcon.lockDrawableState(); } + // 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. + mLauncher.updateWallpaperVisibility(true); mLauncher.startActivitySafely(v, appInfo.intent, appInfo); } else if (v instanceof PagedViewWidget) { diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index 0bb119b315..74ec6f3b5e 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -1204,12 +1204,7 @@ public final class Launcher extends Activity mWorkspace.post(new Runnable() { @Override public void run() { - if (mState == State.APPS_CUSTOMIZE) { - if (mAppsCustomizeTabHost != null && - !mAppsCustomizeTabHost.isTransitioning()) { - updateWallpaperVisibility(false); - } - } + disableWallpaperIfInAllApps(); } }); @@ -2191,6 +2186,16 @@ public final class Launcher extends Activity view.setPivotY(view.getHeight() / 2.0f); } + void disableWallpaperIfInAllApps() { + // Only disable it if we are in all apps + if (mState == State.APPS_CUSTOMIZE) { + if (mAppsCustomizeTabHost != null && + !mAppsCustomizeTabHost.isTransitioning()) { + updateWallpaperVisibility(false); + } + } + } + void updateWallpaperVisibility(boolean visible) { int wpflags = visible ? WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER : 0; int curflags = getWindow().getAttributes().flags @@ -2534,6 +2539,18 @@ public final class Launcher extends Activity } } + @Override + public void onWindowFocusChanged(boolean hasFocus) { + if (!hasFocus) { + // When another window occludes launcher (like the notification shade, or recents), + // ensure that we enable the wallpaper flag so that transitions are done correctly. + updateWallpaperVisibility(true); + } else { + // When launcher has focus again, disable the wallpaper if we are in AllApps + disableWallpaperIfInAllApps(); + } + } + void showWorkspace(boolean animated) { showWorkspace(animated, null); }