summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2012-04-12 15:17:07 -0700
committerDianne Hackborn <hackbod@google.com>2012-04-12 15:26:11 -0700
commit0c2acffec8689f8721a454845b24a830bc37ce92 (patch)
tree5c4d68095376aabd3af04c4b7d2d78b9e9ea8c2b
parented4995d646252313323f648e44a9539d9384f901 (diff)
downloadframeworks_base-0c2acffec8689f8721a454845b24a830bc37ce92.zip
frameworks_base-0c2acffec8689f8721a454845b24a830bc37ce92.tar.gz
frameworks_base-0c2acffec8689f8721a454845b24a830bc37ce92.tar.bz2
Clean up lock screen hide animation.
We now have an animation to apply to the thing behind the lock screen animation when it isn't on the wallpaper, which looks similar to the animation we use when both are on the wallpaper. In implementing this, cleaned up the code to figure out up-front which animation to run, getting rid of that kludgy thing that cleared the window animation if the wallpaper was not being used for the lower windows. Change-Id: Ifc4c8a8894ad384124dcf4bbdaab134f1157b0f3
-rw-r--r--core/java/android/view/WindowManagerPolicy.java2
-rw-r--r--core/res/res/anim/lock_screen_behind_enter.xml4
-rw-r--r--core/res/res/anim/lock_screen_wallpaper_behind_enter.xml36
-rw-r--r--core/res/res/values/public.xml1
-rwxr-xr-xpolicy/src/com/android/internal/policy/impl/PhoneWindowManager.java7
-rw-r--r--services/java/com/android/server/wm/WindowAnimator.java28
-rw-r--r--services/java/com/android/server/wm/WindowManagerService.java22
7 files changed, 65 insertions, 35 deletions
diff --git a/core/java/android/view/WindowManagerPolicy.java b/core/java/android/view/WindowManagerPolicy.java
index 66bdc5d..27baaea 100644
--- a/core/java/android/view/WindowManagerPolicy.java
+++ b/core/java/android/view/WindowManagerPolicy.java
@@ -667,7 +667,7 @@ public interface WindowManagerPolicy {
/**
* Create and return an animation to re-display a force hidden window.
*/
- public Animation createForceHideEnterAnimation();
+ public Animation createForceHideEnterAnimation(boolean onWallpaper);
/**
* Called from the input reader thread before a key is enqueued.
diff --git a/core/res/res/anim/lock_screen_behind_enter.xml b/core/res/res/anim/lock_screen_behind_enter.xml
index 4f58be4..6b06456 100644
--- a/core/res/res/anim/lock_screen_behind_enter.xml
+++ b/core/res/res/anim/lock_screen_behind_enter.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
-** Copyright 2007, The Android Open Source Project
+** Copyright 2012, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@
-->
<set xmlns:android="http://schemas.android.com/apk/res/android"
- android:detachWallpaper="true" android:shareInterpolator="false">
+ android:background="#ff000000" android:shareInterpolator="false">
<scale
android:fromXScale="0.95" android:toXScale="1.0"
android:fromYScale="0.95" android:toYScale="1.0"
diff --git a/core/res/res/anim/lock_screen_wallpaper_behind_enter.xml b/core/res/res/anim/lock_screen_wallpaper_behind_enter.xml
new file mode 100644
index 0000000..a354fae
--- /dev/null
+++ b/core/res/res/anim/lock_screen_wallpaper_behind_enter.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2007, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+ android:detachWallpaper="true" android:shareInterpolator="false">
+ <scale
+ android:fromXScale="0.95" android:toXScale="1.0"
+ android:fromYScale="0.95" android:toYScale="1.0"
+ android:pivotX="50%p" android:pivotY="50%p"
+ android:fillEnabled="true" android:fillBefore="true"
+ android:interpolator="@interpolator/decelerate_cubic"
+ android:startOffset="@android:integer/config_shortAnimTime"
+ android:duration="@android:integer/config_shortAnimTime" />
+ <alpha
+ android:fromAlpha="0.0" android:toAlpha="1.0"
+ android:fillEnabled="true" android:fillBefore="true"
+ android:interpolator="@interpolator/decelerate_quad"
+ android:startOffset="@android:integer/config_shortAnimTime"
+ android:duration="@android:integer/config_shortAnimTime"/>
+</set>
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index aaef701..ad70c16 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -1133,6 +1133,7 @@
<!-- From android.policy -->
<java-symbol type="anim" name="app_starting_exit" />
<java-symbol type="anim" name="lock_screen_behind_enter" />
+ <java-symbol type="anim" name="lock_screen_wallpaper_behind_enter" />
<java-symbol type="anim" name="dock_top_enter" />
<java-symbol type="anim" name="dock_top_exit" />
<java-symbol type="anim" name="dock_bottom_enter" />
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index 9ff8ee3..0a63840 100755
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -1628,9 +1628,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
return 0;
}
- public Animation createForceHideEnterAnimation() {
- return AnimationUtils.loadAnimation(mContext,
- com.android.internal.R.anim.lock_screen_behind_enter);
+ public Animation createForceHideEnterAnimation(boolean onWallpaper) {
+ return AnimationUtils.loadAnimation(mContext, onWallpaper
+ ? com.android.internal.R.anim.lock_screen_wallpaper_behind_enter
+ : com.android.internal.R.anim.lock_screen_behind_enter);
}
static ITelephony getTelephonyService() {
diff --git a/services/java/com/android/server/wm/WindowAnimator.java b/services/java/com/android/server/wm/WindowAnimator.java
index e5843ad..fa009eb 100644
--- a/services/java/com/android/server/wm/WindowAnimator.java
+++ b/services/java/com/android/server/wm/WindowAnimator.java
@@ -22,6 +22,7 @@ import android.view.animation.Animation;
import com.android.internal.policy.impl.PhoneWindowManager;
import java.io.PrintWriter;
+import java.util.ArrayList;
import java.util.HashSet;
/**
@@ -172,6 +173,9 @@ public class WindowAnimator {
private void updateWindowsAndWallpaperLocked() {
++mTransactionSequence;
+ ArrayList<WindowStateAnimator> unForceHiding = null;
+ boolean wallpaperInUnForceHiding = false;
+
for (int i = mService.mWindows.size() - 1; i >= 0; i--) {
WindowState win = mService.mWindows.get(i);
WindowStateAnimator winAnimator = win.mWinAnimator;
@@ -267,13 +271,12 @@ public class WindowAnimator {
if (changed) {
if ((mBulkUpdateParams & SET_FORCE_HIDING_CHANGED) != 0
&& win.isVisibleNow() /*w.isReadyForDisplay()*/) {
- // Assume we will need to animate. If
- // we don't (because the wallpaper will
- // stay with the lock screen), then we will
- // clean up later.
- Animation a = mPolicy.createForceHideEnterAnimation();
- if (a != null) {
- winAnimator.setAnimation(a);
+ if (unForceHiding == null) {
+ unForceHiding = new ArrayList<WindowStateAnimator>();
+ }
+ unForceHiding.add(winAnimator);
+ if ((win.mAttrs.flags&WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER) != 0) {
+ wallpaperInUnForceHiding = true;
}
}
if (mCurrentFocus == null || mCurrentFocus.mLayer < win.mLayer) {
@@ -356,6 +359,17 @@ public class WindowAnimator {
}
}
} // end forall windows
+
+ // If we have windows that are being show due to them no longer
+ // being force-hidden, apply the appropriate animation to them.
+ if (unForceHiding != null) {
+ for (int i=unForceHiding.size()-1; i>=0; i--) {
+ Animation a = mPolicy.createForceHideEnterAnimation(wallpaperInUnForceHiding);
+ if (a != null) {
+ unForceHiding.get(i).setAnimation(a);
+ }
+ }
+ }
}
private void testTokenMayBeDrawnLocked() {
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index f48b56d..b0e017f 100644
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -7894,28 +7894,6 @@ public class WindowManagerService extends IWindowManager.Stub
if (DEBUG_WALLPAPER) Slog.v(TAG, "****** OLD: " + oldWallpaper
+ " NEW: " + mWallpaperTarget
+ " LOWER: " + mLowerWallpaperTarget);
- if (mLowerWallpaperTarget == null) {
- // Whoops, we don't need a special wallpaper animation.
- // Clear them out.
- mAnimator.mForceHiding = false;
- for (int i=mWindows.size()-1; i>=0; i--) {
- WindowState w = mWindows.get(i);
- if (w.mHasSurface) {
- final WindowManager.LayoutParams attrs = w.mAttrs;
- if (mPolicy.doesForceHide(w, attrs) && w.isVisibleLw()) {
- if (DEBUG_FOCUS) Slog.i(TAG, "win=" + w + " force hides other windows");
- mAnimator.mForceHiding = true;
- } else if (mPolicy.canBeForceHidden(w, attrs)) {
- if (!w.mWinAnimator.mAnimating) {
- // We set the animation above so it
- // is not yet running.
- // TODO(cmautner): We lose the enter animation when this occurs.
- w.mWinAnimator.clearAnimation();
- }
- }
- }
- }
- }
return changes;
}