diff options
| author | Dianne Hackborn <hackbod@google.com> | 2012-04-12 15:28:52 -0700 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-04-12 15:28:52 -0700 |
| commit | b0398f59aae2c72161ea20339efaa950a788c375 (patch) | |
| tree | 3e07d5323e0c6232ed29faa9dbf6be2912f83c6f | |
| parent | dd7bdb0af7b1d4d5d111325affef961573c8b043 (diff) | |
| parent | 0c2acffec8689f8721a454845b24a830bc37ce92 (diff) | |
| download | frameworks_base-b0398f59aae2c72161ea20339efaa950a788c375.zip frameworks_base-b0398f59aae2c72161ea20339efaa950a788c375.tar.gz frameworks_base-b0398f59aae2c72161ea20339efaa950a788c375.tar.bz2 | |
Merge "Clean up lock screen hide animation."
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 a769868..d7def44 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -1125,6 +1125,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; } |
