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

Commit b8d35d10 authored by Hongwei Wang's avatar Hongwei Wang
Browse files

Provide vsync id for PiP animation

The vsync-id is attached to every SurfaceControl.Transaction within
PipAnimationController and therefore it's available to onAnimationStart,
onAnimationEnd as well as onAnimationUpdate.

What's next: may need to provide vsync id for PiP animation running in
Launcher process as well.

Bug: 166302754
Test: atest PipAnimationControllerTest
Change-Id: I5d413320f435e65d7e3e375bb2266e1bba23e0d7
parent c5de9782
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.animation.RectEvaluator;
import android.animation.ValueAnimator;
import android.annotation.IntDef;
import android.graphics.Rect;
import android.view.Choreographer;
import android.view.SurfaceControl;

import com.android.internal.annotations.VisibleForTesting;
@@ -327,8 +328,14 @@ public class PipAnimationController {
            mEndValue = endValue;
        }

        SurfaceControl.Transaction newSurfaceControlTransaction() {
            return mSurfaceControlTransactionFactory.getTransaction();
        /**
         * @return {@link SurfaceControl.Transaction} instance with vsync-id.
         */
        protected SurfaceControl.Transaction newSurfaceControlTransaction() {
            final SurfaceControl.Transaction tx =
                    mSurfaceControlTransactionFactory.getTransaction();
            tx.setFrameTimelineVsync(Choreographer.getSfInstance().getVsyncId());
            return tx;
        }

        @VisibleForTesting
+5 −0
Original line number Diff line number Diff line
@@ -196,6 +196,11 @@ public class PipAnimationControllerTest extends ShellTestCase {
            return this;
        }

        @Override
        public SurfaceControl.Transaction setFrameTimelineVsync(long frameTimelineVsyncId) {
            return this;
        }

        @Override
        public void apply() {}
    }