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

Commit 49bc7460 authored by Jian-Syuan (Shane) Wong's avatar Jian-Syuan (Shane) Wong Committed by Android (Google) Code Review
Browse files

Merge "Add the getLatestExpectedPresentTimeNanos method for Choreographer" into main

parents 13bb7d98 f99a1f89
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -749,6 +749,25 @@ public final class Choreographer {
        return getExpectedPresentationTimeNanos() / TimeUtils.NANOS_PER_MS;
    }

    /**
     * Same as {@link #getExpectedPresentationTimeNanos()},
     * Should always use {@link #getExpectedPresentationTimeNanos()} if it's possilbe.
     * This method involves a binder call to SF,
     * calling this method can potentially influence the performance.
     *
     * @return The frame start time, in the {@link System#nanoTime()} time base.
     *
     * @hide
     */
    public long getLatestExpectedPresentTimeNanos() {
        if (mDisplayEventReceiver == null) {
            return System.nanoTime();
        }

        return mDisplayEventReceiver.getLatestVsyncEventData()
                .preferredFrameTimeline().expectedPresentationTime;
    }

    private void scheduleFrameLocked(long now) {
        if (!mFrameScheduled) {
            mFrameScheduled = true;