Skip to content

Commit 3dc0b80

Browse files
Craig MautnerAndroid (Google) Code Review
authored andcommitted
Merge "Fix layout state issues." into jb-mr1-dev
2 parents 3a8af8e + 812d2ca commit 3dc0b80

File tree

2 files changed

+25
-13
lines changed

2 files changed

+25
-13
lines changed

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

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@
7474
import android.graphics.RectF;
7575
import android.graphics.Region;
7676
import android.hardware.display.DisplayManager;
77-
import android.hardware.input.InputManager;
7877
import android.os.Binder;
7978
import android.os.Bundle;
8079
import android.os.Debug;
@@ -2749,7 +2748,8 @@ public int relayoutWindow(Session session, IWindow client, int seq,
27492748
}
27502749
}
27512750

2752-
if (DEBUG_LAYOUT) Slog.v(TAG, "Relayout " + win + ": " + win.mAttrs);
2751+
if (DEBUG_LAYOUT) Slog.v(TAG, "Relayout " + win + ": viewVisibility=" + viewVisibility
2752+
+ " " + requestedWidth + "x" + requestedHeight + " " + win.mAttrs);
27532753

27542754
win.mEnforceSizeCompat = (win.mAttrs.flags & FLAG_COMPATIBLE_WINDOW) != 0;
27552755

@@ -4036,7 +4036,8 @@ public void setFocusedApp(IBinder token, boolean moveFocusNow) {
40364036
}
40374037
changed = mFocusedApp != newFocus;
40384038
mFocusedApp = newFocus;
4039-
if (DEBUG_FOCUS) Slog.v(TAG, "Set focused app to: " + mFocusedApp);
4039+
if (DEBUG_FOCUS) Slog.v(TAG, "Set focused app to: " + mFocusedApp
4040+
+ " moveFocusNow=" + moveFocusNow);
40404041
if (changed) {
40414042
mInputMonitor.setFocusedAppLw(newFocus);
40424043
}
@@ -8296,7 +8297,8 @@ private final void performLayoutLockedInner(final DisplayContent displayContent,
82968297
if (DEBUG_LAYOUT && !win.mLayoutAttached) {
82978298
Slog.v(TAG, "1ST PASS " + win
82988299
+ ": gone=" + gone + " mHaveFrame=" + win.mHaveFrame
8299-
+ " mLayoutAttached=" + win.mLayoutAttached);
8300+
+ " mLayoutAttached=" + win.mLayoutAttached
8301+
+ " screen changed=" + win.isConfigDiff(ActivityInfo.CONFIG_SCREEN_SIZE));
83008302
final AppWindowToken atoken = win.mAppToken;
83018303
if (gone) Slog.v(TAG, " GONE: mViewVisibility="
83028304
+ win.mViewVisibility + " mRelayoutCalled="
@@ -8318,6 +8320,7 @@ private final void performLayoutLockedInner(final DisplayContent displayContent,
83188320
// windows, since that means "perform layout as normal,
83198321
// just don't display").
83208322
if (!gone || !win.mHaveFrame || win.mLayoutNeeded
8323+
|| win.isConfigDiff(ActivityInfo.CONFIG_SCREEN_SIZE)
83218324
|| win.mAttrs.type == TYPE_UNIVERSE_BACKGROUND) {
83228325
if (!win.mLayoutAttached) {
83238326
if (initial) {
@@ -8753,10 +8756,7 @@ private void updateResizingWindows(final WindowState w) {
87538756
!w.mLastContentInsets.equals(w.mContentInsets);
87548757
w.mVisibleInsetsChanged |=
87558758
!w.mLastVisibleInsets.equals(w.mVisibleInsets);
8756-
boolean configChanged =
8757-
w.mConfiguration != mCurConfiguration
8758-
&& (w.mConfiguration == null
8759-
|| mCurConfiguration.diff(w.mConfiguration) != 0);
8759+
boolean configChanged = w.isConfigChanged();
87608760
if (DEBUG_CONFIGURATION && configChanged) {
87618761
Slog.v(TAG, "Win " + w + " config changed: "
87628762
+ mCurConfiguration);
@@ -9254,10 +9254,7 @@ private final void performLayoutAndPlaceSurfacesLockedInner(boolean recoveringMe
92549254
if (DEBUG_RESIZE || DEBUG_ORIENTATION) Slog.v(TAG,
92559255
"Reporting new frame to " + win + ": " + win.mCompatFrame);
92569256
int diff = 0;
9257-
boolean configChanged =
9258-
win.mConfiguration != mCurConfiguration
9259-
&& (win.mConfiguration == null
9260-
|| (diff=mCurConfiguration.diff(win.mConfiguration)) != 0);
9257+
boolean configChanged = win.isConfigChanged();
92619258
if ((DEBUG_RESIZE || DEBUG_ORIENTATION || DEBUG_CONFIGURATION)
92629259
&& configChanged) {
92639260
Slog.i(TAG, "Sending new config to window " + win + ": "

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,7 @@ public WindowManager.LayoutParams getAttrs() {
574574
return mAttrs;
575575
}
576576

577+
@Override
577578
public boolean getNeedsMenuLw(WindowManagerPolicy.WindowState bottom) {
578579
int index = -1;
579580
WindowState ws = this;
@@ -612,6 +613,7 @@ public int getSurfaceLayer() {
612613
return mLayer;
613614
}
614615

616+
@Override
615617
public IApplicationToken getAppToken() {
616618
return mAppToken != null ? mAppToken.appToken : null;
617619
}
@@ -801,12 +803,13 @@ public boolean isAnimatingLw() {
801803
return mWinAnimator.mAnimation != null;
802804
}
803805

806+
@Override
804807
public boolean isGoneForLayoutLw() {
805808
final AppWindowToken atoken = mAppToken;
806809
return mViewVisibility == View.GONE
807810
|| !mRelayoutCalled
808811
|| (atoken == null && mRootToken.hidden)
809-
|| (atoken != null && atoken.hiddenRequested)
812+
|| (atoken != null && (atoken.hiddenRequested || atoken.hidden))
810813
|| mAttachedHidden
811814
|| mExiting || mDestroying;
812815
}
@@ -849,6 +852,18 @@ boolean isFullscreen(int screenWidth, int screenHeight) {
849852
mFrame.right >= screenWidth && mFrame.bottom >= screenHeight;
850853
}
851854

855+
boolean isConfigChanged() {
856+
return mConfiguration != mService.mCurConfiguration
857+
&& (mConfiguration == null
858+
|| (mConfiguration.diff(mService.mCurConfiguration) != 0));
859+
}
860+
861+
boolean isConfigDiff(int mask) {
862+
return mConfiguration != mService.mCurConfiguration
863+
&& mConfiguration != null
864+
&& (mConfiguration.diff(mService.mCurConfiguration) & mask) != 0;
865+
}
866+
852867
void removeLocked() {
853868
disposeInputChannel();
854869

0 commit comments

Comments
 (0)