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

Commit 5a964a3f authored by Robert Carr's avatar Robert Carr
Browse files

WindowState: Fix transaction usage in preserve surface

Currently we are using the global transaction without
opening it. Switch to the pending transaction.

Bug: 161937501
Test: Existing tests pass
Change-Id: Icf1215c278ce088d91bd7fb15f932f9ae6378d33
parent 494ad7de
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -5009,9 +5009,10 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
            // on the new one. This prevents blinking when we change elevation of freeform and
            // pinned windows.
            if (!mWinAnimator.tryChangeFormatInPlaceLocked()) {
                mWinAnimator.preserveSurfaceLocked();
                mWinAnimator.preserveSurfaceLocked(getPendingTransaction());
                result |= RELAYOUT_RES_SURFACE_CHANGED
                        | RELAYOUT_RES_FIRST_TIME;
                scheduleAnimation();
            }
        }

@@ -5027,9 +5028,10 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
            // to preserve and destroy windows which are attached to another, they
            // will keep their surface and its size may change over time.
            if (mHasSurface && !isChildWindow()) {
                mWinAnimator.preserveSurfaceLocked();
                mWinAnimator.preserveSurfaceLocked(getPendingTransaction());
                result |= RELAYOUT_RES_SURFACE_CHANGED |
                    RELAYOUT_RES_FIRST_TIME;
                scheduleAnimation();
            }
        }
        final boolean freeformResizing = isDragResizing()
+2 −2
Original line number Diff line number Diff line
@@ -349,7 +349,7 @@ class WindowStateAnimator {
        return result;
    }

    void preserveSurfaceLocked() {
    void preserveSurfaceLocked(SurfaceControl.Transaction t) {
        if (mDestroyPreservedSurfaceUponRedraw) {
            // This could happen when switching the surface mode very fast. For example,
            // we preserved a surface when dragResizing changed to true. Then before the
@@ -376,7 +376,7 @@ class WindowStateAnimator {
            // Our SurfaceControl is always at layer 0 within the parent Surface managed by
            // window-state. We want this old Surface to stay on top of the new one
            // until we do the swap, so we place it at a positive layer.
            mSurfaceController.mSurfaceControl.setLayer(PRESERVED_SURFACE_LAYER);
            t.setLayer(mSurfaceController.getClientViewRootSurface(), PRESERVED_SURFACE_LAYER);
        }
        mDestroyPreservedSurfaceUponRedraw = true;
        mSurfaceDestroyDeferred = true;