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

Commit f2f84f5f authored by Robert Carr's avatar Robert Carr
Browse files

Remove more deferTransactionUntilSurface calls

These won't work with the BLAST adapter since the Surface isn't
known to the server side. We just convert them in to the other
variant of defer transaction calls.

Bug: 146598493
Bug: 149251083
Test: Existing tests pass
Change-Id: I34fc4bb90114bae8b0d9ffdee5c91a2371e5c240
parent 8eb3cbe1
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -9561,7 +9561,10 @@ public final class ViewRootImpl implements ViewParent,
        return mRtBLASTSyncTransaction;
    }

    SurfaceControl getRenderSurfaceControl() {
    /**
     * @hide
     */
    public SurfaceControl getRenderSurfaceControl() {
        if (mUseBLASTAdapter) {
            return mBlastSurfaceControl;
        } else {
+2 −1
Original line number Diff line number Diff line
@@ -1257,7 +1257,8 @@ public final class Magnifier {
                            return;
                        }
                        // Show or move the window at the content draw frame.
                        mTransaction.deferTransactionUntilSurface(mSurfaceControl, mSurface, frame);
                        mTransaction.deferTransactionUntil(mSurfaceControl, mSurfaceControl,
                                frame);
                        if (updateWindowPosition) {
                            mTransaction.setPosition(mSurfaceControl, pendingX, pendingY);
                        }
+6 −4
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.os.Handler.Callback;
import android.os.Message;
import android.os.Trace;
import android.view.Surface;
import android.view.SurfaceControl;
import android.view.View;
import android.view.ViewRootImpl;

@@ -39,7 +40,7 @@ public class SyncRtSurfaceTransactionApplierCompat {

    private static final int MSG_UPDATE_SEQUENCE_NUMBER = 0;

    private final Surface mTargetSurface;
    private final SurfaceControl mBarrierSurfaceControl;
    private final ViewRootImpl mTargetViewRootImpl;
    private final Handler mApplyHandler;

@@ -52,7 +53,8 @@ public class SyncRtSurfaceTransactionApplierCompat {
     */
    public SyncRtSurfaceTransactionApplierCompat(View targetView) {
        mTargetViewRootImpl = targetView != null ? targetView.getViewRootImpl() : null;
        mTargetSurface = mTargetViewRootImpl != null ? mTargetViewRootImpl.mSurface : null;
        mBarrierSurfaceControl = mTargetViewRootImpl != null
            ? mTargetViewRootImpl.getRenderSurfaceControl() : null;

        mApplyHandler = new Handler(new Callback() {
            @Override
@@ -91,7 +93,7 @@ public class SyncRtSurfaceTransactionApplierCompat {
        mTargetViewRootImpl.registerRtFrameCallback(new HardwareRenderer.FrameDrawingCallback() {
            @Override
            public void onFrameDraw(long frame) {
                if (mTargetSurface == null || !mTargetSurface.isValid()) {
                if (mBarrierSurfaceControl == null || !mBarrierSurfaceControl.isValid()) {
                    Message.obtain(mApplyHandler, MSG_UPDATE_SEQUENCE_NUMBER, toApplySeqNo, 0)
                            .sendToTarget();
                    return;
@@ -102,7 +104,7 @@ public class SyncRtSurfaceTransactionApplierCompat {
                    SyncRtSurfaceTransactionApplierCompat.SurfaceParams surfaceParams =
                            params[i];
                    SurfaceControlCompat surface = surfaceParams.surface;
                    t.deferTransactionUntil(surface, mTargetSurface, frame);
                    t.deferTransactionUntil(surface, mBarrierSurfaceControl, frame);
                    applyParams(t, surfaceParams);
                }
                t.setEarlyWakeup();
+4 −3
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.graphics.Matrix;
import android.graphics.Rect;
import android.view.Surface;
import android.view.SurfaceControl.Transaction;
import android.view.SurfaceControl;

public class TransactionCompat {

@@ -87,8 +88,8 @@ public class TransactionCompat {
    }

    public TransactionCompat deferTransactionUntil(SurfaceControlCompat surfaceControl,
            Surface barrier, long frameNumber) {
        mTransaction.deferTransactionUntilSurface(surfaceControl.mSurfaceControl, barrier,
            SurfaceControl barrier, long frameNumber) {
        mTransaction.deferTransactionUntil(surfaceControl.mSurfaceControl, barrier,
                frameNumber);
        return this;
    }