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

Commit 06fe6813 authored by Vishnu Nair's avatar Vishnu Nair Committed by Android (Google) Code Review
Browse files

Merge "Add tracepoints when clients use vsyncids from a different choreographer" into main

parents a1289338 1a761a62
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import android.util.TimeUtils;
import android.view.animation.AnimationUtils;

import java.io.PrintWriter;
import java.util.Locale;

/**
 * Coordinates the timing of animations, input and drawing.
@@ -200,6 +201,7 @@ public final class Choreographer {
    private final DisplayEventReceiver.VsyncEventData mLastVsyncEventData =
            new DisplayEventReceiver.VsyncEventData();
    private final FrameData mFrameData = new FrameData();
    private volatile boolean mInDoFrameCallback = false;

    /**
     * Contains information about the current frame for jank-tracking,
@@ -818,6 +820,11 @@ public final class Choreographer {
     * @hide
     */
    public long getVsyncId() {
        if (!mInDoFrameCallback && Trace.isTagEnabled(Trace.TRACE_TAG_VIEW)) {
            String message = String.format(Locale.getDefault(), "unsync-vsync-id=%d isSfChoreo=%s",
                    mLastVsyncEventData.preferredFrameTimeline().vsyncId, this == getSfInstance());
            Trace.instant(Trace.TRACE_TAG_VIEW, message);
        }
        return mLastVsyncEventData.preferredFrameTimeline().vsyncId;
    }

@@ -853,6 +860,7 @@ public final class Choreographer {
            if (Trace.isTagEnabled(Trace.TRACE_TAG_VIEW)) {
                Trace.traceBegin(
                        Trace.TRACE_TAG_VIEW, "Choreographer#doFrame " + timeline.mVsyncId);
                mInDoFrameCallback = true;
            }
            synchronized (mLock) {
                if (!mFrameScheduled) {
@@ -947,6 +955,7 @@ public final class Choreographer {
            doCallbacks(Choreographer.CALLBACK_COMMIT, frameIntervalNanos);
        } finally {
            AnimationUtils.unlockAnimationClock();
            mInDoFrameCallback = false;
            if (resynced) {
                Trace.traceEnd(Trace.TRACE_TAG_VIEW);
            }