From 25b1675d21a477bda02474b431b5ba3d57f9ab87 Mon Sep 17 00:00:00 2001 From: Fengjiang Li Date: Wed, 11 Oct 2023 12:00:27 -0700 Subject: [PATCH] Trace unlock animation progress The unlock animation is subject to interruption from sysui. Adding trace would help us find root cause easier in the future. Bug: 301903832 Test: grab perfetto trace and verify the unlock progress is shown Change-Id: Iab0ca483beb01752b1dd67bd28f401d3e2e9cef7 --- src/com/android/launcher3/anim/PendingAnimation.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/com/android/launcher3/anim/PendingAnimation.java b/src/com/android/launcher3/anim/PendingAnimation.java index 7316420b12..fd731f473e 100644 --- a/src/com/android/launcher3/anim/PendingAnimation.java +++ b/src/com/android/launcher3/anim/PendingAnimation.java @@ -22,8 +22,10 @@ import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.animation.TimeInterpolator; import android.animation.ValueAnimator; +import android.os.Trace; import android.util.FloatProperty; +import com.android.launcher3.Utilities; import com.android.launcher3.anim.AnimatorPlaybackController.Holder; import java.util.ArrayList; @@ -82,6 +84,15 @@ public class PendingAnimation extends AnimatedPropertySetter { add(anim); } + /** If trace is enabled, add counter to trace animation progress. */ + public void logAnimationProgressToTrace(String counterName) { + if (Utilities.ATLEAST_Q && Trace.isEnabled()) { + super.addOnFrameListener( + animation -> Trace.setCounter( + counterName, (long) (animation.getAnimatedFraction() * 100))); + } + } + /** * Creates and returns the underlying AnimatorSet */