Skip to content

Commit 9e98927

Browse files
Craig MautnerAndroid (Google) Code Review
authored andcommitted
Merge "Retain configuration change info and sync access." into jb-mr1.1-dev
2 parents b544af3 + e855214 commit 9e98927

File tree

3 files changed

+28
-8
lines changed

3 files changed

+28
-8
lines changed

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2848,7 +2848,7 @@ public int relayoutWindow(Session session, IWindow client, int seq,
28482848
}
28492849
if (win.isConfigChanged()) {
28502850
if (DEBUG_CONFIGURATION) Slog.i(TAG, "Window " + win
2851-
+ " visible with new config: " + win.mConfiguration);
2851+
+ " visible with new config: " + mCurConfiguration);
28522852
outConfig.setTo(mCurConfiguration);
28532853
}
28542854
}
@@ -3808,22 +3808,23 @@ public int getOrientationFromWindowsLocked() {
38083808
final WindowList windows = getDefaultWindowListLocked();
38093809
int pos = windows.size() - 1;
38103810
while (pos >= 0) {
3811-
WindowState wtoken = windows.get(pos);
3811+
WindowState win = windows.get(pos);
38123812
pos--;
3813-
if (wtoken.mAppToken != null) {
3813+
if (win.mAppToken != null) {
38143814
// We hit an application window. so the orientation will be determined by the
38153815
// app window. No point in continuing further.
38163816
return (mLastWindowForcedOrientation=ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
38173817
}
3818-
if (!wtoken.isVisibleLw() || !wtoken.mPolicyVisibilityAfterAnim) {
3818+
if (!win.isVisibleLw() || !win.mPolicyVisibilityAfterAnim) {
38193819
continue;
38203820
}
3821-
int req = wtoken.mAttrs.screenOrientation;
3821+
int req = win.mAttrs.screenOrientation;
38223822
if((req == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) ||
38233823
(req == ActivityInfo.SCREEN_ORIENTATION_BEHIND)){
38243824
continue;
38253825
}
38263826

3827+
if (DEBUG_ORIENTATION) Slog.v(TAG, win + " forcing orientation to " + req);
38273828
return (mLastWindowForcedOrientation=req);
38283829
}
38293830
return (mLastWindowForcedOrientation=ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
@@ -9407,7 +9408,7 @@ private final void performLayoutAndPlaceSurfacesLockedInner(boolean recoveringMe
94079408
+ " / " + mCurConfiguration + " / 0x"
94089409
+ Integer.toHexString(diff));
94099410
}
9410-
win.mConfiguration = mCurConfiguration;
9411+
win.setConfiguration(mCurConfiguration);
94119412
if (DEBUG_ORIENTATION &&
94129413
winAnimator.mDrawState == WindowStateAnimator.DRAW_PENDING) Slog.i(
94139414
TAG, "Resizing " + win + " WITH DRAW PENDING");

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

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import static android.view.WindowManager.LayoutParams.LAST_SUB_WINDOW;
2222
import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD;
2323
import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG;
24+
import static android.view.WindowManager.LayoutParams.TYPE_KEYGUARD;
2425
import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER;
2526

2627
import com.android.server.input.InputWindowHandle;
@@ -112,6 +113,9 @@ final class WindowState implements WindowManagerPolicy.WindowState {
112113
int mLayoutSeq = -1;
113114

114115
Configuration mConfiguration = null;
116+
// Sticky answer to isConfigChanged(), remains true until new Configuration is assigned.
117+
// Used only on {@link #TYPE_KEYGUARD}.
118+
private boolean mConfigHasChanged;
115119

116120
/**
117121
* Actual frame shown on-screen (may be modified by animation). These
@@ -627,6 +631,7 @@ public long getInputDispatchingTimeoutNanos() {
627631
: WindowManagerService.DEFAULT_INPUT_DISPATCHING_TIMEOUT_NANOS;
628632
}
629633

634+
@Override
630635
public boolean hasAppShownWindows() {
631636
return mAppToken != null && (mAppToken.firstWindowDrawn || mAppToken.startingDisplayed);
632637
}
@@ -857,9 +862,17 @@ boolean isFullscreen(int screenWidth, int screenHeight) {
857862
}
858863

859864
boolean isConfigChanged() {
860-
return mConfiguration != mService.mCurConfiguration
865+
boolean configChanged = mConfiguration != mService.mCurConfiguration
861866
&& (mConfiguration == null
862867
|| (mConfiguration.diff(mService.mCurConfiguration) != 0));
868+
869+
if (mAttrs.type == TYPE_KEYGUARD) {
870+
// Retain configuration changed status until resetConfiguration called.
871+
mConfigHasChanged |= configChanged;
872+
configChanged = mConfigHasChanged;
873+
}
874+
875+
return configChanged;
863876
}
864877

865878
boolean isConfigDiff(int mask) {
@@ -886,6 +899,11 @@ void removeLocked() {
886899
}
887900
}
888901

902+
void setConfiguration(final Configuration newConfig) {
903+
mConfiguration = newConfig;
904+
mConfigHasChanged = false;
905+
}
906+
889907
void setInputChannel(InputChannel inputChannel) {
890908
if (mInputChannel != null) {
891909
throw new IllegalStateException("Window already has an input channel.");
@@ -907,6 +925,7 @@ void disposeInputChannel() {
907925
}
908926

909927
private class DeathRecipient implements IBinder.DeathRecipient {
928+
@Override
910929
public void binderDied() {
911930
try {
912931
synchronized(mService.mWindowMap) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ void destroySurfaceLocked(boolean fromAnimator) {
803803

804804
mSurfaceShown = false;
805805
mSurface = null;
806-
mWin.mHasSurface =false;
806+
mWin.mHasSurface = false;
807807
mDrawState = NO_SURFACE;
808808
}
809809
}

0 commit comments

Comments
 (0)