Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 38f7dcd7 authored by Craig Mautner's avatar Craig Mautner
Browse files

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
parent 7f416631
Loading
Loading
Loading
Loading
+0 −16
Original line number Original line Diff line number Diff line
@@ -9302,22 +9302,6 @@ public class WindowManagerService extends IWindowManager.Stub
                // Don't remove this window until rotation has completed.
                // Don't remove this window until rotation has completed.
                continue;
                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();
            win.reportResized();
            mResizingWindows.remove(i);
            mResizingWindows.remove(i);
        }
        }
+22 −10
Original line number Original line Diff line number Diff line
@@ -16,8 +16,11 @@


package com.android.server.wm;
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_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.FIRST_SUB_WINDOW;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_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);
                mAttachedWindow.mChildWindows.add(this);
            } else {
            } else {
                for (int i = 0; i < children_size; i++) {
                for (int i = 0; i < children_size; i++) {
                    WindowState child = (WindowState)mAttachedWindow.mChildWindows.get(i);
                    WindowState child = mAttachedWindow.mChildWindows.get(i);
                    if (this.mSubLayer < child.mSubLayer) {
                    if (mSubLayer < child.mSubLayer) {
                        mAttachedWindow.mChildWindows.add(i, this);
                        mAttachedWindow.mChildWindows.add(i, this);
                        break;
                        break;
                    } else if (this.mSubLayer > child.mSubLayer) {
                    } else if (mSubLayer > child.mSubLayer) {
                        continue;
                        continue;
                    }
                    }


                    if (this.mBaseLayer <= child.mBaseLayer) {
                    if (mBaseLayer <= child.mBaseLayer) {
                        mAttachedWindow.mChildWindows.add(i, this);
                        mAttachedWindow.mChildWindows.add(i, this);
                        break;
                        break;
                    } else {
                        continue;
                    }
                    }
                }
                }
                if (children_size == mAttachedWindow.mChildWindows.size()) {
                if (children_size == mAttachedWindow.mChildWindows.size()) {
@@ -1310,13 +1311,24 @@ final class WindowState implements WindowManagerPolicy.WindowState {


    void reportResized() {
    void reportResized() {
        try {
        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 frame = mFrame;
            final Rect overscanInsets = mLastOverscanInsets;
            final Rect overscanInsets = mLastOverscanInsets;
            final Rect contentInsets = mLastContentInsets;
            final Rect contentInsets = mLastContentInsets;
            final Rect visibleInsets = mLastVisibleInsets;
            final Rect visibleInsets = mLastVisibleInsets;
            final boolean reportDraw
            final boolean reportDraw = mWinAnimator.mDrawState == WindowStateAnimator.DRAW_PENDING;
                    = mWinAnimator.mDrawState == WindowStateAnimator.DRAW_PENDING;
            final Configuration newConfig = configChanged ? mConfiguration : null;
            final Configuration newConfig = isConfigChanged() ? mConfiguration : null;
            if (mClient instanceof IWindow.Stub) {
            if (mClient instanceof IWindow.Stub) {
                // To prevent deadlock simulate one-way call if win.mClient is a local object.
                // To prevent deadlock simulate one-way call if win.mClient is a local object.
                mService.mH.post(new Runnable() {
                mService.mH.post(new Runnable() {