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

Commit ba3b589f authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Changed logic about how to check if VRI replaced its surface."

parents ee4fa37d 25c129cc
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -41,7 +41,6 @@ import android.os.Build;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.RemoteException;
import android.os.SystemClock;
import android.provider.Settings;
import android.util.AttributeSet;
@@ -225,13 +224,12 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall

    private SurfaceControl.Transaction mRtTransaction = new SurfaceControl.Transaction();
    private SurfaceControl.Transaction mTmpTransaction = new SurfaceControl.Transaction();
    private int mParentSurfaceGenerationId;
    private int mParentSurfaceSequenceId;

    private RemoteAccessibilityController mRemoteAccessibilityController =
        new RemoteAccessibilityController(this);

    private final Matrix mTmpMatrix = new Matrix();
    private final float[] mMatrixValues = new float[9];

    SurfaceControlViewHost.SurfacePackage mSurfacePackage;

@@ -943,11 +941,10 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
            // SurfaceChangedCallback to update the relative z. This is needed so that
            // we do not change the relative z before the server is ready to swap the
            // parent surface.
            if (creating || (mParentSurfaceGenerationId
                    == viewRoot.mSurface.getGenerationId())) {
            if (creating || (mParentSurfaceSequenceId == viewRoot.getSurfaceSequenceId())) {
                updateRelativeZ(mTmpTransaction);
            }
            mParentSurfaceGenerationId = viewRoot.mSurface.getGenerationId();
            mParentSurfaceSequenceId = viewRoot.getSurfaceSequenceId();

            if (mViewVisibility) {
                mTmpTransaction.show(mSurfaceControl);
+14 −1
Original line number Diff line number Diff line
@@ -702,6 +702,11 @@ public final class ViewRootImpl implements ViewParent,

    private HashSet<ScrollCaptureCallback> mRootScrollCaptureCallbacks;

    /**
     * Increment this value when the surface has been replaced.
     */
    private int mSurfaceSequenceId = 0;

    private String mTag = TAG;

    public ViewRootImpl(Context context, Display display) {
@@ -2609,7 +2614,7 @@ public final class ViewRootImpl implements ViewParent,
        boolean surfaceSizeChanged = false;
        boolean surfaceCreated = false;
        boolean surfaceDestroyed = false;
        /* True if surface generation id changes. */
        // True if surface generation id changes or relayout result is RELAYOUT_RES_SURFACE_CHANGED.
        boolean surfaceReplaced = false;

        final boolean windowAttributesChanged = mWindowAttributesChanged;
@@ -2704,6 +2709,7 @@ public final class ViewRootImpl implements ViewParent,
                updateColorModeIfNeeded(lp.getColorMode());
                surfaceCreated = !hadSurface && mSurface.isValid();
                surfaceDestroyed = hadSurface && !mSurface.isValid();

                // When using Blast, the surface generation id may not change when there's a new
                // SurfaceControl. In that case, we also check relayout flag
                // RELAYOUT_RES_SURFACE_CHANGED since it should indicate that WMS created a new
@@ -2712,6 +2718,9 @@ public final class ViewRootImpl implements ViewParent,
                        || (relayoutResult & RELAYOUT_RES_SURFACE_CHANGED)
                        == RELAYOUT_RES_SURFACE_CHANGED)
                        && mSurface.isValid();
                if (surfaceReplaced) {
                    mSurfaceSequenceId++;
                }

                if (cutoutChanged) {
                    mAttachInfo.mDisplayCutout.set(mPendingDisplayCutout);
@@ -9917,4 +9926,8 @@ public final class ViewRootImpl implements ViewParent,
    boolean useBLAST() {
        return mUseBLASTAdapter && !mForceDisableBLAST;
    }

    int getSurfaceSequenceId() {
        return mSurfaceSequenceId;
    }
}