Loading core/api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -54921,6 +54921,7 @@ package android.view.animation { public class AnimationUtils { ctor public AnimationUtils(); method public static long currentAnimationTimeMillis(); method public static long getExpectedPresentationTimeNanos(); method public static android.view.animation.Animation loadAnimation(android.content.Context, @AnimRes int) throws android.content.res.Resources.NotFoundException; method public static android.view.animation.Interpolator loadInterpolator(android.content.Context, @AnimRes @InterpolatorRes int) throws android.content.res.Resources.NotFoundException; method public static android.view.animation.LayoutAnimationController loadLayoutAnimation(android.content.Context, @AnimRes int) throws android.content.res.Resources.NotFoundException; core/api/test-current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -3628,7 +3628,7 @@ package android.view.accessibility { package android.view.animation { public class AnimationUtils { method public static void lockAnimationClock(long); method public static void lockAnimationClock(long, long); method public static void unlockAnimationClock(); } Loading core/java/android/view/Choreographer.java +2 −1 Original line number Diff line number Diff line Loading @@ -869,7 +869,8 @@ public final class Choreographer { Trace.traceBegin(Trace.TRACE_TAG_VIEW, message); } AnimationUtils.lockAnimationClock(frameTimeNanos / TimeUtils.NANOS_PER_MS); AnimationUtils.lockAnimationClock(frameTimeNanos / TimeUtils.NANOS_PER_MS, timeline.mExpectedPresentationTimeNanos); mFrameInfo.markInputHandlingStart(); doCallbacks(Choreographer.CALLBACK_INPUT, frameIntervalNanos); Loading core/java/android/view/animation/AnimationUtils.java +22 −5 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ public class AnimationUtils { boolean animationClockLocked; long currentVsyncTimeMillis; long lastReportedTimeMillis; long mExpectedPresentationTimeNanos; }; private static ThreadLocal<AnimationState> sAnimationState Loading @@ -62,7 +63,8 @@ public class AnimationUtils { }; /** * Locks AnimationUtils{@link #currentAnimationTimeMillis()} to a fixed value for the current * Locks AnimationUtils{@link #currentAnimationTimeMillis()} and * AnimationUtils{@link #expectedPresentationTimeNanos()} to a fixed value for the current * thread. This is used by {@link android.view.Choreographer} to ensure that all accesses * during a vsync update are synchronized to the timestamp of the vsync. * Loading @@ -74,8 +76,9 @@ public class AnimationUtils { * Note that time is not allowed to "rewind" and must perpetually flow forward. So the * lock may fail if the time is in the past from a previously returned value, however * time will be frozen for the duration of the lock. The clock is a thread-local, so * ensure that {@link #lockAnimationClock(long)}, {@link #unlockAnimationClock()}, and * {@link #currentAnimationTimeMillis()} are all called on the same thread. * ensure that {@link #lockAnimationClock(long)}, {@link #unlockAnimationClock()}, * {@link #currentAnimationTimeMillis()}, and {@link #expectedPresentationTimeNanos()} * are all called on the same thread. * * This is also not reference counted in any way. Any call to {@link #unlockAnimationClock()} * will unlock the clock for everyone on the same thread. It is therefore recommended Loading @@ -83,12 +86,13 @@ public class AnimationUtils { * {@link android.view.Choreographer} instance. * * @hide * */ */ @TestApi public static void lockAnimationClock(long vsyncMillis) { public static void lockAnimationClock(long vsyncMillis, long expectedPresentationTimeNanos) { AnimationState state = sAnimationState.get(); state.animationClockLocked = true; state.currentVsyncTimeMillis = vsyncMillis; state.mExpectedPresentationTimeNanos = expectedPresentationTimeNanos; } /** Loading Loading @@ -123,6 +127,19 @@ public class AnimationUtils { return state.lastReportedTimeMillis; } /** * The expected presentation time of a frame in the {@link System#nanoTime()}. * Developers should prefer using this method over {@link #currentAnimationTimeMillis()} * because it offers a more accurate time for the calculating animation progress. * * @return the expected presentation time of a frame in the * {@link System#nanoTime()} time base. */ public static long getExpectedPresentationTimeNanos() { AnimationState state = sAnimationState.get(); return state.mExpectedPresentationTimeNanos; } /** * Loads an {@link Animation} object from a resource * Loading Loading
core/api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -54921,6 +54921,7 @@ package android.view.animation { public class AnimationUtils { ctor public AnimationUtils(); method public static long currentAnimationTimeMillis(); method public static long getExpectedPresentationTimeNanos(); method public static android.view.animation.Animation loadAnimation(android.content.Context, @AnimRes int) throws android.content.res.Resources.NotFoundException; method public static android.view.animation.Interpolator loadInterpolator(android.content.Context, @AnimRes @InterpolatorRes int) throws android.content.res.Resources.NotFoundException; method public static android.view.animation.LayoutAnimationController loadLayoutAnimation(android.content.Context, @AnimRes int) throws android.content.res.Resources.NotFoundException;
core/api/test-current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -3628,7 +3628,7 @@ package android.view.accessibility { package android.view.animation { public class AnimationUtils { method public static void lockAnimationClock(long); method public static void lockAnimationClock(long, long); method public static void unlockAnimationClock(); } Loading
core/java/android/view/Choreographer.java +2 −1 Original line number Diff line number Diff line Loading @@ -869,7 +869,8 @@ public final class Choreographer { Trace.traceBegin(Trace.TRACE_TAG_VIEW, message); } AnimationUtils.lockAnimationClock(frameTimeNanos / TimeUtils.NANOS_PER_MS); AnimationUtils.lockAnimationClock(frameTimeNanos / TimeUtils.NANOS_PER_MS, timeline.mExpectedPresentationTimeNanos); mFrameInfo.markInputHandlingStart(); doCallbacks(Choreographer.CALLBACK_INPUT, frameIntervalNanos); Loading
core/java/android/view/animation/AnimationUtils.java +22 −5 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ public class AnimationUtils { boolean animationClockLocked; long currentVsyncTimeMillis; long lastReportedTimeMillis; long mExpectedPresentationTimeNanos; }; private static ThreadLocal<AnimationState> sAnimationState Loading @@ -62,7 +63,8 @@ public class AnimationUtils { }; /** * Locks AnimationUtils{@link #currentAnimationTimeMillis()} to a fixed value for the current * Locks AnimationUtils{@link #currentAnimationTimeMillis()} and * AnimationUtils{@link #expectedPresentationTimeNanos()} to a fixed value for the current * thread. This is used by {@link android.view.Choreographer} to ensure that all accesses * during a vsync update are synchronized to the timestamp of the vsync. * Loading @@ -74,8 +76,9 @@ public class AnimationUtils { * Note that time is not allowed to "rewind" and must perpetually flow forward. So the * lock may fail if the time is in the past from a previously returned value, however * time will be frozen for the duration of the lock. The clock is a thread-local, so * ensure that {@link #lockAnimationClock(long)}, {@link #unlockAnimationClock()}, and * {@link #currentAnimationTimeMillis()} are all called on the same thread. * ensure that {@link #lockAnimationClock(long)}, {@link #unlockAnimationClock()}, * {@link #currentAnimationTimeMillis()}, and {@link #expectedPresentationTimeNanos()} * are all called on the same thread. * * This is also not reference counted in any way. Any call to {@link #unlockAnimationClock()} * will unlock the clock for everyone on the same thread. It is therefore recommended Loading @@ -83,12 +86,13 @@ public class AnimationUtils { * {@link android.view.Choreographer} instance. * * @hide * */ */ @TestApi public static void lockAnimationClock(long vsyncMillis) { public static void lockAnimationClock(long vsyncMillis, long expectedPresentationTimeNanos) { AnimationState state = sAnimationState.get(); state.animationClockLocked = true; state.currentVsyncTimeMillis = vsyncMillis; state.mExpectedPresentationTimeNanos = expectedPresentationTimeNanos; } /** Loading Loading @@ -123,6 +127,19 @@ public class AnimationUtils { return state.lastReportedTimeMillis; } /** * The expected presentation time of a frame in the {@link System#nanoTime()}. * Developers should prefer using this method over {@link #currentAnimationTimeMillis()} * because it offers a more accurate time for the calculating animation progress. * * @return the expected presentation time of a frame in the * {@link System#nanoTime()} time base. */ public static long getExpectedPresentationTimeNanos() { AnimationState state = sAnimationState.get(); return state.mExpectedPresentationTimeNanos; } /** * Loads an {@link Animation} object from a resource * Loading