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

Commit 7950d081 authored by Craig Mautner's avatar Craig Mautner Committed by Android (Google) Code Review
Browse files

Merge "Make mLayoutNeeded per-Display." into jb-mr1-dev

parents 0116136f 19d59bc5
Loading
Loading
Loading
Loading
+71 −50
Original line number Original line Diff line number Diff line
@@ -99,7 +99,6 @@ import android.util.EventLog;
import android.util.FloatMath;
import android.util.FloatMath;
import android.util.Log;
import android.util.Log;
import android.util.SparseArray;
import android.util.SparseArray;
//import android.util.LogPrinter;
import android.util.Pair;
import android.util.Pair;
import android.util.Slog;
import android.util.Slog;
import android.util.SparseIntArray;
import android.util.SparseIntArray;
@@ -454,7 +453,6 @@ public class WindowManagerService extends IWindowManager.Stub
    int mSystemDecorLayer = 0;
    int mSystemDecorLayer = 0;
    final Rect mScreenRect = new Rect();
    final Rect mScreenRect = new Rect();


    boolean mLayoutNeeded = true;
    boolean mTraversalScheduled = false;
    boolean mTraversalScheduled = false;
    boolean mDisplayFrozen = false;
    boolean mDisplayFrozen = false;
    boolean mWaitingForConfig = false;
    boolean mWaitingForConfig = false;
@@ -1768,7 +1766,7 @@ public class WindowManagerService extends IWindowManager.Stub
                token.hidden = !visible;
                token.hidden = !visible;
                // Need to do a layout to ensure the wallpaper now has the
                // Need to do a layout to ensure the wallpaper now has the
                // correct size.
                // correct size.
                mLayoutNeeded = true;
                getDefaultDisplayContent().layoutNeeded = true;
            }
            }


            int curWallpaperIndex = token.windows.size();
            int curWallpaperIndex = token.windows.size();
@@ -2011,7 +2009,7 @@ public class WindowManagerService extends IWindowManager.Stub
                token.hidden = !visible;
                token.hidden = !visible;
                // Need to do a layout to ensure the wallpaper now has the
                // Need to do a layout to ensure the wallpaper now has the
                // correct size.
                // correct size.
                mLayoutNeeded = true;
                getDefaultDisplayContent().layoutNeeded = true;
            }
            }


            int curWallpaperIndex = token.windows.size();
            int curWallpaperIndex = token.windows.size();
@@ -2310,7 +2308,7 @@ public class WindowManagerService extends IWindowManager.Stub
                //Slog.i(TAG, "*** Running exit animation...");
                //Slog.i(TAG, "*** Running exit animation...");
                win.mExiting = true;
                win.mExiting = true;
                win.mRemoveOnExit = true;
                win.mRemoveOnExit = true;
                mLayoutNeeded = true;
                win.mDisplayContent.layoutNeeded = true;
                updateFocusedWindowLocked(UPDATE_FOCUS_WILL_PLACE_SURFACES,
                updateFocusedWindowLocked(UPDATE_FOCUS_WILL_PLACE_SURFACES,
                        false /*updateInputWindows*/);
                        false /*updateInputWindows*/);
                performLayoutAndPlaceSurfacesLocked();
                performLayoutAndPlaceSurfacesLocked();
@@ -2427,7 +2425,7 @@ public class WindowManagerService extends IWindowManager.Stub


        if (!mInLayout) {
        if (!mInLayout) {
            assignLayersLocked(windows);
            assignLayersLocked(windows);
            mLayoutNeeded = true;
            win.mDisplayContent.layoutNeeded = true;
            performLayoutAndPlaceSurfacesLocked();
            performLayoutAndPlaceSurfacesLocked();
            if (win.mAppToken != null) {
            if (win.mAppToken != null) {
                win.mAppToken.updateReportedVisibilityLocked();
                win.mAppToken.updateReportedVisibilityLocked();
@@ -2493,7 +2491,7 @@ public class WindowManagerService extends IWindowManager.Stub
                        w.mGivenVisibleInsets.scale(w.mGlobalScale);
                        w.mGivenVisibleInsets.scale(w.mGlobalScale);
                        w.mGivenTouchableRegion.scale(w.mGlobalScale);
                        w.mGivenTouchableRegion.scale(w.mGlobalScale);
                    }
                    }
                    mLayoutNeeded = true;
                    w.mDisplayContent.layoutNeeded = true;
                    performLayoutAndPlaceSurfacesLocked();
                    performLayoutAndPlaceSurfacesLocked();
                }
                }
            }
            }
@@ -2588,7 +2586,7 @@ public class WindowManagerService extends IWindowManager.Stub
        window.mGivenTouchableRegion.op((int)dispRect.left, (int)dispRect.top,
        window.mGivenTouchableRegion.op((int)dispRect.left, (int)dispRect.top,
                (int)dispRect.right, (int)dispRect.bottom, Region.Op.DIFFERENCE);
                (int)dispRect.right, (int)dispRect.bottom, Region.Op.DIFFERENCE);
        window.mTouchableInsets = ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION;
        window.mTouchableInsets = ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION;
        mLayoutNeeded = true;
        window.mDisplayContent.layoutNeeded = true;
        performLayoutAndPlaceSurfacesLocked();
        performLayoutAndPlaceSurfacesLocked();
    }
    }


@@ -2856,7 +2854,7 @@ public class WindowManagerService extends IWindowManager.Stub
                }
                }
            }
            }


            mLayoutNeeded = true;
            win.mDisplayContent.layoutNeeded = true;
            win.mGivenInsetsPending = (flags&WindowManagerGlobal.RELAYOUT_INSETS_PENDING) != 0;
            win.mGivenInsetsPending = (flags&WindowManagerGlobal.RELAYOUT_INSETS_PENDING) != 0;
            if (assignLayers) {
            if (assignLayers) {
                assignLayersLocked(win.getWindowList());
                assignLayersLocked(win.getWindowList());
@@ -2946,7 +2944,7 @@ public class WindowManagerService extends IWindowManager.Stub
                if ((win.mAttrs.flags&FLAG_SHOW_WALLPAPER) != 0) {
                if ((win.mAttrs.flags&FLAG_SHOW_WALLPAPER) != 0) {
                    adjustWallpaperWindowsLocked();
                    adjustWallpaperWindowsLocked();
                }
                }
                mLayoutNeeded = true;
                win.mDisplayContent.layoutNeeded = true;
                performLayoutAndPlaceSurfacesLocked();
                performLayoutAndPlaceSurfacesLocked();
            }
            }
        }
        }
@@ -3460,11 +3458,11 @@ public class WindowManagerService extends IWindowManager.Stub
                            win.mWinAnimator.applyAnimationLocked(WindowManagerPolicy.TRANSIT_EXIT,
                            win.mWinAnimator.applyAnimationLocked(WindowManagerPolicy.TRANSIT_EXIT,
                                    false);
                                    false);
                            changed = true;
                            changed = true;
                            win.mDisplayContent.layoutNeeded = true;
                        }
                        }
                    }
                    }


                    if (changed) {
                    if (changed) {
                        mLayoutNeeded = true;
                        performLayoutAndPlaceSurfacesLocked();
                        performLayoutAndPlaceSurfacesLocked();
                        updateFocusedWindowLocked(UPDATE_FOCUS_NORMAL,
                        updateFocusedWindowLocked(UPDATE_FOCUS_NORMAL,
                                false /*updateInputWindows*/);
                                false /*updateInputWindows*/);
@@ -3720,7 +3718,7 @@ public class WindowManagerService extends IWindowManager.Stub
            if (computeScreenConfigurationLocked(mTempConfiguration)) {
            if (computeScreenConfigurationLocked(mTempConfiguration)) {
                if (currentConfig.diff(mTempConfiguration) != 0) {
                if (currentConfig.diff(mTempConfiguration) != 0) {
                    mWaitingForConfig = true;
                    mWaitingForConfig = true;
                    mLayoutNeeded = true;
                    getDefaultDisplayContent().layoutNeeded = true;
                    startFreezingDisplayLocked(false);
                    startFreezingDisplayLocked(false);
                    config = new Configuration(mTempConfiguration);
                    config = new Configuration(mTempConfiguration);
                }
                }
@@ -4086,7 +4084,7 @@ public class WindowManagerService extends IWindowManager.Stub


                        updateFocusedWindowLocked(UPDATE_FOCUS_WILL_PLACE_SURFACES,
                        updateFocusedWindowLocked(UPDATE_FOCUS_WILL_PLACE_SURFACES,
                                true /*updateInputWindows*/);
                                true /*updateInputWindows*/);
                        mLayoutNeeded = true;
                        getDefaultDisplayContent().layoutNeeded = true;
                        performLayoutAndPlaceSurfacesLocked();
                        performLayoutAndPlaceSurfacesLocked();
                        Binder.restoreCallingIdentity(origId);
                        Binder.restoreCallingIdentity(origId);
                        return;
                        return;
@@ -4251,6 +4249,7 @@ public class WindowManagerService extends IWindowManager.Stub
                                    WindowManagerPolicy.TRANSIT_ENTER, true);
                                    WindowManagerPolicy.TRANSIT_ENTER, true);
                        }
                        }
                        changed = true;
                        changed = true;
                        win.mDisplayContent.layoutNeeded = true;
                    }
                    }
                } else if (win.isVisibleNow()) {
                } else if (win.isVisibleNow()) {
                    if (!runningAppAnimation) {
                    if (!runningAppAnimation) {
@@ -4258,6 +4257,7 @@ public class WindowManagerService extends IWindowManager.Stub
                                WindowManagerPolicy.TRANSIT_EXIT, false);
                                WindowManagerPolicy.TRANSIT_EXIT, false);
                    }
                    }
                    changed = true;
                    changed = true;
                    win.mDisplayContent.layoutNeeded = true;
                }
                }
            }
            }


@@ -4279,7 +4279,6 @@ public class WindowManagerService extends IWindowManager.Stub
                      + wtoken.hiddenRequested);
                      + wtoken.hiddenRequested);


            if (changed) {
            if (changed) {
                mLayoutNeeded = true;
                mInputMonitor.setUpdateInputWindowsNeededLw();
                mInputMonitor.setUpdateInputWindowsNeededLw();
                if (performLayout) {
                if (performLayout) {
                    updateFocusedWindowLocked(UPDATE_FOCUS_WILL_PLACE_SURFACES,
                    updateFocusedWindowLocked(UPDATE_FOCUS_WILL_PLACE_SURFACES,
@@ -4407,6 +4406,7 @@ public class WindowManagerService extends IWindowManager.Stub
                        mInnerFields.mOrientationChangeComplete = false;
                        mInnerFields.mOrientationChangeComplete = false;
                    }
                    }
                    unfrozeWindows = true;
                    unfrozeWindows = true;
                    w.mDisplayContent.layoutNeeded = true;
                }
                }
            }
            }
            if (force || unfrozeWindows) {
            if (force || unfrozeWindows) {
@@ -4416,7 +4416,6 @@ public class WindowManagerService extends IWindowManager.Stub
            }
            }
            if (unfreezeSurfaceNow) {
            if (unfreezeSurfaceNow) {
                if (unfrozeWindows) {
                if (unfrozeWindows) {
                    mLayoutNeeded = true;
                    performLayoutAndPlaceSurfacesLocked();
                    performLayoutAndPlaceSurfacesLocked();
                }
                }
                stopFreezingDisplayLocked();
                stopFreezingDisplayLocked();
@@ -4761,13 +4760,15 @@ public class WindowManagerService extends IWindowManager.Stub
                        final DisplayContent displayContent = iterator.next();
                        final DisplayContent displayContent = iterator.next();
                        final WindowList windows = displayContent.getWindowList();
                        final WindowList windows = displayContent.getWindowList();
                        final int pos = findWindowOffsetLocked(windows, index);
                        final int pos = findWindowOffsetLocked(windows, index);
                        reAddAppWindowsLocked(displayContent, pos, wtoken);
                        final int newPos = reAddAppWindowsLocked(displayContent, pos, wtoken);
                        if (pos != newPos) {
                            displayContent.layoutNeeded = true;
                        }
                    }
                    }
                    if (DEBUG_REORDER) Slog.v(TAG, "Final window list:");
                    if (DEBUG_REORDER) Slog.v(TAG, "Final window list:");
                    if (DEBUG_REORDER) dumpWindowsLocked();
                    if (DEBUG_REORDER) dumpWindowsLocked();
                    updateFocusedWindowLocked(UPDATE_FOCUS_WILL_PLACE_SURFACES,
                    updateFocusedWindowLocked(UPDATE_FOCUS_WILL_PLACE_SURFACES,
                            false /*updateInputWindows*/);
                            false /*updateInputWindows*/);
                    mLayoutNeeded = true;
                    mInputMonitor.setUpdateInputWindowsNeededLw();
                    mInputMonitor.setUpdateInputWindowsNeededLw();
                    performLayoutAndPlaceSurfacesLocked();
                    performLayoutAndPlaceSurfacesLocked();
                    mInputMonitor.updateInputWindowsLw(false /*force*/);
                    mInputMonitor.updateInputWindowsLw(false /*force*/);
@@ -4807,7 +4808,10 @@ public class WindowManagerService extends IWindowManager.Stub
            final DisplayContent displayContent = iterator.next();
            final DisplayContent displayContent = iterator.next();
            final WindowList windows = displayContent.getWindowList();
            final WindowList windows = displayContent.getWindowList();
            final int pos = findWindowOffsetLocked(windows, tokenPos);
            final int pos = findWindowOffsetLocked(windows, tokenPos);
            reAddAppWindowsLocked(displayContent, pos, wtoken);
            final int newPos = reAddAppWindowsLocked(displayContent, pos, wtoken);
            if (pos != newPos) {
                displayContent.layoutNeeded = true;
            }


            if (updateFocusAndLayout && !updateFocusedWindowLocked(UPDATE_FOCUS_WILL_PLACE_SURFACES,
            if (updateFocusAndLayout && !updateFocusedWindowLocked(UPDATE_FOCUS_WILL_PLACE_SURFACES,
                    false /*updateInputWindows*/)) {
                    false /*updateInputWindows*/)) {
@@ -4820,7 +4824,6 @@ public class WindowManagerService extends IWindowManager.Stub


            // Note that the above updateFocusedWindowLocked conditional used to sit here.
            // Note that the above updateFocusedWindowLocked conditional used to sit here.


            mLayoutNeeded = true;
            if (!mInLayout) {
            if (!mInLayout) {
                performLayoutAndPlaceSurfacesLocked();
                performLayoutAndPlaceSurfacesLocked();
            }
            }
@@ -4849,7 +4852,11 @@ public class WindowManagerService extends IWindowManager.Stub
            for (i=0; i<N; i++) {
            for (i=0; i<N; i++) {
                WindowToken token = mTokenMap.get(tokens.get(i));
                WindowToken token = mTokenMap.get(tokens.get(i));
                if (token != null) {
                if (token != null) {
                    pos = reAddAppWindowsLocked(displayContent, pos, token);
                    final int newPos = reAddAppWindowsLocked(displayContent, pos, token);
                    if (newPos != pos) {
                        displayContent.layoutNeeded = true;
                    }
                    pos = newPos;
                }
                }
            }
            }
            if (!updateFocusedWindowLocked(UPDATE_FOCUS_WILL_PLACE_SURFACES,
            if (!updateFocusedWindowLocked(UPDATE_FOCUS_WILL_PLACE_SURFACES,
@@ -4862,7 +4869,6 @@ public class WindowManagerService extends IWindowManager.Stub


        // Note that the above updateFocusedWindowLocked used to sit here.
        // Note that the above updateFocusedWindowLocked used to sit here.


        mLayoutNeeded = true;
        performLayoutAndPlaceSurfacesLocked();
        performLayoutAndPlaceSurfacesLocked();
        mInputMonitor.updateInputWindowsLw(false /*force*/);
        mInputMonitor.updateInputWindowsLw(false /*force*/);


@@ -5656,7 +5662,7 @@ public class WindowManagerService extends IWindowManager.Stub
        synchronized(mWindowMap) {
        synchronized(mWindowMap) {
            changed = updateRotationUncheckedLocked(false);
            changed = updateRotationUncheckedLocked(false);
            if (!changed || forceRelayout) {
            if (!changed || forceRelayout) {
                mLayoutNeeded = true;
                getDefaultDisplayContent().layoutNeeded = true;
                performLayoutAndPlaceSurfacesLocked();
                performLayoutAndPlaceSurfacesLocked();
            }
            }
        }
        }
@@ -5734,7 +5740,7 @@ public class WindowManagerService extends IWindowManager.Stub
        mH.removeMessages(H.WINDOW_FREEZE_TIMEOUT);
        mH.removeMessages(H.WINDOW_FREEZE_TIMEOUT);
        mH.sendMessageDelayed(mH.obtainMessage(H.WINDOW_FREEZE_TIMEOUT), 2000);
        mH.sendMessageDelayed(mH.obtainMessage(H.WINDOW_FREEZE_TIMEOUT), 2000);
        mWaitingForConfig = true;
        mWaitingForConfig = true;
        mLayoutNeeded = true;
        getDefaultDisplayContent().layoutNeeded = true;
        startFreezingDisplayLocked(inTransaction);
        startFreezingDisplayLocked(inTransaction);
        mInputManager.setDisplayOrientation(0, rotation);
        mInputManager.setDisplayOrientation(0, rotation);


@@ -7579,7 +7585,7 @@ public class WindowManagerService extends IWindowManager.Stub
        mPolicy.setInitialDisplaySize(mDefaultDisplay, displayContent.mBaseDisplayWidth,
        mPolicy.setInitialDisplaySize(mDefaultDisplay, displayContent.mBaseDisplayWidth,
                displayContent.mBaseDisplayHeight, displayContent.mBaseDisplayDensity);
                displayContent.mBaseDisplayHeight, displayContent.mBaseDisplayDensity);


        mLayoutNeeded = true;
        displayContent.layoutNeeded = true;


        boolean configChanged = updateOrientationFromAppTokensLocked(false);
        boolean configChanged = updateOrientationFromAppTokensLocked(false);
        mTempConfiguration.setToDefaults();
        mTempConfiguration.setToDefaults();
@@ -7838,7 +7844,7 @@ public class WindowManagerService extends IWindowManager.Stub


            mInLayout = false;
            mInLayout = false;


            if (mLayoutNeeded) {
            if (needsLayout()) {
                if (++mLayoutRepeatCount < 6) {
                if (++mLayoutRepeatCount < 6) {
                    requestTraversalLocked();
                    requestTraversalLocked();
                } else {
                } else {
@@ -7863,11 +7869,11 @@ public class WindowManagerService extends IWindowManager.Stub


    private final void performLayoutLockedInner(final DisplayContent displayContent,
    private final void performLayoutLockedInner(final DisplayContent displayContent,
                                    boolean initial, boolean updateInputWindows) {
                                    boolean initial, boolean updateInputWindows) {
        if (!mLayoutNeeded) {
        if (!displayContent.layoutNeeded) {
            return;
            return;
        }
        }
        displayContent.layoutNeeded = false;
        WindowList windows = displayContent.getWindowList();
        WindowList windows = displayContent.getWindowList();
        mLayoutNeeded = false;


        DisplayInfo displayInfo = displayContent.getDisplayInfo();
        DisplayInfo displayInfo = displayContent.getDisplayInfo();
        final int dw = displayInfo.logicalWidth;
        final int dw = displayInfo.logicalWidth;
@@ -7884,7 +7890,7 @@ public class WindowManagerService extends IWindowManager.Stub
        if (DEBUG_LAYOUT) {
        if (DEBUG_LAYOUT) {
            Slog.v(TAG, "-------------------------------------");
            Slog.v(TAG, "-------------------------------------");
            Slog.v(TAG, "performLayout: needed="
            Slog.v(TAG, "performLayout: needed="
                    + mLayoutNeeded + " dw=" + dw + " dh=" + dh);
                    + displayContent.layoutNeeded + " dw=" + dw + " dh=" + dh);
        }
        }


        WindowStateAnimator universeBackground = null;
        WindowStateAnimator universeBackground = null;
@@ -8029,8 +8035,7 @@ public class WindowManagerService extends IWindowManager.Stub


    /**
    /**
     * Extracted from {@link #performLayoutAndPlaceSurfacesLockedInner} to reduce size of method.
     * Extracted from {@link #performLayoutAndPlaceSurfacesLockedInner} to reduce size of method.
     * @param windows TODO(cmautner):
     * @param windows List of windows on default display.
     *
     * @return bitmap indicating if another pass through layout must be made.
     * @return bitmap indicating if another pass through layout must be made.
     */
     */
    public int handleAppTransitionReadyLocked(WindowList windows) {
    public int handleAppTransitionReadyLocked(WindowList windows) {
@@ -8286,7 +8291,7 @@ public class WindowManagerService extends IWindowManager.Stub
            // a new layout to get them all up-to-date.
            // a new layout to get them all up-to-date.
            changes |= WindowManagerPolicy.FINISH_LAYOUT_REDO_LAYOUT
            changes |= WindowManagerPolicy.FINISH_LAYOUT_REDO_LAYOUT
                    | WindowManagerPolicy.FINISH_LAYOUT_REDO_CONFIG;
                    | WindowManagerPolicy.FINISH_LAYOUT_REDO_CONFIG;
            mLayoutNeeded = true;
            getDefaultDisplayContent().layoutNeeded = true;


            // TODO(multidisplay): IMEs are only supported on the default display.
            // TODO(multidisplay): IMEs are only supported on the default display.
            if (windows == getDefaultWindowList() && !moveInputMethodWindowsIfNeededLocked(true)) {
            if (windows == getDefaultWindowList() && !moveInputMethodWindowsIfNeededLocked(true)) {
@@ -8574,19 +8579,18 @@ public class WindowManagerService extends IWindowManager.Stub
                final DisplayContent displayContent = iterator.next();
                final DisplayContent displayContent = iterator.next();
                WindowList windows = displayContent.getWindowList();
                WindowList windows = displayContent.getWindowList();
                DisplayInfo displayInfo = displayContent.getDisplayInfo();
                DisplayInfo displayInfo = displayContent.getDisplayInfo();
                final int displayId = displayContent.getDisplayId();
                final int dw = displayInfo.logicalWidth;
                final int dw = displayInfo.logicalWidth;
                final int dh = displayInfo.logicalHeight;
                final int dh = displayInfo.logicalHeight;
                final int innerDw = displayInfo.appWidth;
                final int innerDw = displayInfo.appWidth;
                final int innerDh = displayInfo.appHeight;
                final int innerDh = displayInfo.appHeight;
                final boolean isDefaultDisplay =
                final boolean isDefaultDisplay = (displayId == Display.DEFAULT_DISPLAY);
                        displayContent.getDisplayId() == Display.DEFAULT_DISPLAY;


                int repeats = 0;
                int repeats = 0;
                do {
                do {
                    repeats++;
                    repeats++;
                    if (repeats > 6) {
                    if (repeats > 6) {
                        Slog.w(TAG, "Animation repeat aborted after too many iterations");
                        Slog.w(TAG, "Animation repeat aborted after too many iterations");
                        mLayoutNeeded = false;
                        displayContent.layoutNeeded = false;
                        displayContent.layoutNeeded = false;
                        break;
                        break;
                    }
                    }
@@ -8599,7 +8603,6 @@ public class WindowManagerService extends IWindowManager.Stub
                            && ((adjustWallpaperWindowsLocked()
                            && ((adjustWallpaperWindowsLocked()
                                    & ADJUST_WALLPAPER_LAYERS_CHANGED) != 0)) {
                                    & ADJUST_WALLPAPER_LAYERS_CHANGED) != 0)) {
                        assignLayersLocked(windows);
                        assignLayersLocked(windows);
                        mLayoutNeeded = true;
                        displayContent.layoutNeeded = true;
                        displayContent.layoutNeeded = true;
                    }
                    }


@@ -8607,7 +8610,6 @@ public class WindowManagerService extends IWindowManager.Stub
                            & WindowManagerPolicy.FINISH_LAYOUT_REDO_CONFIG) != 0) {
                            & WindowManagerPolicy.FINISH_LAYOUT_REDO_CONFIG) != 0) {
                        if (DEBUG_LAYOUT) Slog.v(TAG, "Computing new config from layout");
                        if (DEBUG_LAYOUT) Slog.v(TAG, "Computing new config from layout");
                        if (updateOrientationFromAppTokensLocked(true)) {
                        if (updateOrientationFromAppTokensLocked(true)) {
                            mLayoutNeeded = true;
                            displayContent.layoutNeeded = true;
                            displayContent.layoutNeeded = true;
                            mH.sendEmptyMessage(H.SEND_NEW_CONFIGURATION);
                            mH.sendEmptyMessage(H.SEND_NEW_CONFIGURATION);
                        }
                        }
@@ -8615,7 +8617,6 @@ public class WindowManagerService extends IWindowManager.Stub


                    if ((displayContent.pendingLayoutChanges
                    if ((displayContent.pendingLayoutChanges
                            & WindowManagerPolicy.FINISH_LAYOUT_REDO_LAYOUT) != 0) {
                            & WindowManagerPolicy.FINISH_LAYOUT_REDO_LAYOUT) != 0) {
                        mLayoutNeeded = true;
                        displayContent.layoutNeeded = true;
                        displayContent.layoutNeeded = true;
                    }
                    }


@@ -8858,7 +8859,7 @@ public class WindowManagerService extends IWindowManager.Stub
            }
            }
        }
        }


        if (mLayoutNeeded) {
        if (needsLayout()) {
            defaultDisplay.pendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_LAYOUT;
            defaultDisplay.pendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_LAYOUT;
            if (DEBUG_LAYOUT_REPEATS) debugLayoutRepeats("mLayoutNeeded",
            if (DEBUG_LAYOUT_REPEATS) debugLayoutRepeats("mLayoutNeeded",
                    defaultDisplay.pendingLayoutChanges);
                    defaultDisplay.pendingLayoutChanges);
@@ -8969,15 +8970,15 @@ public class WindowManagerService extends IWindowManager.Stub
            mRelayoutWhileAnimating.clear();
            mRelayoutWhileAnimating.clear();
        }
        }


        if (wallpaperDestroyed) {
        if (wallpaperDestroyed && (adjustWallpaperWindowsLocked() != 0)) {
            mLayoutNeeded |= adjustWallpaperWindowsLocked() != 0;
            getDefaultDisplayContent().layoutNeeded = true;
        }
        }


        DisplayContentsIterator iterator = new DisplayContentsIterator();
        DisplayContentsIterator iterator = new DisplayContentsIterator();
        while (iterator.hasNext()) {
        while (iterator.hasNext()) {
            DisplayContent displayContent = iterator.next();
            DisplayContent displayContent = iterator.next();
            if (displayContent.pendingLayoutChanges != 0) {
            if (displayContent.pendingLayoutChanges != 0) {
                mLayoutNeeded = true;
                displayContent.layoutNeeded = true;
            }
            }
        }
        }


@@ -9015,8 +9016,8 @@ public class WindowManagerService extends IWindowManager.Stub
            }
            }
        }
        }


        if (mInnerFields.mOrientationChangeComplete && !mLayoutNeeded &&
        if (mInnerFields.mOrientationChangeComplete && !defaultDisplay.layoutNeeded
                !mInnerFields.mUpdateRotation) {
                && !mInnerFields.mUpdateRotation) {
            checkDrawnWindowsLocked();
            checkDrawnWindowsLocked();
        }
        }


@@ -9038,8 +9039,8 @@ public class WindowManagerService extends IWindowManager.Stub


            for (DisplayContent displayContent : displayList) {
            for (DisplayContent displayContent : displayList) {
                assignLayersLocked(displayContent.getWindowList());
                assignLayersLocked(displayContent.getWindowList());
                displayContent.layoutNeeded = true;
            }
            }
            mLayoutNeeded = true;
        }
        }


        // Check to see if we are now in a state where the screen should
        // Check to see if we are now in a state where the screen should
@@ -9049,8 +9050,8 @@ public class WindowManagerService extends IWindowManager.Stub
        updateLayoutToAnimationLocked();
        updateLayoutToAnimationLocked();


        if (DEBUG_WINDOW_TRACE) {
        if (DEBUG_WINDOW_TRACE) {
            Slog.e(TAG, "performLayoutAndPlaceSurfacesLockedInner exit: mLayoutNeeded="
            Slog.e(TAG, "performLayoutAndPlaceSurfacesLockedInner exit: animating="
                    + mLayoutNeeded + " animating=" + mAnimator.mAnimating);
                    + mAnimator.mAnimating);
        }
        }
    }
    }


@@ -9206,6 +9207,16 @@ public class WindowManagerService extends IWindowManager.Stub
        setAnimDimParams(null);
        setAnimDimParams(null);
    }
    }


    private boolean needsLayout() {
        DisplayContentsIterator iterator = new DisplayContentsIterator();
        while (iterator.hasNext()) {
            if (iterator.next().layoutNeeded) {
                return true;
            }
        }
        return false;
    }

    private boolean copyAnimToLayoutParamsLocked() {
    private boolean copyAnimToLayoutParamsLocked() {
        boolean doRequest = false;
        boolean doRequest = false;
        final WindowAnimator.AnimatorToLayoutParams animToLayout = mAnimator.mAnimToLayout;
        final WindowAnimator.AnimatorToLayoutParams animToLayout = mAnimator.mAnimToLayout;
@@ -9382,7 +9393,7 @@ public class WindowManagerService extends IWindowManager.Stub
                if (moveInputMethodWindowsIfNeededLocked(
                if (moveInputMethodWindowsIfNeededLocked(
                        mode != UPDATE_FOCUS_WILL_ASSIGN_LAYERS &&
                        mode != UPDATE_FOCUS_WILL_ASSIGN_LAYERS &&
                        mode != UPDATE_FOCUS_WILL_PLACE_SURFACES)) {
                        mode != UPDATE_FOCUS_WILL_PLACE_SURFACES)) {
                    mLayoutNeeded = true;
                    getDefaultDisplayContent().layoutNeeded = true;
                }
                }
                if (mode == UPDATE_FOCUS_PLACING_SURFACES) {
                if (mode == UPDATE_FOCUS_PLACING_SURFACES) {
                    performLayoutLockedInner(displayContent, true /*initial*/, updateInputWindows);
                    performLayoutLockedInner(displayContent, true /*initial*/, updateInputWindows);
@@ -9396,7 +9407,7 @@ public class WindowManagerService extends IWindowManager.Stub


            if ((focusChanged & WindowManagerPolicy.FINISH_LAYOUT_REDO_LAYOUT) != 0) {
            if ((focusChanged & WindowManagerPolicy.FINISH_LAYOUT_REDO_LAYOUT) != 0) {
                // The change in focus caused us to need to do a layout.  Okay.
                // The change in focus caused us to need to do a layout.  Okay.
                mLayoutNeeded = true;
                getDefaultDisplayContent().layoutNeeded = true;
                if (mode == UPDATE_FOCUS_PLACING_SURFACES) {
                if (mode == UPDATE_FOCUS_PLACING_SURFACES) {
                    performLayoutLockedInner(displayContent, true /*initial*/, updateInputWindows);
                    performLayoutLockedInner(displayContent, true /*initial*/, updateInputWindows);
                }
                }
@@ -10058,7 +10069,17 @@ public class WindowManagerService extends IWindowManager.Stub
            }
            }
            pw.print("  mSystemBooted="); pw.print(mSystemBooted);
            pw.print("  mSystemBooted="); pw.print(mSystemBooted);
                    pw.print(" mDisplayEnabled="); pw.println(mDisplayEnabled);
                    pw.print(" mDisplayEnabled="); pw.println(mDisplayEnabled);
            pw.print("  mLayoutNeeded="); pw.print(mLayoutNeeded);
            if (needsLayout()) {
                pw.print("  layoutNeeded on displays=");
                DisplayContentsIterator dcIterator = new DisplayContentsIterator();
                while (dcIterator.hasNext()) {
                    final DisplayContent displayContent = dcIterator.next();
                    if (displayContent.layoutNeeded) {
                        pw.print(displayContent.getDisplayId());
                    }
                }
                pw.println();
            }
            pw.print("mTransactionSequence="); pw.println(mTransactionSequence);
            pw.print("mTransactionSequence="); pw.println(mTransactionSequence);
            pw.print("  mDisplayFrozen="); pw.print(mDisplayFrozen);
            pw.print("  mDisplayFrozen="); pw.print(mDisplayFrozen);
                    pw.print(" mWindowsFreezingScreen="); pw.print(mWindowsFreezingScreen);
                    pw.print(" mWindowsFreezingScreen="); pw.print(mWindowsFreezingScreen);
+7 −1
Original line number Original line Diff line number Diff line
@@ -587,10 +587,12 @@ final class WindowState implements WindowManagerPolicy.WindowState {
        }
        }
    }
    }


    @Override
    public int getSystemUiVisibility() {
    public int getSystemUiVisibility() {
        return mSystemUiVisibility;
        return mSystemUiVisibility;
    }
    }


    @Override
    public int getSurfaceLayer() {
    public int getSurfaceLayer() {
        return mLayer;
        return mLayer;
    }
    }
@@ -599,6 +601,10 @@ final class WindowState implements WindowManagerPolicy.WindowState {
        return mAppToken != null ? mAppToken.appToken : null;
        return mAppToken != null ? mAppToken.appToken : null;
    }
    }


    public int getDisplayId() {
        return mDisplayContent.getDisplayId();
    }

    public long getInputDispatchingTimeoutNanos() {
    public long getInputDispatchingTimeoutNanos() {
        return mAppToken != null
        return mAppToken != null
                ? mAppToken.inputDispatchingTimeoutNanos
                ? mAppToken.inputDispatchingTimeoutNanos
+2 −2
Original line number Original line Diff line number Diff line
@@ -335,7 +335,7 @@ class WindowStateAnimator {
                        + mWin.mPolicyVisibilityAfterAnim);
                        + mWin.mPolicyVisibilityAfterAnim);
            }
            }
            mWin.mPolicyVisibility = mWin.mPolicyVisibilityAfterAnim;
            mWin.mPolicyVisibility = mWin.mPolicyVisibilityAfterAnim;
            mService.mLayoutNeeded = true;
            mWin.mDisplayContent.layoutNeeded = true;
            if (!mWin.mPolicyVisibility) {
            if (!mWin.mPolicyVisibility) {
                if (mService.mCurrentFocus == mWin) {
                if (mService.mCurrentFocus == mWin) {
                    mService.mFocusMayChange = true;
                    mService.mFocusMayChange = true;
@@ -1362,7 +1362,7 @@ class WindowStateAnimator {
                        // do a layout.  If called from within the transaction
                        // do a layout.  If called from within the transaction
                        // loop, this will cause it to restart with a new
                        // loop, this will cause it to restart with a new
                        // layout.
                        // layout.
                        mService.mLayoutNeeded = true;
                        c.mDisplayContent.layoutNeeded = true;
                    }
                    }
                }
                }
            }
            }