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

Commit 8673f0c4 authored by Wale Ogunwale's avatar Wale Ogunwale Committed by Android (Google) Code Review
Browse files

Merge "Don't leak starting window when app crashes before adding windows" into mnc-dev

parents 707368b5 10cb5e2a
Loading
Loading
Loading
Loading
+12 −18
Original line number Diff line number Diff line
@@ -2672,7 +2672,8 @@ public class WindowManagerService extends IWindowManager.Stub
    }

    void removeWindowLocked(WindowState win) {
        if (win.mAttrs.type == TYPE_APPLICATION_STARTING) {
        final boolean startingWindow = win.mAttrs.type == TYPE_APPLICATION_STARTING;
        if (startingWindow) {
            if (DEBUG_STARTING_WINDOW) Slog.d(TAG, "Starting window removed " + win);
        }

@@ -2721,7 +2722,13 @@ public class WindowManagerService extends IWindowManager.Stub
                    mAccessibilityController.onWindowTransitionLocked(win, transit);
                }
            }
            if (win.mExiting || win.mWinAnimator.isAnimating()) {
            final AppWindowToken appToken = win.mAppToken;
            // The starting window is the last window in this app token and it isn't animating.
            // Allow it to be removed now as there is no additional window or animation that will
            // trigger its removal.
            final boolean lastWinStartingNotAnimating = startingWindow && appToken!= null
                    && appToken.allAppWindows.size() == 1 && !win.mWinAnimator.isWindowAnimating();
            if (!lastWinStartingNotAnimating && (win.mExiting || win.mWinAnimator.isAnimating())) {
                // The exit animation is running... wait for it!
                //Slog.i(TAG, "*** Running exit animation...");
                win.mExiting = true;
@@ -2733,8 +2740,8 @@ public class WindowManagerService extends IWindowManager.Stub
                final boolean focusChanged = updateFocusedWindowLocked(
                        UPDATE_FOCUS_WILL_PLACE_SURFACES, false /*updateInputWindows*/);
                performLayoutAndPlaceSurfacesLocked();
                if (win.mAppToken != null) {
                    win.mAppToken.updateReportedVisibilityLocked();
                if (appToken != null) {
                    appToken.updateReportedVisibilityLocked();
                }
                if (focusChanged) {
                    mInputMonitor.updateInputWindowsLw(false /*force*/);
@@ -4648,12 +4655,7 @@ public class WindowManagerService extends IWindowManager.Stub

            mOpeningApps.remove(wtoken);
            mClosingApps.remove(wtoken);
            wtoken.waitingToShow = wtoken.waitingToHide = false;
            wtoken.hiddenRequested = !visible;

            mOpeningApps.remove(wtoken);
            mClosingApps.remove(wtoken);
            wtoken.waitingToShow = wtoken.waitingToHide = false;
            wtoken.waitingToShow = false;
            wtoken.hiddenRequested = !visible;

            // If we are preparing an app transition, then delay changing
@@ -4692,12 +4694,6 @@ public class WindowManagerService extends IWindowManager.Stub
                } else {
                    mClosingApps.add(wtoken);
                    wtoken.mEnteringAnimation = false;

                    // If the token is currently visible (should be the
                    // common case), then set up to wait for it to be hidden.
                    if (!wtoken.hidden) {
                        wtoken.waitingToHide = true;
                    }
                }
                if (mAppTransition.getAppTransition() == AppTransition.TRANSIT_TASK_OPEN_BEHIND) {
                    // We're launchingBehind, add the launching activity to mOpeningApps.
@@ -4867,7 +4863,6 @@ public class WindowManagerService extends IWindowManager.Stub
                    delayed = true;
                } else if (mAppTransition.isTransitionSet()) {
                    mClosingApps.add(wtoken);
                    wtoken.waitingToHide = true;
                    delayed = true;
                }
                if (DEBUG_APP_TRANSITIONS) Slog.v(
@@ -9416,7 +9411,6 @@ public class WindowManagerService extends IWindowManager.Stub
                wtoken.inPendingTransaction = false;
                setTokenVisibilityLocked(wtoken, animLp, false, transit, false, voiceInteraction);
                wtoken.updateReportedVisibilityLocked();
                wtoken.waitingToHide = false;
                // Force the allDrawn flag, because we want to start
                // this guy's animations regardless of whether it's
                // gotten drawn.
+1 −6
Original line number Diff line number Diff line
@@ -63,10 +63,6 @@ class WindowToken {
    // will be shown.
    boolean waitingToShow;

    // Set to true when this token is in a pending transaction where it
    // will be hidden.
    boolean waitingToHide;

    // Set to true when this token is in a pending transaction where its
    // windows will be put to the bottom of the list.
    boolean sendingToBottom;
@@ -93,9 +89,8 @@ class WindowToken {
        pw.print(prefix); pw.print("windowType="); pw.print(windowType);
                pw.print(" hidden="); pw.print(hidden);
                pw.print(" hasVisible="); pw.println(hasVisible);
        if (waitingToShow || waitingToHide || sendingToBottom) {
        if (waitingToShow || sendingToBottom) {
            pw.print(prefix); pw.print("waitingToShow="); pw.print(waitingToShow);
                    pw.print(" waitingToHide="); pw.print(waitingToHide);
                    pw.print(" sendingToBottom="); pw.print(sendingToBottom);
        }
    }