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

Commit 698b684f authored by Rob Carr's avatar Rob Carr
Browse files

WindowManager: Avoid reparenting BLAST Surface in reparentChildren

In cases where we are replacing the client surface transparently (e.g.
preserved surfaces), we call reparentChildren to move client added
Surfaces of the preserved Surface to the new Layer. However we are calling
this on the WSA layer, and so we end up reparenting the BLAST Surface
to the new layer. But since we always construct a new BLAST surface on the
WM side, we end up with 2! Rather than try and juggle about when we need
to or need not to construct a BLAST surface and reparenting them across
preservedSurfaces, it seemed either to just use the BLAST surface as the
root of the reparentChildren operation.

Bug: 150013915
Test: Enable BLAST, use split-screen
Change-Id: I1357200b41d183c2331b684ff636dd40a3b98168
parent 91b4f26c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1735,7 +1735,7 @@ public final class ViewRootImpl implements ViewParent,
            mBoundsLayer = new SurfaceControl.Builder(mSurfaceSession)
                    .setContainerLayer()
                    .setName("Bounds for - " + getTitle().toString())
                    .setParent(mSurfaceControl)
                    .setParent(getRenderSurfaceControl())
                    .build();
            setBoundsLayerCrop();
            mTransaction.show(mBoundsLayer).apply();
+1 −1
Original line number Diff line number Diff line
@@ -274,7 +274,7 @@ class InsetsSourceProvider {
            // window crop of the surface controls (including the leash) until the client finishes
            // drawing the new frame of the new orientation. Although we cannot defer the reparent
            // operation, it is fine, because reparent won't cause any visual effect.
            final SurfaceControl barrier = mWin.getDeferTransactionBarrier();
            final SurfaceControl barrier = mWin.getClientViewRootSurface();
            t.deferTransactionUntil(mWin.getSurfaceControl(), barrier, frameNumber);
            t.deferTransactionUntil(leash, barrier, frameNumber);
        }
+2 −2
Original line number Diff line number Diff line
@@ -118,9 +118,9 @@ public class SeamlessRotator {
        finish(t, win);
        if (win.mWinAnimator.mSurfaceController != null && !timeout) {
            t.deferTransactionUntil(win.mSurfaceControl,
                    win.getDeferTransactionBarrier(), win.getFrameNumber());
                    win.getClientViewRootSurface(), win.getFrameNumber());
            t.deferTransactionUntil(win.mWinAnimator.mSurfaceController.mSurfaceControl,
                    win.getDeferTransactionBarrier(), win.getFrameNumber());
                    win.getClientViewRootSurface(), win.getFrameNumber());
        }
    }

+2 −2
Original line number Diff line number Diff line
@@ -5660,8 +5660,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        return mSession.mPid == pid && isNonToastOrStarting() && isVisibleNow();
    }

    SurfaceControl getDeferTransactionBarrier() {
        return mWinAnimator.getDeferTransactionBarrier();
    SurfaceControl getClientViewRootSurface() {
        return mWinAnimator.getClientViewRootSurface();
    }

    @Override
+14 −12
Original line number Diff line number Diff line
@@ -383,7 +383,8 @@ class WindowStateAnimator {
            // Make sure to reparent any children of the new surface back to the preserved
            // surface before destroying it.
            if (mSurfaceController != null && mPendingDestroySurface != null) {
                mPostDrawTransaction.reparentChildren(mSurfaceController.mSurfaceControl,
                mPostDrawTransaction.reparentChildren(
                    mSurfaceController.getClientViewRootSurface(),
                    mPendingDestroySurface.mSurfaceControl).apply();
            }
            destroySurfaceLocked();
@@ -413,9 +414,9 @@ class WindowStateAnimator {
                // child layers need to be reparented to the new surface to make this
                // transparent to the app.
                if (mWin.mActivityRecord == null || mWin.mActivityRecord.isRelaunching() == false) {
                    mPostDrawTransaction.reparentChildren(mPendingDestroySurface.mSurfaceControl,
                            mSurfaceController.mSurfaceControl)
                            .apply();
                    mPostDrawTransaction.reparentChildren(
                        mPendingDestroySurface.getClientViewRootSurface(),
                        mSurfaceController.mSurfaceControl).apply();
                }
            }
        }
@@ -875,7 +876,7 @@ class WindowStateAnimator {

        if (mSurfaceResized && (mAttrType == TYPE_BASE_APPLICATION) &&
            (task != null) && (task.getMainWindowSizeChangeTransaction() != null)) {
            mSurfaceController.deferTransactionUntil(mWin.getDeferTransactionBarrier(),
            mSurfaceController.deferTransactionUntil(mWin.getClientViewRootSurface(),
                    mWin.getFrameNumber());
            SurfaceControl.mergeToGlobalTransaction(task.getMainWindowSizeChangeTransaction());
            task.setMainWindowSizeChangeTransaction(null);
@@ -1012,7 +1013,7 @@ class WindowStateAnimator {
                        // the WS position is reset (so the stack position is shown) at the same
                        // time that the buffer size changes.
                        setOffsetPositionForStackResize(false);
                        mSurfaceController.deferTransactionUntil(mWin.getDeferTransactionBarrier(),
                        mSurfaceController.deferTransactionUntil(mWin.getClientViewRootSurface(),
                                mWin.getFrameNumber());
                    } else {
                        final ActivityStack stack = mWin.getRootTask();
@@ -1043,7 +1044,7 @@ class WindowStateAnimator {
        // comes in at the new size (normally position and crop are unfrozen).
        // deferTransactionUntil accomplishes this for us.
        if (wasForceScaled && !mForceScaleUntilResize) {
            mSurfaceController.deferTransactionUntil(mWin.getDeferTransactionBarrier(),
            mSurfaceController.deferTransactionUntil(mWin.getClientViewRootSurface(),
                    mWin.getFrameNumber());
            mSurfaceController.forceScaleableInTransaction(false);
        }
@@ -1288,7 +1289,8 @@ class WindowStateAnimator {
        if (mPendingDestroySurface != null && mDestroyPreservedSurfaceUponRedraw) {
            final SurfaceControl pendingSurfaceControl = mPendingDestroySurface.mSurfaceControl;
            mPostDrawTransaction.reparent(pendingSurfaceControl, null);
            mPostDrawTransaction.reparentChildren(pendingSurfaceControl,
            mPostDrawTransaction.reparentChildren(
                mPendingDestroySurface.getClientViewRootSurface(),
                mSurfaceController.mSurfaceControl);
        }

@@ -1521,10 +1523,10 @@ class WindowStateAnimator {
        mOffsetPositionForStackResize = offsetPositionForStackResize;
    }

    SurfaceControl getDeferTransactionBarrier() {
    SurfaceControl getClientViewRootSurface() {
        if (!hasSurface()) {
            return null;
        }
        return mSurfaceController.getDeferTransactionBarrier();
        return mSurfaceController.getClientViewRootSurface();
    }
}
Loading