Revert "Use the Coreographer's frame time for a more reliable ti..."
Revert submission 30509816-raf-timing
Reason for revert: Likely culprit for b/381006945 - verified through ABTD before revert submission as part of standard investigation process.
Reverted changes: /q/submissionid:30509816-raf-timing
Change-Id: Iaed968120be662df8d915bac61e7cfa5b936f35c
diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
index 27790ce..21c4d8c 100644
--- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
+++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
@@ -80,8 +80,6 @@
import android.os.SystemClock;
import android.util.Log;
import android.util.Pair;
-import android.util.TimeUtils;
-import android.view.Choreographer;
import android.view.MotionEvent;
import android.view.RemoteAnimationTarget;
import android.view.SurfaceControl;
@@ -1730,30 +1728,13 @@
}
private void handOffAnimation(PointF velocityPxPerMs) {
- if (!TransitionAnimator.Companion.longLivedReturnAnimationsEnabled()) {
- return;
- }
-
- // This function is not guaranteed to be called inside a frame. We try to access the frame
- // time immediately, but if we're not inside a frame we must post a callback to be run at
- // the beginning of the next frame.
- try {
- handOffAnimationInternal(Choreographer.getInstance().getFrameTime(), velocityPxPerMs);
- } catch (IllegalStateException e) {
- Choreographer.getInstance().postFrameCallback(
- frameTimeNanos -> handOffAnimationInternal(
- frameTimeNanos / TimeUtils.NANOS_PER_MS, velocityPxPerMs));
- }
- }
-
- private void handOffAnimationInternal(long timestamp, PointF velocityPxPerMs) {
- if (mRecentsAnimationController == null) {
+ if (!TransitionAnimator.Companion.longLivedReturnAnimationsEnabled()
+ || mRecentsAnimationController == null) {
return;
}
Pair<RemoteAnimationTarget[], WindowAnimationState[]> targetsAndStates =
- extractTargetsAndStates(
- mRemoteTargetHandles, timestamp, velocityPxPerMs);
+ extractTargetsAndStates(mRemoteTargetHandles, velocityPxPerMs);
mRecentsAnimationController.handOffAnimation(
targetsAndStates.first, targetsAndStates.second);
ActiveGestureProtoLogProxy.logHandOffAnimation();
diff --git a/quickstep/src/com/android/quickstep/TaskViewUtils.java b/quickstep/src/com/android/quickstep/TaskViewUtils.java
index 084cede..783c87c 100644
--- a/quickstep/src/com/android/quickstep/TaskViewUtils.java
+++ b/quickstep/src/com/android/quickstep/TaskViewUtils.java
@@ -795,15 +795,14 @@
* second applies to the target in the same index of the first.
*
* @param handles The handles wrapping each target.
- * @param timestamp The start time of the current frame.
* @param velocityPxPerMs The current velocity of the target animations.
*/
@NonNull
public static Pair<RemoteAnimationTarget[], WindowAnimationState[]> extractTargetsAndStates(
- @NonNull RemoteTargetHandle[] handles, long timestamp,
- @NonNull PointF velocityPxPerMs) {
+ @NonNull RemoteTargetHandle[] handles, @NonNull PointF velocityPxPerMs) {
RemoteAnimationTarget[] targets = new RemoteAnimationTarget[handles.length];
WindowAnimationState[] animationStates = new WindowAnimationState[handles.length];
+ long timestamp = System.currentTimeMillis();
for (int i = 0; i < handles.length; i++) {
targets[i] = handles[i].getTransformParams().getTargetSet().apps[i];