Loading api/test-current.txt +9 −0 Original line number Diff line number Diff line Loading @@ -1047,6 +1047,15 @@ package android.view.accessibility { } package android.view.animation { public class AnimationUtils { method public static void lockAnimationClock(long); method public static void unlockAnimationClock(); } } package android.view.autofill { public final class AutofillId implements android.os.Parcelable { Loading core/java/android/view/animation/AnimationUtils.java +32 −2 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package android.view.animation; import android.annotation.AnimRes; import android.annotation.InterpolatorRes; import android.annotation.TestApi; import android.content.Context; import android.content.res.Resources; import android.content.res.Resources.NotFoundException; Loading Loading @@ -58,14 +59,43 @@ public class AnimationUtils { } }; /** @hide */ /** * Locks AnimationUtils{@link #currentAnimationTimeMillis()} 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. * * It is also exposed to tests to allow for rapid, flake-free headless testing. * * Must be followed by a call to {@link #unlockAnimationClock()} to allow time to * progress. Failing to do this will result in stuck animations, scrolls, and flings. * * 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. * * 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 * for tests to use their own thread to ensure that there is no collision with any existing * {@link android.view.Choreographer} instance. * * @hide * */ @TestApi public static void lockAnimationClock(long vsyncMillis) { AnimationState state = sAnimationState.get(); state.animationClockLocked = true; state.currentVsyncTimeMillis = vsyncMillis; } /** @hide */ /** * Frees the time lock set in place by {@link #lockAnimationClock(long)}. Must be called * to allow the animation clock to self-update. * * @hide */ @TestApi public static void unlockAnimationClock() { sAnimationState.get().animationClockLocked = false; } Loading Loading
api/test-current.txt +9 −0 Original line number Diff line number Diff line Loading @@ -1047,6 +1047,15 @@ package android.view.accessibility { } package android.view.animation { public class AnimationUtils { method public static void lockAnimationClock(long); method public static void unlockAnimationClock(); } } package android.view.autofill { public final class AutofillId implements android.os.Parcelable { Loading
core/java/android/view/animation/AnimationUtils.java +32 −2 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package android.view.animation; import android.annotation.AnimRes; import android.annotation.InterpolatorRes; import android.annotation.TestApi; import android.content.Context; import android.content.res.Resources; import android.content.res.Resources.NotFoundException; Loading Loading @@ -58,14 +59,43 @@ public class AnimationUtils { } }; /** @hide */ /** * Locks AnimationUtils{@link #currentAnimationTimeMillis()} 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. * * It is also exposed to tests to allow for rapid, flake-free headless testing. * * Must be followed by a call to {@link #unlockAnimationClock()} to allow time to * progress. Failing to do this will result in stuck animations, scrolls, and flings. * * 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. * * 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 * for tests to use their own thread to ensure that there is no collision with any existing * {@link android.view.Choreographer} instance. * * @hide * */ @TestApi public static void lockAnimationClock(long vsyncMillis) { AnimationState state = sAnimationState.get(); state.animationClockLocked = true; state.currentVsyncTimeMillis = vsyncMillis; } /** @hide */ /** * Frees the time lock set in place by {@link #lockAnimationClock(long)}. Must be called * to allow the animation clock to self-update. * * @hide */ @TestApi public static void unlockAnimationClock() { sAnimationState.get().animationClockLocked = false; } Loading