Skip to content

Commit 4716368

Browse files
Dianne HackbornAndroid (Google) Code Review
authored andcommitted
Merge "Another attempt at issue #5823276: home repaints after full-screen app is exited" into ics-mr1
2 parents c986d6f + b7ff51b commit 4716368

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

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

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2538,8 +2538,12 @@ public int relayoutWindow(Session session, IWindow client, int seq,
25382538
if (win == null) {
25392539
return 0;
25402540
}
2541-
win.mRequestedWidth = requestedWidth;
2542-
win.mRequestedHeight = requestedHeight;
2541+
if (win.mRequestedWidth != requestedWidth
2542+
|| win.mRequestedHeight != requestedHeight) {
2543+
win.mLayoutNeeded = true;
2544+
win.mRequestedWidth = requestedWidth;
2545+
win.mRequestedHeight = requestedHeight;
2546+
}
25432547
if (attrs != null && seq == win.mSeq) {
25442548
win.mSystemUiVisibility = systemUiVisibility;
25452549
}
@@ -2560,6 +2564,9 @@ public int relayoutWindow(Session session, IWindow client, int seq,
25602564
}
25612565
flagChanges = win.mAttrs.flags ^= attrs.flags;
25622566
attrChanges = win.mAttrs.copyFrom(attrs);
2567+
if ((attrChanges&WindowManager.LayoutParams.LAYOUT_CHANGED) != 0) {
2568+
win.mLayoutNeeded = true;
2569+
}
25632570
}
25642571

25652572
if (DEBUG_LAYOUT) Slog.v(TAG, "Relayout " + win + ": " + win.mAttrs);
@@ -7438,12 +7445,13 @@ private final int performLayoutLockedInner(boolean initial, boolean updateInputW
74387445
// if they want. (We do the normal layout for INVISIBLE
74397446
// windows, since that means "perform layout as normal,
74407447
// just don't display").
7441-
if (!gone || !win.mHaveFrame) {
7448+
if (!gone || !win.mHaveFrame || win.mLayoutNeeded) {
74427449
if (!win.mLayoutAttached) {
74437450
if (initial) {
74447451
//Slog.i(TAG, "Window " + this + " clearing mContentChanged - initial");
74457452
win.mContentChanged = false;
74467453
}
7454+
win.mLayoutNeeded = false;
74477455
win.prelayout();
74487456
mPolicy.layoutWindowLw(win, win.mAttrs, null);
74497457
win.mLayoutSeq = seq;
@@ -7475,11 +7483,12 @@ private final int performLayoutLockedInner(boolean initial, boolean updateInputW
74757483
// windows, since that means "perform layout as normal,
74767484
// just don't display").
74777485
if ((win.mViewVisibility != View.GONE && win.mRelayoutCalled)
7478-
|| !win.mHaveFrame) {
7486+
|| !win.mHaveFrame || win.mLayoutNeeded) {
74797487
if (initial) {
74807488
//Slog.i(TAG, "Window " + this + " clearing mContentChanged - initial");
74817489
win.mContentChanged = false;
74827490
}
7491+
win.mLayoutNeeded = false;
74837492
win.prelayout();
74847493
mPolicy.layoutWindowLw(win, win.mAttrs, win.mAttachedWindow);
74857494
win.mLayoutSeq = seq;

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,12 @@ final class WindowState implements WindowManagerPolicy.WindowState {
238238
// we can give the window focus before waiting for the relayout.
239239
boolean mRelayoutCalled;
240240

241+
// If the application has called relayout() with changes that can
242+
// impact its window's size, we need to perform a layout pass on it
243+
// even if it is not currently visible for layout. This is set
244+
// when in that case until the layout is done.
245+
boolean mLayoutNeeded;
246+
241247
// This is set after the Surface has been created but before the
242248
// window has been drawn. During this time the surface is hidden.
243249
boolean mDrawPending;
@@ -1449,7 +1455,7 @@ public boolean isGoneForLayoutLw() {
14491455
return mViewVisibility == View.GONE
14501456
|| !mRelayoutCalled
14511457
|| (atoken == null && mRootToken.hidden)
1452-
|| (atoken != null && atoken.hiddenRequested)
1458+
|| (atoken != null && (atoken.hiddenRequested || atoken.hidden))
14531459
|| mAttachedHidden
14541460
|| mExiting || mDestroying;
14551461
}
@@ -1728,8 +1734,9 @@ void dump(PrintWriter pw, String prefix, boolean dumpAll) {
17281734
pw.print(mPolicyVisibilityAfterAnim);
17291735
pw.print(" mAttachedHidden="); pw.println(mAttachedHidden);
17301736
}
1731-
if (!mRelayoutCalled) {
1732-
pw.print(prefix); pw.print("mRelayoutCalled="); pw.println(mRelayoutCalled);
1737+
if (!mRelayoutCalled || mLayoutNeeded) {
1738+
pw.print(prefix); pw.print("mRelayoutCalled="); pw.print(mRelayoutCalled);
1739+
pw.print(" mLayoutNeeded="); pw.println(mLayoutNeeded);
17331740
}
17341741
if (mSurfaceResized || mSurfaceDestroyDeferred) {
17351742
pw.print(prefix); pw.print("mSurfaceResized="); pw.print(mSurfaceResized);

0 commit comments

Comments
 (0)