Skip to content

Commit b0398f5

Browse files
Dianne HackbornAndroid (Google) Code Review
authored andcommitted
Merge "Clean up lock screen hide animation."
2 parents dd7bdb0 + 0c2acff commit b0398f5

File tree

7 files changed

+65
-35
lines changed

7 files changed

+65
-35
lines changed

core/java/android/view/WindowManagerPolicy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ public int prepareAddWindowLw(WindowState win,
667667
/**
668668
* Create and return an animation to re-display a force hidden window.
669669
*/
670-
public Animation createForceHideEnterAnimation();
670+
public Animation createForceHideEnterAnimation(boolean onWallpaper);
671671

672672
/**
673673
* Called from the input reader thread before a key is enqueued.

core/res/res/anim/lock_screen_behind_enter.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!--
33
/*
4-
** Copyright 2007, The Android Open Source Project
4+
** Copyright 2012, The Android Open Source Project
55
**
66
** Licensed under the Apache License, Version 2.0 (the "License");
77
** you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@
1818
-->
1919

2020
<set xmlns:android="http://schemas.android.com/apk/res/android"
21-
android:detachWallpaper="true" android:shareInterpolator="false">
21+
android:background="#ff000000" android:shareInterpolator="false">
2222
<scale
2323
android:fromXScale="0.95" android:toXScale="1.0"
2424
android:fromYScale="0.95" android:toYScale="1.0"
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
/*
4+
** Copyright 2007, The Android Open Source Project
5+
**
6+
** Licensed under the Apache License, Version 2.0 (the "License");
7+
** you may not use this file except in compliance with the License.
8+
** You may obtain a copy of the License at
9+
**
10+
** http://www.apache.org/licenses/LICENSE-2.0
11+
**
12+
** Unless required by applicable law or agreed to in writing, software
13+
** distributed under the License is distributed on an "AS IS" BASIS,
14+
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
** See the License for the specific language governing permissions and
16+
** limitations under the License.
17+
*/
18+
-->
19+
20+
<set xmlns:android="http://schemas.android.com/apk/res/android"
21+
android:detachWallpaper="true" android:shareInterpolator="false">
22+
<scale
23+
android:fromXScale="0.95" android:toXScale="1.0"
24+
android:fromYScale="0.95" android:toYScale="1.0"
25+
android:pivotX="50%p" android:pivotY="50%p"
26+
android:fillEnabled="true" android:fillBefore="true"
27+
android:interpolator="@interpolator/decelerate_cubic"
28+
android:startOffset="@android:integer/config_shortAnimTime"
29+
android:duration="@android:integer/config_shortAnimTime" />
30+
<alpha
31+
android:fromAlpha="0.0" android:toAlpha="1.0"
32+
android:fillEnabled="true" android:fillBefore="true"
33+
android:interpolator="@interpolator/decelerate_quad"
34+
android:startOffset="@android:integer/config_shortAnimTime"
35+
android:duration="@android:integer/config_shortAnimTime"/>
36+
</set>

core/res/res/values/public.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,6 +1125,7 @@
11251125
<!-- From android.policy -->
11261126
<java-symbol type="anim" name="app_starting_exit" />
11271127
<java-symbol type="anim" name="lock_screen_behind_enter" />
1128+
<java-symbol type="anim" name="lock_screen_wallpaper_behind_enter" />
11281129
<java-symbol type="anim" name="dock_top_enter" />
11291130
<java-symbol type="anim" name="dock_top_exit" />
11301131
<java-symbol type="anim" name="dock_bottom_enter" />

policy/src/com/android/internal/policy/impl/PhoneWindowManager.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1628,9 +1628,10 @@ public int selectAnimationLw(WindowState win, int transit) {
16281628
return 0;
16291629
}
16301630

1631-
public Animation createForceHideEnterAnimation() {
1632-
return AnimationUtils.loadAnimation(mContext,
1633-
com.android.internal.R.anim.lock_screen_behind_enter);
1631+
public Animation createForceHideEnterAnimation(boolean onWallpaper) {
1632+
return AnimationUtils.loadAnimation(mContext, onWallpaper
1633+
? com.android.internal.R.anim.lock_screen_wallpaper_behind_enter
1634+
: com.android.internal.R.anim.lock_screen_behind_enter);
16341635
}
16351636

16361637
static ITelephony getTelephonyService() {

services/java/com/android/server/wm/WindowAnimator.java

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import com.android.internal.policy.impl.PhoneWindowManager;
2323

2424
import java.io.PrintWriter;
25+
import java.util.ArrayList;
2526
import java.util.HashSet;
2627

2728
/**
@@ -172,6 +173,9 @@ private void updateWindowsAppsAndRotationAnimationsLocked() {
172173
private void updateWindowsAndWallpaperLocked() {
173174
++mTransactionSequence;
174175

176+
ArrayList<WindowStateAnimator> unForceHiding = null;
177+
boolean wallpaperInUnForceHiding = false;
178+
175179
for (int i = mService.mWindows.size() - 1; i >= 0; i--) {
176180
WindowState win = mService.mWindows.get(i);
177181
WindowStateAnimator winAnimator = win.mWinAnimator;
@@ -267,13 +271,12 @@ private void updateWindowsAndWallpaperLocked() {
267271
if (changed) {
268272
if ((mBulkUpdateParams & SET_FORCE_HIDING_CHANGED) != 0
269273
&& win.isVisibleNow() /*w.isReadyForDisplay()*/) {
270-
// Assume we will need to animate. If
271-
// we don't (because the wallpaper will
272-
// stay with the lock screen), then we will
273-
// clean up later.
274-
Animation a = mPolicy.createForceHideEnterAnimation();
275-
if (a != null) {
276-
winAnimator.setAnimation(a);
274+
if (unForceHiding == null) {
275+
unForceHiding = new ArrayList<WindowStateAnimator>();
276+
}
277+
unForceHiding.add(winAnimator);
278+
if ((win.mAttrs.flags&WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER) != 0) {
279+
wallpaperInUnForceHiding = true;
277280
}
278281
}
279282
if (mCurrentFocus == null || mCurrentFocus.mLayer < win.mLayer) {
@@ -356,6 +359,17 @@ private void updateWindowsAndWallpaperLocked() {
356359
}
357360
}
358361
} // end forall windows
362+
363+
// If we have windows that are being show due to them no longer
364+
// being force-hidden, apply the appropriate animation to them.
365+
if (unForceHiding != null) {
366+
for (int i=unForceHiding.size()-1; i>=0; i--) {
367+
Animation a = mPolicy.createForceHideEnterAnimation(wallpaperInUnForceHiding);
368+
if (a != null) {
369+
unForceHiding.get(i).setAnimation(a);
370+
}
371+
}
372+
}
359373
}
360374

361375
private void testTokenMayBeDrawnLocked() {

services/java/com/android/server/wm/WindowManagerService.java

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7894,28 +7894,6 @@ private int animateAwayWallpaperLocked() {
78947894
if (DEBUG_WALLPAPER) Slog.v(TAG, "****** OLD: " + oldWallpaper
78957895
+ " NEW: " + mWallpaperTarget
78967896
+ " LOWER: " + mLowerWallpaperTarget);
7897-
if (mLowerWallpaperTarget == null) {
7898-
// Whoops, we don't need a special wallpaper animation.
7899-
// Clear them out.
7900-
mAnimator.mForceHiding = false;
7901-
for (int i=mWindows.size()-1; i>=0; i--) {
7902-
WindowState w = mWindows.get(i);
7903-
if (w.mHasSurface) {
7904-
final WindowManager.LayoutParams attrs = w.mAttrs;
7905-
if (mPolicy.doesForceHide(w, attrs) && w.isVisibleLw()) {
7906-
if (DEBUG_FOCUS) Slog.i(TAG, "win=" + w + " force hides other windows");
7907-
mAnimator.mForceHiding = true;
7908-
} else if (mPolicy.canBeForceHidden(w, attrs)) {
7909-
if (!w.mWinAnimator.mAnimating) {
7910-
// We set the animation above so it
7911-
// is not yet running.
7912-
// TODO(cmautner): We lose the enter animation when this occurs.
7913-
w.mWinAnimator.clearAnimation();
7914-
}
7915-
}
7916-
}
7917-
}
7918-
}
79197897
return changes;
79207898
}
79217899

0 commit comments

Comments
 (0)