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

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

Merge "Add a getter method for expectedPresentationTimeNanos"

parents 69ab110b 8df049f9
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -3415,7 +3415,9 @@ package android.view {
  }

  public final class Choreographer {
    method public long getExpectedPresentationTimeNanos();
    method public static long getFrameDelay();
    method public long getFrameTimeNanos();
    method public void postCallback(int, Runnable, Object);
    method public void postCallbackDelayed(int, Runnable, Object, long);
    method public void removeCallbacks(int, Runnable, Object);
+22 −0
Original line number Diff line number Diff line
@@ -693,6 +693,7 @@ public final class Choreographer {
     * @throws IllegalStateException if no frame is in progress.
     * @hide
     */
    @TestApi
    @UnsupportedAppUsage
    public long getFrameTimeNanos() {
        synchronized (mLock) {
@@ -716,6 +717,27 @@ public final class Choreographer {
        }
    }

    /**
     * Gets the time in {@link System#nanoTime()} timebase which the current frame
     * is expected to be presented.
     * <p>
     * This time should be used to advance any animation clocks.
     * Prefer using this method over {@link #getFrameTimeNanos()}.
     * </p><p>
     * This method should only be called from within a callback.
     * </p>
     *
     * @return The frame start time, in the {@link System#nanoTime()} time base.
     *
     * @throws IllegalStateException if no frame is in progress.
     * @hide
     */
    @TestApi
    @UnsupportedAppUsage
    public long getExpectedPresentationTimeNanos() {
        return mFrameData.getPreferredFrameTimeline().getExpectedPresentationTimeNanos();
    }

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