DO NOT MERGE. Test for Configuration differences before changing.

Changing Configuration first and then testing for changes yields a
result indicating no change.

Fixes bug 12904769.

Change-Id: If7e39e843f15b1143d9877497d595511afabd020
This commit is contained in:
Craig Mautner
2014-02-06 10:31:41 -08:00
parent 7f41663141
commit 38f7dcd7dc
2 changed files with 22 additions and 26 deletions

View File

@@ -9302,22 +9302,6 @@ public class WindowManagerService extends IWindowManager.Stub
// Don't remove this window until rotation has completed.
continue;
}
final WindowStateAnimator winAnimator = win.mWinAnimator;
if (DEBUG_RESIZE || DEBUG_ORIENTATION) Slog.v(TAG,
"Reporting new frame to " + win + ": " + win.mCompatFrame);
int diff = 0;
boolean configChanged = win.isConfigChanged();
if ((DEBUG_RESIZE || DEBUG_ORIENTATION || DEBUG_CONFIGURATION)
&& configChanged) {
Slog.i(TAG, "Sending new config to window " + win + ": "
+ winAnimator.mSurfaceW + "x" + winAnimator.mSurfaceH
+ " / " + mCurConfiguration + " / 0x"
+ Integer.toHexString(diff));
}
win.setConfiguration(mCurConfiguration);
if (DEBUG_ORIENTATION &&
winAnimator.mDrawState == WindowStateAnimator.DRAW_PENDING) Slog.i(
TAG, "Resizing " + win + " WITH DRAW PENDING");
win.reportResized();
mResizingWindows.remove(i);
}

View File

@@ -16,8 +16,11 @@
package com.android.server.wm;
import static com.android.server.wm.WindowManagerService.DEBUG_VISIBILITY;
import static com.android.server.wm.WindowManagerService.DEBUG_CONFIGURATION;
import static com.android.server.wm.WindowManagerService.DEBUG_LAYOUT;
import static com.android.server.wm.WindowManagerService.DEBUG_ORIENTATION;
import static com.android.server.wm.WindowManagerService.DEBUG_RESIZE;
import static com.android.server.wm.WindowManagerService.DEBUG_VISIBILITY;
import static android.view.WindowManager.LayoutParams.FIRST_SUB_WINDOW;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW;
@@ -372,19 +375,17 @@ final class WindowState implements WindowManagerPolicy.WindowState {
mAttachedWindow.mChildWindows.add(this);
} else {
for (int i = 0; i < children_size; i++) {
WindowState child = (WindowState)mAttachedWindow.mChildWindows.get(i);
if (this.mSubLayer < child.mSubLayer) {
WindowState child = mAttachedWindow.mChildWindows.get(i);
if (mSubLayer < child.mSubLayer) {
mAttachedWindow.mChildWindows.add(i, this);
break;
} else if (this.mSubLayer > child.mSubLayer) {
} else if (mSubLayer > child.mSubLayer) {
continue;
}
if (this.mBaseLayer <= child.mBaseLayer) {
if (mBaseLayer <= child.mBaseLayer) {
mAttachedWindow.mChildWindows.add(i, this);
break;
} else {
continue;
}
}
if (children_size == mAttachedWindow.mChildWindows.size()) {
@@ -1310,13 +1311,24 @@ final class WindowState implements WindowManagerPolicy.WindowState {
void reportResized() {
try {
if (DEBUG_RESIZE || DEBUG_ORIENTATION) Slog.v(TAG, "Reporting new frame to " + this
+ ": " + mCompatFrame);
boolean configChanged = isConfigChanged();
if ((DEBUG_RESIZE || DEBUG_ORIENTATION || DEBUG_CONFIGURATION) && configChanged) {
Slog.i(TAG, "Sending new config to window " + this + ": "
+ mWinAnimator.mSurfaceW + "x" + mWinAnimator.mSurfaceH
+ " / " + mService.mCurConfiguration);
}
setConfiguration(mService.mCurConfiguration);
if (DEBUG_ORIENTATION && mWinAnimator.mDrawState == WindowStateAnimator.DRAW_PENDING)
Slog.i(TAG, "Resizing " + this + " WITH DRAW PENDING");
final Rect frame = mFrame;
final Rect overscanInsets = mLastOverscanInsets;
final Rect contentInsets = mLastContentInsets;
final Rect visibleInsets = mLastVisibleInsets;
final boolean reportDraw
= mWinAnimator.mDrawState == WindowStateAnimator.DRAW_PENDING;
final Configuration newConfig = isConfigChanged() ? mConfiguration : null;
final boolean reportDraw = mWinAnimator.mDrawState == WindowStateAnimator.DRAW_PENDING;
final Configuration newConfig = configChanged ? mConfiguration : null;
if (mClient instanceof IWindow.Stub) {
// To prevent deadlock simulate one-way call if win.mClient is a local object.
mService.mH.post(new Runnable() {