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

Commit 9ebd43d8 authored by Chavi Weingarten's avatar Chavi Weingarten Committed by Automerger Merge Worker
Browse files

Merge "Revert "Reparent bounds layer if surface was replaced."" into...

Merge "Revert "Reparent bounds layer if surface was replaced."" into rvc-d1-dev am: 15e6f37a am: 1812833e am: ef89319e

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12308823

Change-Id: I654362e34619e282ac15aeb491005a20e4df5f9c
parents 33ce8202 ef89319e
Loading
Loading
Loading
Loading
+5 −20
Original line number Diff line number Diff line
@@ -1814,19 +1814,13 @@ public final class ViewRootImpl implements ViewParent,
    /**
     * Called after window layout to update the bounds surface. If the surface insets have changed
     * or the surface has resized, update the bounds surface.
     *
     * @param shouldReparent Whether it should reparent the bounds layer to the main SurfaceControl.
     */
    private void updateBoundsLayer(boolean shouldReparent) {
    private void updateBoundsLayer() {
        if (mBoundsLayer != null) {
            setBoundsLayerCrop();
            mTransaction.deferTransactionUntil(mBoundsLayer, getRenderSurfaceControl(),
                    mSurface.getNextFrameNumber());

            if (shouldReparent) {
                mTransaction.reparent(mBoundsLayer, getRenderSurfaceControl());
            }
            mTransaction.apply();
            mTransaction.deferTransactionUntil(mBoundsLayer,
                    getRenderSurfaceControl(), mSurface.getNextFrameNumber())
                    .apply();
        }
    }

@@ -2905,16 +2899,7 @@ public final class ViewRootImpl implements ViewParent,
        }

        if (surfaceSizeChanged || surfaceReplaced || surfaceCreated || windowAttributesChanged) {
            // If the surface has been replaced, there's a chance the bounds layer is not parented
            // to the new layer. When updating bounds layer, also reparent to the main VRI
            // SurfaceControl to ensure it's correctly placed in the hierarchy.
            //
            // This needs to be done on the client side since WMS won't reparent the children to the
            // new surface if it thinks the app is closing. WMS gets the signal that the app is
            // stopping, but on the client side it doesn't get stopped since it's restarted quick
            // enough. WMS doesn't want to keep around old children since they will leak when the
            // client creates new children.
            updateBoundsLayer(surfaceReplaced);
            updateBoundsLayer();
        }

        final boolean didLayout = layoutRequested && (!mStopped || mReportNextDraw);