Skip to content

Commit dcddea9

Browse files
Craig MautnerAndroid (Google) Code Review
authored andcommitted
Merge "Handle keyguard visibility states separately. DO NOT MERGE" into jb-dev
2 parents d5cd890 + f333f5f commit dcddea9

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

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

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,20 @@
3232
public class WindowAnimator {
3333
private static final String TAG = "WindowAnimator";
3434

35+
// mForceHiding states.
36+
private static final int KEYGUARD_NOT_SHOWN = 0;
37+
private static final int KEYGUARD_ANIMATING_IN = 1;
38+
private static final int KEYGUARD_SHOWN = 2;
39+
private static final int KEYGUARD_ANIMATING_OUT = 3;
40+
int mForceHiding;
41+
3542
final WindowManagerService mService;
3643
final Context mContext;
3744
final WindowManagerPolicy mPolicy;
3845

3946
ArrayList<WindowStateAnimator> mWinAnimators = new ArrayList<WindowStateAnimator>();
4047

4148
boolean mAnimating;
42-
boolean mForceHiding;
4349
WindowState mWindowAnimationBackground;
4450
int mWindowAnimationBackgroundColor;
4551
int mAdjResult;
@@ -279,8 +285,16 @@ private void updateWindowsAndWallpaperLocked() {
279285
}
280286
mService.mFocusMayChange = true;
281287
}
282-
if (win.isReadyForDisplay() && winAnimator.mAnimationIsEntrance) {
283-
mForceHiding = true;
288+
if (win.isReadyForDisplay()) {
289+
if (nowAnimating) {
290+
if (winAnimator.mAnimationIsEntrance) {
291+
mForceHiding = KEYGUARD_ANIMATING_IN;
292+
} else {
293+
mForceHiding = KEYGUARD_ANIMATING_OUT;
294+
}
295+
} else {
296+
mForceHiding = KEYGUARD_SHOWN;
297+
}
284298
}
285299
if (WindowManagerService.DEBUG_VISIBILITY) Slog.v(TAG,
286300
"Force hide " + mForceHiding
@@ -292,9 +306,12 @@ private void updateWindowsAndWallpaperLocked() {
292306
+ " hidden=" + win.mRootToken.hidden
293307
+ " anim=" + win.mWinAnimator.mAnimation);
294308
} else if (mPolicy.canBeForceHidden(win, win.mAttrs)) {
309+
final boolean hideWhenLocked =
310+
(winAnimator.mAttrFlags & FLAG_SHOW_WHEN_LOCKED) == 0;
295311
final boolean changed;
296-
if (mForceHiding && (!winAnimator.isAnimating()
297-
|| (winAnimator.mAttrFlags & FLAG_SHOW_WHEN_LOCKED) == 0)) {
312+
if (((mForceHiding == KEYGUARD_ANIMATING_IN)
313+
&& (!winAnimator.isAnimating() || hideWhenLocked))
314+
|| ((mForceHiding == KEYGUARD_SHOWN) && hideWhenLocked)) {
298315
changed = win.hideLw(false, false);
299316
if (WindowManagerService.DEBUG_VISIBILITY && changed) Slog.v(TAG,
300317
"Now policy hidden: " + win);
@@ -411,7 +428,7 @@ private void testTokenMayBeDrawnLocked() {
411428
}
412429

413430
private void performAnimationsLocked() {
414-
mForceHiding = false;
431+
mForceHiding = KEYGUARD_NOT_SHOWN;
415432
mDetachedWallpaper = null;
416433
mWindowAnimationBackground = null;
417434
mWindowAnimationBackgroundColor = 0;

0 commit comments

Comments
 (0)