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

Commit 0a872f0b authored by Chong Zhang's avatar Chong Zhang Committed by Android (Google) Code Review
Browse files

Merge "Make sure preserved surface is removed when it's no longer needed" into nyc-dev

parents 8eb29015 eb66557e
Loading
Loading
Loading
Loading
+5 −2
Original line number Original line Diff line number Diff line
@@ -329,11 +329,14 @@ class AppWindowToken extends WindowToken {
        final DisplayContentList displayList = new DisplayContentList();
        final DisplayContentList displayList = new DisplayContentList();
        for (int i = allWindows.size() - 1; i >= 0; i--) {
        for (int i = allWindows.size() - 1; i >= 0; i--) {
            final WindowState win = allWindows.get(i);
            final WindowState win = allWindows.get(i);
            if (!win.mDestroying) {

            if (!(mAppStopped || win.mWindowRemovalAllowed)) {
                continue;
                continue;
            }
            }


            if (!(mAppStopped || win.mWindowRemovalAllowed)) {
            win.mWinAnimator.destroyPreservedSurfaceLocked();

            if (!win.mDestroying) {
                continue;
                continue;
            }
            }


+8 −3
Original line number Original line Diff line number Diff line
@@ -659,6 +659,13 @@ class WindowStateAnimator {
        mDestroyPreservedSurfaceUponRedraw = false;
        mDestroyPreservedSurfaceUponRedraw = false;
    }
    }


    void markPreservedSurfaceForDestroy() {
        if (mDestroyPreservedSurfaceUponRedraw
                && !mService.mDestroyPreservedSurface.contains(mWin)) {
            mService.mDestroyPreservedSurface.add(mWin);
        }
    }

    WindowSurfaceController createSurfaceLocked() {
    WindowSurfaceController createSurfaceLocked() {
        final WindowState w = mWin;
        final WindowState w = mWin;
        if (w.hasSavedSurface()) {
        if (w.hasSavedSurface()) {
@@ -1518,9 +1525,7 @@ class WindowStateAnimator {


            if (prepared && mLastHidden && mDrawState == HAS_DRAWN) {
            if (prepared && mLastHidden && mDrawState == HAS_DRAWN) {
                if (showSurfaceRobustlyLocked()) {
                if (showSurfaceRobustlyLocked()) {
                    if (mDestroyPreservedSurfaceUponRedraw) {
                    markPreservedSurfaceForDestroy();
                        mService.mDestroyPreservedSurface.add(mWin);
                    }
                    mAnimator.requestRemovalOfReplacedWindows(w);
                    mAnimator.requestRemovalOfReplacedWindows(w);
                    mLastHidden = false;
                    mLastHidden = false;
                    if (mIsWallpaper) {
                    if (mIsWallpaper) {