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

Commit 3966328f authored by Shane's avatar Shane
Browse files

Add flag for APIs that use expected presentation time

Add a Trunk Stable flag to gate the APIs that use the expected
presentation time.

Bug: 301713352
Test: atest AnimationUtilsTest
Change-Id: Iea31bb48868811e139e813ce195ab59639d45c03
parent b53ca9f0
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -54455,8 +54455,8 @@ package android.view.animation {
  public class AnimationUtils {
    ctor public AnimationUtils();
    method public static long currentAnimationTimeMillis();
    method public static long getExpectedPresentationTimeMillis();
    method public static long getExpectedPresentationTimeNanos();
    method @FlaggedApi("android.view.flags.expected_presentation_time_api") public static long getExpectedPresentationTimeMillis();
    method @FlaggedApi("android.view.flags.expected_presentation_time_api") 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;
+10 −0
Original line number Diff line number Diff line
@@ -16,7 +16,11 @@

package android.view.animation;

import static android.view.flags.Flags.FLAG_EXPECTED_PRESENTATION_TIME_API;
import static android.view.flags.Flags.expectedPresentationTimeApi;

import android.annotation.AnimRes;
import android.annotation.FlaggedApi;
import android.annotation.InterpolatorRes;
import android.annotation.TestApi;
import android.compat.annotation.ChangeId;
@@ -151,7 +155,12 @@ public class AnimationUtils {
     * @return the expected presentation time of a frame in the
     *         {@link System#nanoTime()} time base.
     */
    @FlaggedApi(FLAG_EXPECTED_PRESENTATION_TIME_API)
    public static long getExpectedPresentationTimeNanos() {
        if (!expectedPresentationTimeApi()) {
            return SystemClock.uptimeMillis();
        }

        AnimationState state = sAnimationState.get();
        return state.mExpectedPresentationTimeNanos;
    }
@@ -164,6 +173,7 @@ public class AnimationUtils {
     * @return the expected presentation time of a frame in the
     *         {@link SystemClock#uptimeMillis()} time base.
     */
    @FlaggedApi(FLAG_EXPECTED_PRESENTATION_TIME_API)
    public static long getExpectedPresentationTimeMillis() {
        return getExpectedPresentationTimeNanos() / TimeUtils.NANOS_PER_MS;
    }
+7 −0
Original line number Diff line number Diff line
@@ -13,3 +13,10 @@ flag {
    description: "Feature flag for toolkit to set frame rate"
    bug: "293512962"
}

flag {
    name: "expected_presentation_time_api"
    namespace: "toolkit"
    description: "Feature flag for using expected presentation time of the Choreographer"
    bug: "278730197"
}
 No newline at end of file