From 6136b7ef169a65a02a6660be636fcec370c68145 Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Fri, 18 Sep 2009 01:53:49 -0700 Subject: [PATCH] Show the live wallpaper on the lock screen. This also takes care of the problem of system dialogs like the crash dialog causing the status bar to dim behind the lock screen. On the down side, the fade transition from the lock screen is now gone, and I'm not sure how likely it is for it to return. Change-Id: I7f9e6d0f3510a1fdbbe6ad252d986bd85a16475d --- .../android/view/WindowManagerPolicy.java | 6 +++ core/res/res/anim/dialog_enter.xml | 2 +- core/res/res/anim/dialog_exit.xml | 2 +- core/res/res/anim/recent_enter.xml | 28 +++++++++++ core/res/res/anim/recent_exit.xml | 29 ++++++++++++ core/res/res/values/styles.xml | 7 +++ core/res/res/values/themes.xml | 6 +++ .../android/server/WindowManagerService.java | 46 +++++++++++++++---- 8 files changed, 114 insertions(+), 12 deletions(-) create mode 100644 core/res/res/anim/recent_enter.xml create mode 100644 core/res/res/anim/recent_exit.xml diff --git a/core/java/android/view/WindowManagerPolicy.java b/core/java/android/view/WindowManagerPolicy.java index bd38b2dca2a35..45ff27e838487 100644 --- a/core/java/android/view/WindowManagerPolicy.java +++ b/core/java/android/view/WindowManagerPolicy.java @@ -435,6 +435,12 @@ public interface WindowManagerPolicy { */ public int subWindowTypeToLayerLw(int type); + /** + * Get the highest layer (actually one more than) that the wallpaper is + * allowed to be in. + */ + public int getMaxWallpaperLayer(); + /** * Called when the system would like to show a UI to indicate that an * application is starting. You can use this to add a diff --git a/core/res/res/anim/dialog_enter.xml b/core/res/res/anim/dialog_enter.xml index cc409e8f5a05b..167f4bce4a9df 100644 --- a/core/res/res/anim/dialog_enter.xml +++ b/core/res/res/anim/dialog_enter.xml @@ -22,7 +22,7 @@ android:interpolator="@anim/decelerate_interpolator"> diff --git a/core/res/res/anim/dialog_exit.xml b/core/res/res/anim/dialog_exit.xml index 8bf808247b6ae..d412cfb1291f9 100644 --- a/core/res/res/anim/dialog_exit.xml +++ b/core/res/res/anim/dialog_exit.xml @@ -21,7 +21,7 @@ android:interpolator="@anim/accelerate_interpolator"> diff --git a/core/res/res/anim/recent_enter.xml b/core/res/res/anim/recent_enter.xml new file mode 100644 index 0000000000000..deeb96b9dcb0b --- /dev/null +++ b/core/res/res/anim/recent_enter.xml @@ -0,0 +1,28 @@ + + + + + + + diff --git a/core/res/res/anim/recent_exit.xml b/core/res/res/anim/recent_exit.xml new file mode 100644 index 0000000000000..fed701409e668 --- /dev/null +++ b/core/res/res/anim/recent_exit.xml @@ -0,0 +1,29 @@ + + + + + + + diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml index 69612e9ce2499..35db8eed78b7d 100644 --- a/core/res/res/values/styles.xml +++ b/core/res/res/values/styles.xml @@ -177,6 +177,13 @@ @anim/wallpaper_exit + + + + + + + diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java index d53f00242f189..0cd59494c7565 100644 --- a/services/java/com/android/server/WindowManagerService.java +++ b/services/java/com/android/server/WindowManagerService.java @@ -1384,12 +1384,18 @@ public class WindowManagerService extends IWindowManager.Stub (mLowerWallpaperTarget == null && foundW.mAppToken != null) ? foundW.mAppToken.animLayerAdjustment : 0; + final int maxLayer = mPolicy.getMaxWallpaperLayer() + * TYPE_LAYER_MULTIPLIER + + TYPE_LAYER_OFFSET; + // Now w is the window we are supposed to be behind... but we // need to be sure to also be behind any of its attached windows, - // AND any starting window associated with it. + // AND any starting window associated with it, AND below the + // maximum layer the policy allows for wallpapers. while (foundI > 0) { WindowState wb = (WindowState)localmWindows.get(foundI-1); - if (wb.mAttachedWindow != foundW && + if (wb.mBaseLayer < maxLayer && + wb.mAttachedWindow != foundW && (wb.mAttrs.type != TYPE_APPLICATION_STARTING || wb.mToken != foundW.mToken)) { // This window is not related to the previous one in any @@ -2266,6 +2272,12 @@ public class WindowManagerService extends IWindowManager.Stub // Currently in a hide animation... turn this into // an exit. win.mExiting = true; + } else if (win == mWallpaperTarget) { + // If the wallpaper is currently behind this + // window, we need to change both of them inside + // of a transaction to avoid artifacts. + win.mExiting = true; + win.mAnimating = true; } else { if (mInputMethodWindow == win) { mInputMethodWindow = null; @@ -3157,6 +3169,10 @@ public class WindowManagerService extends IWindowManager.Stub com.android.internal.R.styleable.Window_windowIsTranslucent, false)) { return; } + if (ent.array.getBoolean( + com.android.internal.R.styleable.Window_windowIsFloating, false)) { + return; + } if (ent.array.getBoolean( com.android.internal.R.styleable.Window_windowShowWallpaper, false)) { return; @@ -7087,8 +7103,8 @@ public class WindowManagerService extends IWindowManager.Stub mAppToken.firstWindowDrawn = true; if (mAppToken.startingData != null) { - if (DEBUG_STARTING_WINDOW) Log.v(TAG, "Finish starting " - + mToken + if (DEBUG_STARTING_WINDOW || DEBUG_ANIM) Log.v(TAG, + "Finish starting " + mToken + ": first real window is shown, no animation"); // If this initial window is animating, stop it -- we // will do an animation to reveal it from behind the @@ -7305,13 +7321,13 @@ public class WindowManagerService extends IWindowManager.Stub // Compute the desired transformation. tmpMatrix.setTranslate(frame.left, frame.top); if (selfTransformation) { - tmpMatrix.preConcat(mTransformation.getMatrix()); + tmpMatrix.postConcat(mTransformation.getMatrix()); } if (attachedTransformation != null) { - tmpMatrix.preConcat(attachedTransformation.getMatrix()); + tmpMatrix.postConcat(attachedTransformation.getMatrix()); } if (appTransformation != null) { - tmpMatrix.preConcat(appTransformation.getMatrix()); + tmpMatrix.postConcat(appTransformation.getMatrix()); } // "convert" it into SurfaceFlinger's format @@ -8928,11 +8944,14 @@ public class WindowManagerService extends IWindowManager.Stub wallpaperMayChange = true; } } + boolean wasAnimating = w.mAnimating; if (w.stepAnimationLocked(currentTime, dw, dh)) { animating = true; //w.dump(" "); } - + if (wasAnimating && !w.mAnimating && mWallpaperTarget == w) { + wallpaperMayChange = true; + } mPolicy.animatingWindowLw(w, attrs); } @@ -9269,6 +9288,7 @@ public class WindowManagerService extends IWindowManager.Stub boolean covered = false; boolean syswin = false; boolean backgroundFillerShown = false; + boolean forceHiding = false; final int N = mWindows.size(); @@ -9401,7 +9421,10 @@ public class WindowManagerService extends IWindowManager.Stub } } - if (w.mAttachedHidden) { + if ((forceHiding + && attrs.type != WindowManager.LayoutParams.TYPE_STATUS_BAR + && attrs.type != WindowManager.LayoutParams.TYPE_WALLPAPER) + || w.mAttachedHidden) { if (!w.mLastHidden) { //dump(); w.mLastHidden = true; @@ -9515,6 +9538,9 @@ public class WindowManagerService extends IWindowManager.Stub } if (displayed) { + if (attrs.type == WindowManager.LayoutParams.TYPE_KEYGUARD) { + forceHiding = true; + } if (!covered) { if (attrs.width == LayoutParams.FILL_PARENT && attrs.height == LayoutParams.FILL_PARENT) { @@ -9597,7 +9623,7 @@ public class WindowManagerService extends IWindowManager.Stub } backgroundFillerShown = true; mBackgroundFillerShown = true; - } else if (canBeSeen && !obscured && + } else if (canBeSeen && !obscured && !forceHiding && (attrFlags&FLAG_BLUR_BEHIND|FLAG_DIM_BEHIND) != 0) { if (localLOGV) Log.v(TAG, "Win " + w + ": blurring=" + blurring