Skip to content

Commit cfbf7de

Browse files
author
Dianne Hackborn
committed
Fix issue #5823276 again: home repaints after full-screen app is exited
Don't consider a window as a candidate for the top fullscreen window if it is not going to be a candiate for layout. This fix does not include the change to ignore app tokens that are hidden. This causes problems in some dialogs that stay hidden until their app is ready to display, but need to perform a series of relayouts during that time to get to the right size. Dropping this part of the change still (mostly?) seems to allow us to avoid the bad states. Change-Id: Ic052cb1499d3287f47e9ffeac5cd2470ee5a308c
1 parent 820b45c commit cfbf7de

File tree

4 files changed

+36
-17
lines changed

4 files changed

+36
-17
lines changed

core/java/android/view/WindowManagerPolicy.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,11 @@ public void computeFrameLw(Rect parentFrame, Rect displayFrame,
297297
*/
298298
boolean isDisplayedLw();
299299

300+
/**
301+
* Is this window considered to be gone for purposes of layout?
302+
*/
303+
boolean isGoneForLayoutLw();
304+
300305
/**
301306
* Returns true if this window has been shown on screen at some time in
302307
* the past. Must be called with the window manager lock held.

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2336,7 +2336,7 @@ public void animatingWindowLw(WindowState win,
23362336
if (DEBUG_LAYOUT) Slog.i(TAG, "Win " + win + ": isVisibleOrBehindKeyguardLw="
23372337
+ win.isVisibleOrBehindKeyguardLw());
23382338
if (mTopFullscreenOpaqueWindowState == null &&
2339-
win.isVisibleOrBehindKeyguardLw()) {
2339+
win.isVisibleOrBehindKeyguardLw() && !win.isGoneForLayoutLw()) {
23402340
if ((attrs.flags & FLAG_FORCE_NOT_FULLSCREEN) != 0) {
23412341
mForceStatusBar = true;
23422342
}
@@ -2391,7 +2391,7 @@ public int finishAnimationLw() {
23912391
// case though.
23922392
if (topIsFullscreen) {
23932393
if (mStatusBarCanHide) {
2394-
if (DEBUG_LAYOUT) Log.v(TAG, "Hiding status bar");
2394+
if (DEBUG_LAYOUT) Log.v(TAG, "** HIDING status bar");
23952395
if (mStatusBar.hideLw(true)) {
23962396
changes |= FINISH_LAYOUT_REDO_LAYOUT;
23972397

@@ -2407,7 +2407,7 @@ public int finishAnimationLw() {
24072407
Log.v(TAG, "Preventing status bar from hiding by policy");
24082408
}
24092409
} else {
2410-
if (DEBUG_LAYOUT) Log.v(TAG, "Showing status bar: top is not fullscreen");
2410+
if (DEBUG_LAYOUT) Log.v(TAG, "** SHOWING status bar: top is not fullscreen");
24112411
if (mStatusBar.showLw(true)) changes |= FINISH_LAYOUT_REDO_LAYOUT;
24122412
}
24132413
}

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

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7391,8 +7391,11 @@ private final int performLayoutLockedInner(boolean initial, boolean updateInputW
73917391
final int N = mWindows.size();
73927392
int i;
73937393

7394-
if (DEBUG_LAYOUT) Slog.v(TAG, "performLayout: needed="
7395-
+ mLayoutNeeded + " dw=" + dw + " dh=" + dh);
7394+
if (DEBUG_LAYOUT) {
7395+
Slog.v(TAG, "-------------------------------------");
7396+
Slog.v(TAG, "performLayout: needed="
7397+
+ mLayoutNeeded + " dw=" + dw + " dh=" + dh);
7398+
}
73967399

73977400
mPolicy.beginLayoutLw(dw, dh, mRotation);
73987401

@@ -7409,19 +7412,20 @@ private final int performLayoutLockedInner(boolean initial, boolean updateInputW
74097412
// Don't do layout of a window if it is not visible, or
74107413
// soon won't be visible, to avoid wasting time and funky
74117414
// changes while a window is animating away.
7412-
final AppWindowToken atoken = win.mAppToken;
7413-
final boolean gone = win.mViewVisibility == View.GONE
7414-
|| !win.mRelayoutCalled
7415-
|| (atoken == null && win.mRootToken.hidden)
7416-
|| (atoken != null && atoken.hiddenRequested)
7417-
|| win.mAttachedHidden
7418-
|| win.mExiting || win.mDestroying;
7415+
final boolean gone = win.isGoneForLayoutLw();
74197416

74207417
if (DEBUG_LAYOUT && !win.mLayoutAttached) {
7421-
Slog.v(TAG, "First pass " + win
7418+
Slog.v(TAG, "1ST PASS " + win
74227419
+ ": gone=" + gone + " mHaveFrame=" + win.mHaveFrame
74237420
+ " mLayoutAttached=" + win.mLayoutAttached);
7424-
if (gone) Slog.v(TAG, " (mViewVisibility="
7421+
final AppWindowToken atoken = win.mAppToken;
7422+
if (gone) Slog.v(TAG, " GONE: mViewVisibility="
7423+
+ win.mViewVisibility + " mRelayoutCalled="
7424+
+ win.mRelayoutCalled + " hidden="
7425+
+ win.mRootToken.hidden + " hiddenRequested="
7426+
+ (atoken != null && atoken.hiddenRequested)
7427+
+ " mAttachedHidden=" + win.mAttachedHidden);
7428+
else Slog.v(TAG, " VIS: mViewVisibility="
74257429
+ win.mViewVisibility + " mRelayoutCalled="
74267430
+ win.mRelayoutCalled + " hidden="
74277431
+ win.mRootToken.hidden + " hiddenRequested="
@@ -7443,7 +7447,7 @@ private final int performLayoutLockedInner(boolean initial, boolean updateInputW
74437447
win.prelayout();
74447448
mPolicy.layoutWindowLw(win, win.mAttrs, null);
74457449
win.mLayoutSeq = seq;
7446-
if (DEBUG_LAYOUT) Slog.v(TAG, "-> mFrame="
7450+
if (DEBUG_LAYOUT) Slog.v(TAG, " LAYOUT: mFrame="
74477451
+ win.mFrame + " mContainingFrame="
74487452
+ win.mContainingFrame + " mDisplayFrame="
74497453
+ win.mDisplayFrame);
@@ -7461,7 +7465,7 @@ private final int performLayoutLockedInner(boolean initial, boolean updateInputW
74617465
WindowState win = mWindows.get(i);
74627466

74637467
if (win.mLayoutAttached) {
7464-
if (DEBUG_LAYOUT) Slog.v(TAG, "Second pass " + win
7468+
if (DEBUG_LAYOUT) Slog.v(TAG, "2ND PASS " + win
74657469
+ " mHaveFrame=" + win.mHaveFrame
74667470
+ " mViewVisibility=" + win.mViewVisibility
74677471
+ " mRelayoutCalled=" + win.mRelayoutCalled);
@@ -7479,7 +7483,7 @@ private final int performLayoutLockedInner(boolean initial, boolean updateInputW
74797483
win.prelayout();
74807484
mPolicy.layoutWindowLw(win, win.mAttrs, win.mAttachedWindow);
74817485
win.mLayoutSeq = seq;
7482-
if (DEBUG_LAYOUT) Slog.v(TAG, "-> mFrame="
7486+
if (DEBUG_LAYOUT) Slog.v(TAG, " LAYOUT: mFrame="
74837487
+ win.mFrame + " mContainingFrame="
74847488
+ win.mContainingFrame + " mDisplayFrame="
74857489
+ win.mDisplayFrame);

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,6 +1444,16 @@ public boolean isDisplayedLw() {
14441444
|| mAnimating);
14451445
}
14461446

1447+
public boolean isGoneForLayoutLw() {
1448+
final AppWindowToken atoken = mAppToken;
1449+
return mViewVisibility == View.GONE
1450+
|| !mRelayoutCalled
1451+
|| (atoken == null && mRootToken.hidden)
1452+
|| (atoken != null && atoken.hiddenRequested)
1453+
|| mAttachedHidden
1454+
|| mExiting || mDestroying;
1455+
}
1456+
14471457
/**
14481458
* Returns true if the window has a surface that it has drawn a
14491459
* complete UI in to.

0 commit comments

Comments
 (0)