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

Commit 498c71dd authored by Matthew Ng's avatar Matthew Ng
Browse files

Window can only be fully drawn if app window is not relaunching

This fixes the glitch of having transitions be calculated incorrectly
when starting new activity when other windows still exist. For example
launcher3 has minus one window exist even if the main activity is
destroyed causing incorrect transition going home. This change only
allows the calculation to occur when the app window is not relaunching.

Test: manual - launch app, rotate screen, go home
Change-Id: I7e323486ee6e05ba4c8704832ca0f9d6e648ac90
Fixes: 36113180
parent 0a4b7f5a
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -893,6 +893,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
        if (mPendingRelaunchCount > 0) {
            mPendingRelaunchCount--;
        }
        updateAllDrawn();
    }

    void clearRelaunching() {
@@ -1301,16 +1302,20 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
        }
    }

    void updateAllDrawn(DisplayContent dc) {
    void updateAllDrawn() {
        if (!allDrawn) {
            // Number of drawn windows can be less when a window is being relaunched, wait for
            // all windows to be launched and drawn for this token be considered all drawn
            final int numInteresting = mNumInterestingWindows;
            if (numInteresting > 0 && mNumDrawnWindows >= numInteresting) {
            if (numInteresting > 0 && mNumDrawnWindows >= numInteresting && !isRelaunching()) {
                if (DEBUG_VISIBILITY) Slog.v(TAG, "allDrawn: " + this
                        + " interesting=" + numInteresting + " drawn=" + mNumDrawnWindows);
                allDrawn = true;
                // Force an additional layout pass where
                // WindowStateAnimator#commitFinishDrawingLocked() will call performShowLocked().
                dc.setLayoutNeeded();
                if (mDisplayContent != null) {
                    mDisplayContent.setLayoutNeeded();
                }
                mService.mH.obtainMessage(NOTIFY_ACTIVITY_DRAWN, token).sendToTarget();

                final TaskStack s = getStack();
@@ -1327,7 +1332,9 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
                        + " interesting=" + numInteresting
                        + " drawn=" + mNumDrawnWindowsExcludingSaved);
                allDrawnExcludingSaved = true;
                dc.setLayoutNeeded();
                if (mDisplayContent != null) {
                    mDisplayContent.setLayoutNeeded();
                }
                if (isAnimatingInvisibleWithSavedSurface()
                        && !mService.mFinishedEarlyAnim.contains(this)) {
                    mService.mFinishedEarlyAnim.add(this);
+1 −1
Original line number Diff line number Diff line
@@ -2725,7 +2725,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
            final AppWindowToken atoken = mTmpUpdateAllDrawn.removeLast();
            // See if any windows have been drawn, so they (and others associated with them)
            // can now be shown.
            atoken.updateAllDrawn(this);
            atoken.updateAllDrawn();
        }

        return mTmpApplySurfaceChangesTransactionState.focusDisplayed;