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

Commit 9d9d8f1c authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

Cleaned-up RootWindowContainer.applySurfaceChangesTransaction

- Move functionality for determining interesting and all drawn states
of an app token based on the current window we are processing into
AppWindowToken.updateDrawnWindowStates() since it is mostly touching
AppWindowToken variables. Some of the fields can now be made private.
- Removed WindowContainer.updateAllDrawn() and related overrides. We
now have RootWindowContainer collect the app tokens that need to be
processed and call them directly.
- Move code to report window move to client into
WindowState.reportWindowMovedIfNeeded().
- Move WMS.updateResizingWindows() functionality to
WindowState.updateResizingWindow() as it mostly updates window state
internals.

Bug: 31794753
Test: Manual testing and existing unit tests pass.
Change-Id: I7588217d05d3e8971ce61795cb8568d835779c5e
parent c83f46dc
Loading
Loading
Loading
Loading
+108 −25
Original line number Original line Diff line number Diff line
@@ -35,6 +35,7 @@ import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_WINDOW_MOVEME
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
import static com.android.server.wm.WindowManagerService.H.NOTIFY_ACTIVITY_DRAWN;
import static com.android.server.wm.WindowManagerService.H.NOTIFY_ACTIVITY_DRAWN;
import static com.android.server.wm.WindowManagerService.H.NOTIFY_STARTING_WINDOW_DRAWN;
import static com.android.server.wm.WindowStateAnimator.STACK_CLIP_NONE;
import static com.android.server.wm.WindowStateAnimator.STACK_CLIP_NONE;
import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_WILL_PLACE_SURFACES;
import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_WILL_PLACE_SURFACES;
import static com.android.server.wm.WindowManagerService.logWithStack;
import static com.android.server.wm.WindowManagerService.logWithStack;
@@ -91,19 +92,22 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
    // an activity have been drawn, so they can be made visible together
    // an activity have been drawn, so they can be made visible together
    // at the same time.
    // at the same time.
    // initialize so that it doesn't match mTransactionSequence which is an int.
    // initialize so that it doesn't match mTransactionSequence which is an int.
    long lastTransactionSequence = Long.MIN_VALUE;
    private long mLastTransactionSequence = Long.MIN_VALUE;
    int numInterestingWindows;
    private int mNumInterestingWindows;
    int numDrawnWindows;
    private int mNumDrawnWindows;
    boolean inPendingTransaction;
    boolean inPendingTransaction;
    boolean allDrawn;
    boolean allDrawn;
    // Set to true when this app creates a surface while in the middle of an animation. In that
    // Set to true when this app creates a surface while in the middle of an animation. In that
    // case do not clear allDrawn until the animation completes.
    // case do not clear allDrawn until the animation completes.
    boolean deferClearAllDrawn;
    boolean deferClearAllDrawn;


    // These are to track the app's real drawing status if there were no saved surfaces.
    /**
     * These are to track the app's real drawing status if there were no saved surfaces.
     * @see #updateDrawnWindowStates
     */
    boolean allDrawnExcludingSaved;
    boolean allDrawnExcludingSaved;
    int numInterestingWindowsExcludingSaved;
    private int mNumInterestingWindowsExcludingSaved;
    int numDrawnWindowsExcludingSaved;
    private int mNumDrawnWindowsExcludingSaved;


    // Is this window's surface needed?  This is almost like hidden, except
    // Is this window's surface needed?  This is almost like hidden, except
    // it will sometimes be true a little earlier: when the token has
    // it will sometimes be true a little earlier: when the token has
@@ -118,7 +122,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
    boolean reportedVisible;
    boolean reportedVisible;


    // Last drawn state we reported to the app token.
    // Last drawn state we reported to the app token.
    boolean reportedDrawn;
    private boolean reportedDrawn;


    // Set to true when the token has been removed from the window mgr.
    // Set to true when the token has been removed from the window mgr.
    boolean removed;
    boolean removed;
@@ -146,7 +150,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree


    boolean mAppStopped;
    boolean mAppStopped;
    int mRotationAnimationHint;
    int mRotationAnimationHint;
    int mPendingRelaunchCount;
    private int mPendingRelaunchCount;


    private ArrayList<WindowSurfaceController.SurfaceControlWithBackground> mSurfaceViewBackgrounds =
    private ArrayList<WindowSurfaceController.SurfaceControlWithBackground> mSurfaceViewBackgrounds =
        new ArrayList<>();
        new ArrayList<>();
@@ -1037,7 +1041,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
            stopFreezingScreen(false, true);
            stopFreezingScreen(false, true);
            if (DEBUG_ORIENTATION) Slog.i(TAG,
            if (DEBUG_ORIENTATION) Slog.i(TAG,
                    "Setting mOrientationChangeComplete=true because wtoken " + this
                    "Setting mOrientationChangeComplete=true because wtoken " + this
                    + " numInteresting=" + numInterestingWindows + " numDrawn=" + numDrawnWindows);
                    + " numInteresting=" + mNumInterestingWindows + " numDrawn=" + mNumDrawnWindows);
            // This will set mOrientationChangeComplete and cause a pass through layout.
            // This will set mOrientationChangeComplete and cause a pass through layout.
            setAppLayoutChanges(FINISH_LAYOUT_REDO_WALLPAPER,
            setAppLayoutChanges(FINISH_LAYOUT_REDO_WALLPAPER,
                    "checkAppWindowsReadyToShow: freezingScreen", displayId);
                    "checkAppWindowsReadyToShow: freezingScreen", displayId);
@@ -1051,30 +1055,28 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
        }
        }
    }
    }


    @Override
    void updateAllDrawn(DisplayContent dc) {
    void updateAllDrawn(int displayId) {
        final DisplayContent displayContent = mService.mRoot.getDisplayContentOrCreate(displayId);

        if (!allDrawn) {
        if (!allDrawn) {
            final int numInteresting = numInterestingWindows;
            final int numInteresting = mNumInterestingWindows;
            if (numInteresting > 0 && numDrawnWindows >= numInteresting) {
            if (numInteresting > 0 && mNumDrawnWindows >= numInteresting) {
                if (DEBUG_VISIBILITY) Slog.v(TAG, "allDrawn: " + this
                if (DEBUG_VISIBILITY) Slog.v(TAG, "allDrawn: " + this
                        + " interesting=" + numInteresting + " drawn=" + numDrawnWindows);
                        + " interesting=" + numInteresting + " drawn=" + mNumDrawnWindows);
                allDrawn = true;
                allDrawn = true;
                // Force an additional layout pass where
                // Force an additional layout pass where
                // WindowStateAnimator#commitFinishDrawingLocked() will call performShowLocked().
                // WindowStateAnimator#commitFinishDrawingLocked() will call performShowLocked().
                displayContent.setLayoutNeeded();
                dc.setLayoutNeeded();
                mService.mH.obtainMessage(NOTIFY_ACTIVITY_DRAWN, token).sendToTarget();
                mService.mH.obtainMessage(NOTIFY_ACTIVITY_DRAWN, token).sendToTarget();
            }
            }
        }
        }

        if (!allDrawnExcludingSaved) {
        if (!allDrawnExcludingSaved) {
            int numInteresting = numInterestingWindowsExcludingSaved;
            int numInteresting = mNumInterestingWindowsExcludingSaved;
            if (numInteresting > 0 && numDrawnWindowsExcludingSaved >= numInteresting) {
            if (numInteresting > 0 && mNumDrawnWindowsExcludingSaved >= numInteresting) {
                if (DEBUG_VISIBILITY) Slog.v(TAG, "allDrawnExcludingSaved: " + this
                if (DEBUG_VISIBILITY) Slog.v(TAG, "allDrawnExcludingSaved: " + this
                        + " interesting=" + numInteresting
                        + " interesting=" + numInteresting
                        + " drawn=" + numDrawnWindowsExcludingSaved);
                        + " drawn=" + mNumDrawnWindowsExcludingSaved);
                allDrawnExcludingSaved = true;
                allDrawnExcludingSaved = true;
                displayContent.setLayoutNeeded();
                dc.setLayoutNeeded();
                if (isAnimatingInvisibleWithSavedSurface()
                if (isAnimatingInvisibleWithSavedSurface()
                        && !mService.mFinishedEarlyAnim.contains(this)) {
                        && !mService.mFinishedEarlyAnim.contains(this)) {
                    mService.mFinishedEarlyAnim.add(this);
                    mService.mFinishedEarlyAnim.add(this);
@@ -1083,6 +1085,87 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
        }
        }
    }
    }


    /**
     * Updated this app token tracking states for interesting and drawn windows based on the window.
     *
     * @return Returns true if the input window is considered interesting and drawn while all the
     *         windows in this app token where not considered drawn as of the last pass.
     */
    boolean updateDrawnWindowStates(WindowState w) {
        if (DEBUG_STARTING_WINDOW && w == startingWindow) {
            Slog.d(TAG, "updateWindows: starting " + w + " isOnScreen=" + w.isOnScreen()
                    + " allDrawn=" + allDrawn + " freezingScreen=" + mAppAnimator.freezingScreen);
        }

        if (allDrawn && allDrawnExcludingSaved && !mAppAnimator.freezingScreen) {
            return false;
        }

        if (mLastTransactionSequence != mService.mTransactionSequence) {
            mLastTransactionSequence = mService.mTransactionSequence;
            mNumInterestingWindows = mNumDrawnWindows = 0;
            mNumInterestingWindowsExcludingSaved = 0;
            mNumDrawnWindowsExcludingSaved = 0;
            startingDisplayed = false;
        }

        final WindowStateAnimator winAnimator = w.mWinAnimator;

        boolean isInterestingAndDrawn = false;

        if (!allDrawn && w.mightAffectAllDrawn(false /* visibleOnly */)) {
            if (DEBUG_VISIBILITY || DEBUG_ORIENTATION) {
                Slog.v(TAG, "Eval win " + w + ": isDrawn=" + w.isDrawnLw()
                        + ", isAnimationSet=" + winAnimator.isAnimationSet());
                if (!w.isDrawnLw()) {
                    Slog.v(TAG, "Not displayed: s=" + winAnimator.mSurfaceController
                            + " pv=" + w.mPolicyVisibility
                            + " mDrawState=" + winAnimator.drawStateToString()
                            + " ph=" + w.isParentWindowHidden() + " th=" + hiddenRequested
                            + " a=" + winAnimator.mAnimating);
                }
            }

            if (w != startingWindow) {
                if (w.isInteresting()) {
                    mNumInterestingWindows++;
                    if (w.isDrawnLw()) {
                        mNumDrawnWindows++;

                        if (DEBUG_VISIBILITY || DEBUG_ORIENTATION) Slog.v(TAG, "tokenMayBeDrawn: "
                                + this + " w=" + w + " numInteresting=" + mNumInterestingWindows
                                + " freezingScreen=" + mAppAnimator.freezingScreen
                                + " mAppFreezing=" + w.mAppFreezing);

                        isInterestingAndDrawn = true;
                    }
                }
            } else if (w.isDrawnLw()) {
                mService.mH.sendEmptyMessage(NOTIFY_STARTING_WINDOW_DRAWN);
                startingDisplayed = true;
            }
        }

        if (!allDrawnExcludingSaved && w.mightAffectAllDrawn(true /* visibleOnly */)) {
            if (w != startingWindow && w.isInteresting()) {
                mNumInterestingWindowsExcludingSaved++;
                if (w.isDrawnLw() && !w.isAnimatingWithSavedSurface()) {
                    mNumDrawnWindowsExcludingSaved++;

                    if (DEBUG_VISIBILITY || DEBUG_ORIENTATION) Slog.v(TAG,
                            "tokenMayBeDrawnExcludingSaved: " + this + " w=" + w
                            + " numInteresting=" + mNumInterestingWindowsExcludingSaved
                            + " freezingScreen=" + mAppAnimator.freezingScreen
                            + " mAppFreezing=" + w.mAppFreezing);

                    isInterestingAndDrawn = true;
                }
            }
        }

        return isInterestingAndDrawn;
    }

    @Override
    @Override
    void stepAppWindowsAnimation(long currentTime, int displayId) {
    void stepAppWindowsAnimation(long currentTime, int displayId) {
        mAppAnimator.wasAnimating = mAppAnimator.animating;
        mAppAnimator.wasAnimating = mAppAnimator.animating;
@@ -1144,11 +1227,11 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
        if (mAppStopped) {
        if (mAppStopped) {
            pw.print(prefix); pw.print("mAppStopped="); pw.println(mAppStopped);
            pw.print(prefix); pw.print("mAppStopped="); pw.println(mAppStopped);
        }
        }
        if (numInterestingWindows != 0 || numDrawnWindows != 0
        if (mNumInterestingWindows != 0 || mNumDrawnWindows != 0
                || allDrawn || mAppAnimator.allDrawn) {
                || allDrawn || mAppAnimator.allDrawn) {
            pw.print(prefix); pw.print("numInterestingWindows=");
            pw.print(prefix); pw.print("mNumInterestingWindows=");
                    pw.print(numInterestingWindows);
                    pw.print(mNumInterestingWindows);
                    pw.print(" numDrawnWindows="); pw.print(numDrawnWindows);
                    pw.print(" mNumDrawnWindows="); pw.print(mNumDrawnWindows);
                    pw.print(" inPendingTransaction="); pw.print(inPendingTransaction);
                    pw.print(" inPendingTransaction="); pw.print(inPendingTransaction);
                    pw.print(" allDrawn="); pw.print(allDrawn);
                    pw.print(" allDrawn="); pw.print(allDrawn);
                    pw.print(" (animator="); pw.print(mAppAnimator.allDrawn);
                    pw.print(" (animator="); pw.print(mAppAnimator.allDrawn);
+0 −4
Original line number Original line Diff line number Diff line
@@ -240,10 +240,6 @@ class DisplayContent extends WindowContainer<TaskStack> {
        super.checkAppWindowsReadyToShow(mDisplayId);
        super.checkAppWindowsReadyToShow(mDisplayId);
    }
    }


    void updateAllDrawn() {
        super.updateAllDrawn(mDisplayId);
    }

    void stepAppWindowsAnimation(long currentTime) {
    void stepAppWindowsAnimation(long currentTime) {
        super.stepAppWindowsAnimation(currentTime, mDisplayId);
        super.stepAppWindowsAnimation(currentTime, mDisplayId);
    }
    }
+16 −107
Original line number Original line Diff line number Diff line
@@ -41,12 +41,12 @@ import com.android.server.input.InputWindowHandle;
import java.io.FileDescriptor;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.ArrayList;
import java.util.LinkedList;


import static android.app.ActivityManager.StackId.DOCKED_STACK_ID;
import static android.app.ActivityManager.StackId.DOCKED_STACK_ID;
import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_KEYGUARD;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_KEYGUARD;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE;
import static android.view.WindowManager.LayoutParams.TYPE_DREAM;
import static android.view.WindowManager.LayoutParams.TYPE_DREAM;
import static android.view.WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG;
import static android.view.WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG;
@@ -65,7 +65,6 @@ import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_LAYOUT_REPEAT
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ORIENTATION;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ORIENTATION;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_POWER;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_POWER;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_STACK;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_STACK;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_STARTING_WINDOW;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_TOKEN_MOVEMENT;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_TOKEN_MOVEMENT;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_VISIBILITY;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_VISIBILITY;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_WALLPAPER_LIGHT;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_WALLPAPER_LIGHT;
@@ -76,7 +75,6 @@ import static com.android.server.wm.WindowManagerDebugConfig.SHOW_TRANSACTIONS;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_KEEP_SCREEN_ON;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_KEEP_SCREEN_ON;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
import static com.android.server.wm.WindowManagerService.H.NOTIFY_STARTING_WINDOW_DRAWN;
import static com.android.server.wm.WindowManagerService.H.REPORT_LOSING_FOCUS;
import static com.android.server.wm.WindowManagerService.H.REPORT_LOSING_FOCUS;
import static com.android.server.wm.WindowManagerService.H.SEND_NEW_CONFIGURATION;
import static com.android.server.wm.WindowManagerService.H.SEND_NEW_CONFIGURATION;
import static com.android.server.wm.WindowManagerService.LAYOUT_REPEAT_THRESHOLD;
import static com.android.server.wm.WindowManagerService.LAYOUT_REPEAT_THRESHOLD;
@@ -136,6 +134,8 @@ class RootWindowContainer extends WindowContainer<DisplayContent> {


    private final ArrayList<Integer> mChangedStackList = new ArrayList();
    private final ArrayList<Integer> mChangedStackList = new ArrayList();


    private final LinkedList<AppWindowToken> mTmpUpdateAllDrawn = new LinkedList();

    // State for the RemoteSurfaceTrace system used in testing. If this is enabled SurfaceControl
    // State for the RemoteSurfaceTrace system used in testing. If this is enabled SurfaceControl
    // instances will be replaced with an instance that writes a binary representation of all
    // instances will be replaced with an instance that writes a binary representation of all
    // commands to mSurfaceTraceFd.
    // commands to mSurfaceTraceFd.
@@ -707,7 +707,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent> {
                ">>> OPEN TRANSACTION performLayoutAndPlaceSurfaces");
                ">>> OPEN TRANSACTION performLayoutAndPlaceSurfaces");
        mService.openSurfaceTransaction();
        mService.openSurfaceTransaction();
        try {
        try {
            mService.mRoot.applySurfaceChangesTransaction(recoveringMemory, defaultDw, defaultDh);
            applySurfaceChangesTransaction(recoveringMemory, defaultDw, defaultDh);
        } catch (RuntimeException e) {
        } catch (RuntimeException e) {
            Slog.wtf(TAG, "Unhandled exception in Window Manager", e);
            Slog.wtf(TAG, "Unhandled exception in Window Manager", e);
        } finally {
        } finally {
@@ -990,7 +990,6 @@ class RootWindowContainer extends WindowContainer<DisplayContent> {
        final int count = mChildren.size();
        final int count = mChildren.size();
        for (int j = 0; j < count; ++j) {
        for (int j = 0; j < count; ++j) {
            final DisplayContent dc = mChildren.get(j);
            final DisplayContent dc = mChildren.get(j);
            boolean updateAllDrawn = false;
            WindowList windows = dc.getWindowList();
            WindowList windows = dc.getWindowList();
            DisplayInfo displayInfo = dc.getDisplayInfo();
            DisplayInfo displayInfo = dc.getDisplayInfo();
            final int displayId = dc.getDisplayId();
            final int displayId = dc.getDisplayId();
@@ -1003,6 +1002,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent> {
            mDisplayHasContent = false;
            mDisplayHasContent = false;
            mPreferredRefreshRate = 0;
            mPreferredRefreshRate = 0;
            mPreferredModeId = 0;
            mPreferredModeId = 0;
            mTmpUpdateAllDrawn.clear();


            int repeats = 0;
            int repeats = 0;
            do {
            do {
@@ -1086,44 +1086,13 @@ class RootWindowContainer extends WindowContainer<DisplayContent> {
                if (isDefaultDisplay && obscuredChanged && w.isVisibleLw()
                if (isDefaultDisplay && obscuredChanged && w.isVisibleLw()
                        && mService.mWallpaperControllerLocked.isWallpaperTarget(w)) {
                        && mService.mWallpaperControllerLocked.isWallpaperTarget(w)) {
                    // This is the wallpaper target and its obscured state changed... make sure the
                    // This is the wallpaper target and its obscured state changed... make sure the
                    // current wallaper's visibility has been updated accordingly.
                    // current wallpaper's visibility has been updated accordingly.
                    mService.mWallpaperControllerLocked.updateWallpaperVisibility();
                    mService.mWallpaperControllerLocked.updateWallpaperVisibility();
                }
                }


                final WindowStateAnimator winAnimator = w.mWinAnimator;
                w.handleWindowMovedIfNeeded();

                // If the window has moved due to its containing content frame changing, then
                // notify the listeners and optionally animate it. Simply checking a change of
                // position is not enough, because being move due to dock divider is not a trigger
                // for animation.
                if (w.hasMoved()) {
                    // Frame has moved, containing content frame has also moved, and we're not
                    // currently animating... let's do something.
                    final int left = w.mFrame.left;
                    final int top = w.mFrame.top;
                    final boolean adjustedForMinimizedDockOrIme = task != null
                            && (task.mStack.isAdjustedForMinimizedDockedStack()
                            || task.mStack.isAdjustedForIme());
                    if (mService.okToDisplay()
                            && (w.mAttrs.privateFlags & PRIVATE_FLAG_NO_MOVE_ANIMATION) == 0
                            && !w.isDragResizing() && !adjustedForMinimizedDockOrIme
                            && (task == null || w.getTask().mStack.hasMovementAnimations())
                            && !w.mWinAnimator.mLastHidden) {
                        winAnimator.setMoveAnimation(left, top);
                    }

                    //TODO (multidisplay): Accessibility supported only for the default display.
                    if (mService.mAccessibilityController != null
                            && displayId == Display.DEFAULT_DISPLAY) {
                        mService.mAccessibilityController.onSomeWindowResizedOrMovedLocked();
                    }


                    try {
                final WindowStateAnimator winAnimator = w.mWinAnimator;
                        w.mClient.moved(left, top);
                    } catch (RemoteException e) {
                    }
                    w.mMovedByResize = false;
                }


                //Slog.i(TAG, "Window " + this + " clearing mContentChanged - done placing");
                //Slog.i(TAG, "Window " + this + " clearing mContentChanged - done placing");
                w.mContentChanged = false;
                w.mContentChanged = false;
@@ -1171,71 +1140,10 @@ class RootWindowContainer extends WindowContainer<DisplayContent> {
                }
                }


                final AppWindowToken atoken = w.mAppToken;
                final AppWindowToken atoken = w.mAppToken;
                if (DEBUG_STARTING_WINDOW && atoken != null && w == atoken.startingWindow) {
                if (atoken != null) {
                    Slog.d(TAG, "updateWindows: starting " + w
                    final boolean updateAllDrawn = atoken.updateDrawnWindowStates(w);
                            + " isOnScreen=" + w.isOnScreen() + " allDrawn=" + atoken.allDrawn
                    if (updateAllDrawn && !mTmpUpdateAllDrawn.contains(atoken)) {
                            + " freezingScreen=" + atoken.mAppAnimator.freezingScreen);
                        mTmpUpdateAllDrawn.add(atoken);
                }
                if (atoken != null && (!atoken.allDrawn || !atoken.allDrawnExcludingSaved
                        || atoken.mAppAnimator.freezingScreen)) {
                    if (atoken.lastTransactionSequence != mService.mTransactionSequence) {
                        atoken.lastTransactionSequence = mService.mTransactionSequence;
                        atoken.numInterestingWindows = atoken.numDrawnWindows = 0;
                        atoken.numInterestingWindowsExcludingSaved = 0;
                        atoken.numDrawnWindowsExcludingSaved = 0;
                        atoken.startingDisplayed = false;
                    }
                    if (!atoken.allDrawn && w.mightAffectAllDrawn(false /* visibleOnly */)) {
                        if (DEBUG_VISIBILITY || DEBUG_ORIENTATION) {
                            Slog.v(TAG, "Eval win " + w + ": isDrawn="
                                    + w.isDrawnLw()
                                    + ", isAnimationSet=" + winAnimator.isAnimationSet());
                            if (!w.isDrawnLw()) {
                                Slog.v(TAG, "Not displayed: s="
                                        + winAnimator.mSurfaceController
                                        + " pv=" + w.mPolicyVisibility
                                        + " mDrawState=" + winAnimator.drawStateToString()
                                        + " ph=" + w.isParentWindowHidden()
                                        + " th=" + atoken.hiddenRequested
                                        + " a=" + winAnimator.mAnimating);
                            }
                        }
                        if (w != atoken.startingWindow) {
                            if (w.isInteresting()) {
                                atoken.numInterestingWindows++;
                                if (w.isDrawnLw()) {
                                    atoken.numDrawnWindows++;
                                    if (DEBUG_VISIBILITY || DEBUG_ORIENTATION)
                                        Slog.v(TAG, "tokenMayBeDrawn: " + atoken
                                                + " w=" + w + " numInteresting="
                                                + atoken.numInterestingWindows
                                                + " freezingScreen="
                                                + atoken.mAppAnimator.freezingScreen
                                                + " mAppFreezing=" + w.mAppFreezing);
                                    updateAllDrawn = true;
                                }
                            }
                        } else if (w.isDrawnLw()) {
                            mService.mH.sendEmptyMessage(NOTIFY_STARTING_WINDOW_DRAWN);
                            atoken.startingDisplayed = true;
                        }
                    }
                    if (!atoken.allDrawnExcludingSaved
                            && w.mightAffectAllDrawn(true /* visibleOnly */)) {
                        if (w != atoken.startingWindow && w.isInteresting()) {
                            atoken.numInterestingWindowsExcludingSaved++;
                            if (w.isDrawnLw() && !w.isAnimatingWithSavedSurface()) {
                                atoken.numDrawnWindowsExcludingSaved++;
                                if (DEBUG_VISIBILITY || DEBUG_ORIENTATION)
                                    Slog.v(TAG, "tokenMayBeDrawnExcludingSaved: " + atoken
                                            + " w=" + w + " numInteresting="
                                            + atoken.numInterestingWindowsExcludingSaved
                                            + " freezingScreen="
                                            + atoken.mAppAnimator.freezingScreen
                                            + " mAppFreezing=" + w.mAppFreezing);
                                updateAllDrawn = true;
                            }
                        }
                    }
                    }
                }
                }


@@ -1244,7 +1152,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent> {
                    focusDisplayed = true;
                    focusDisplayed = true;
                }
                }


                mService.updateResizingWindows(w);
                w.updateResizingWindowIfNeeded();
            }
            }


            mService.mDisplayManagerInternal.setDisplayProperties(displayId,
            mService.mDisplayManagerInternal.setDisplayProperties(displayId,
@@ -1255,10 +1163,11 @@ class RootWindowContainer extends WindowContainer<DisplayContent> {


            dc.stopDimmingIfNeeded();
            dc.stopDimmingIfNeeded();


            if (updateAllDrawn) {
            while (!mTmpUpdateAllDrawn.isEmpty()) {
                final AppWindowToken atoken = mTmpUpdateAllDrawn.removeLast();
                // See if any windows have been drawn, so they (and others associated with them)
                // See if any windows have been drawn, so they (and others associated with them)
                // can now be shown.
                // can now be shown.
                dc.updateAllDrawn();
                atoken.updateAllDrawn(dc);
            }
            }
        }
        }


+0 −13
Original line number Original line Diff line number Diff line
@@ -381,19 +381,6 @@ class WindowContainer<E extends WindowContainer> implements Comparable<WindowCon
        }
        }
    }
    }


    /**
     * Updates the current all drawn status for this container. That is all its children
     * that should draw something have done so.
     */
    // TODO: The displayId shouldn't be needed as there shouldn't be a container on more than one
    // display. Remove once we migrate DisplayContent to use WindowContainer.
    void updateAllDrawn(int displayId) {
        for (int i = mChildren.size() - 1; i >= 0; --i) {
            final WindowContainer wc = mChildren.get(i);
            wc.updateAllDrawn(displayId);
        }
    }

    /** Step currently ongoing animation for App window containers. */
    /** Step currently ongoing animation for App window containers. */
    // TODO: The displayId shouldn't be needed as there shouldn't be a container on more than one
    // TODO: The displayId shouldn't be needed as there shouldn't be a container on more than one
    // display. Remove once we migrate DisplayContent to use WindowContainer.
    // display. Remove once we migrate DisplayContent to use WindowContainer.
+0 −102

File changed.

Preview size limit exceeded, changes collapsed.

Loading