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

Commit a0aa0ca8 authored by Robert Carr's avatar Robert Carr Committed by android-build-merger
Browse files

Merge "Merge "SurfaceView: Expose hook for subclass to position child...

Merge "Merge "SurfaceView: Expose hook for subclass to position child surfaces." into pi-dev am: 89b18289" into pi-dev-plus-aosp
am: 331561fb

Change-Id: I00e9ad45911d0c9b7e411bff6064303b41a96283
parents 6a284300 331561fb
Loading
Loading
Loading
Loading
+26 −11
Original line number Diff line number Diff line
@@ -179,6 +179,8 @@ public class SurfaceView extends View implements ViewRootImpl.WindowStoppedCallb

    private int mPendingReportDraws;

    private SurfaceControl.Transaction mRtTransaction = new SurfaceControl.Transaction();

    public SurfaceView(Context context) {
        this(context, null);
    }
@@ -774,21 +776,34 @@ public class SurfaceView extends View implements ViewRootImpl.WindowStoppedCallb
        });
    }

    /**
     * A place to over-ride for applying child-surface transactions.
     * These can be synchronized with the viewroot surface using deferTransaction.
     *
     * Called from RenderWorker while UI thread is paused.
     * @hide
     */
    protected void applyChildSurfaceTransaction_renderWorker(SurfaceControl.Transaction t,
            Surface viewRootSurface, long nextViewRootFrameNumber) {
    }

    private void setParentSpaceRectangle(Rect position, long frameNumber) {
        ViewRootImpl viewRoot = getViewRootImpl();

        SurfaceControl.openTransaction();
        try {
        if (frameNumber > 0) {
                mSurfaceControl.deferTransactionUntil(viewRoot.mSurface, frameNumber);
            mRtTransaction.deferTransactionUntilSurface(mSurfaceControl, viewRoot.mSurface,
                    frameNumber);
        }
            mSurfaceControl.setPosition(position.left, position.top);
            mSurfaceControl.setMatrix(position.width() / (float) mSurfaceWidth,
        mRtTransaction.setPosition(mSurfaceControl,position.left, position.top);
        mRtTransaction.setMatrix(mSurfaceControl,
                position.width() / (float) mSurfaceWidth,
                0.0f, 0.0f,
                position.height() / (float) mSurfaceHeight);
        } finally {
            SurfaceControl.closeTransaction();
        }

        applyChildSurfaceTransaction_renderWorker(mRtTransaction, viewRoot.mSurface,
                frameNumber);

        mRtTransaction.apply();
    }

    private Rect mRTLastReportedPosition = new Rect();