am 067a7ac4: am 9e98927e: Merge "Retain configuration change info and sync access." into jb-mr1.1-dev

* commit '067a7ac494c8a248840b9a7a46f22a0efff9e52f':
  Retain configuration change info and sync access.
This commit is contained in:
Craig Mautner
2012-11-27 16:23:15 -08:00
committed by Android Git Automerger
3 changed files with 28 additions and 8 deletions

View File

@@ -2848,7 +2848,7 @@ public class WindowManagerService extends IWindowManager.Stub
}
if (win.isConfigChanged()) {
if (DEBUG_CONFIGURATION) Slog.i(TAG, "Window " + win
+ " visible with new config: " + win.mConfiguration);
+ " visible with new config: " + mCurConfiguration);
outConfig.setTo(mCurConfiguration);
}
}
@@ -3808,22 +3808,23 @@ public class WindowManagerService extends IWindowManager.Stub
final WindowList windows = getDefaultWindowListLocked();
int pos = windows.size() - 1;
while (pos >= 0) {
WindowState wtoken = windows.get(pos);
WindowState win = windows.get(pos);
pos--;
if (wtoken.mAppToken != null) {
if (win.mAppToken != null) {
// We hit an application window. so the orientation will be determined by the
// app window. No point in continuing further.
return (mLastWindowForcedOrientation=ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
}
if (!wtoken.isVisibleLw() || !wtoken.mPolicyVisibilityAfterAnim) {
if (!win.isVisibleLw() || !win.mPolicyVisibilityAfterAnim) {
continue;
}
int req = wtoken.mAttrs.screenOrientation;
int req = win.mAttrs.screenOrientation;
if((req == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) ||
(req == ActivityInfo.SCREEN_ORIENTATION_BEHIND)){
continue;
}
if (DEBUG_ORIENTATION) Slog.v(TAG, win + " forcing orientation to " + req);
return (mLastWindowForcedOrientation=req);
}
return (mLastWindowForcedOrientation=ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
@@ -9407,7 +9408,7 @@ public class WindowManagerService extends IWindowManager.Stub
+ " / " + mCurConfiguration + " / 0x"
+ Integer.toHexString(diff));
}
win.mConfiguration = mCurConfiguration;
win.setConfiguration(mCurConfiguration);
if (DEBUG_ORIENTATION &&
winAnimator.mDrawState == WindowStateAnimator.DRAW_PENDING) Slog.i(
TAG, "Resizing " + win + " WITH DRAW PENDING");

View File

@@ -21,6 +21,7 @@ import static android.view.WindowManager.LayoutParams.FLAG_COMPATIBLE_WINDOW;
import static android.view.WindowManager.LayoutParams.LAST_SUB_WINDOW;
import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD;
import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG;
import static android.view.WindowManager.LayoutParams.TYPE_KEYGUARD;
import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER;
import com.android.server.input.InputWindowHandle;
@@ -112,6 +113,9 @@ final class WindowState implements WindowManagerPolicy.WindowState {
int mLayoutSeq = -1;
Configuration mConfiguration = null;
// Sticky answer to isConfigChanged(), remains true until new Configuration is assigned.
// Used only on {@link #TYPE_KEYGUARD}.
private boolean mConfigHasChanged;
/**
* Actual frame shown on-screen (may be modified by animation). These
@@ -627,6 +631,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
: WindowManagerService.DEFAULT_INPUT_DISPATCHING_TIMEOUT_NANOS;
}
@Override
public boolean hasAppShownWindows() {
return mAppToken != null && (mAppToken.firstWindowDrawn || mAppToken.startingDisplayed);
}
@@ -857,9 +862,17 @@ final class WindowState implements WindowManagerPolicy.WindowState {
}
boolean isConfigChanged() {
return mConfiguration != mService.mCurConfiguration
boolean configChanged = mConfiguration != mService.mCurConfiguration
&& (mConfiguration == null
|| (mConfiguration.diff(mService.mCurConfiguration) != 0));
if (mAttrs.type == TYPE_KEYGUARD) {
// Retain configuration changed status until resetConfiguration called.
mConfigHasChanged |= configChanged;
configChanged = mConfigHasChanged;
}
return configChanged;
}
boolean isConfigDiff(int mask) {
@@ -886,6 +899,11 @@ final class WindowState implements WindowManagerPolicy.WindowState {
}
}
void setConfiguration(final Configuration newConfig) {
mConfiguration = newConfig;
mConfigHasChanged = false;
}
void setInputChannel(InputChannel inputChannel) {
if (mInputChannel != null) {
throw new IllegalStateException("Window already has an input channel.");
@@ -907,6 +925,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
}
private class DeathRecipient implements IBinder.DeathRecipient {
@Override
public void binderDied() {
try {
synchronized(mService.mWindowMap) {

View File

@@ -803,7 +803,7 @@ class WindowStateAnimator {
mSurfaceShown = false;
mSurface = null;
mWin.mHasSurface =false;
mWin.mHasSurface = false;
mDrawState = NO_SURFACE;
}
}