Add latency metrics for recents gesture

Pass the touch down time to RecentsAnimation#startRecentsActivity.

Bug: 169221287
Test: Enable statsd log: "adb shell cmd stats print-logs"
      Touch gesture navigation bar.
      adb logcat | grep statsd | grep "(48)"
      The line may contain 0x100000->4[I] 0x110000->20[I]
      that means 4=by recents and 20=latency 20ms.
Change-Id: I81ee804895b7712f4d925736f5b4694c11a12cbe
(cherry picked from commit 63623967b8)
This commit is contained in:
Riddle Hsu 2020-09-30 00:32:04 +08:00 committed by Hyunyoung Song
parent e9bf2bd14c
commit 9d4a96ed02
3 changed files with 15 additions and 2 deletions

View File

@ -1476,6 +1476,11 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<?>, Q extends
mGestureEndCallback = gestureEndCallback;
}
@Override
public long getStartTouchTime() {
return mTouchTimeMs;
}
protected void linkRecentsViewScroll() {
SurfaceTransactionApplier.create(mRecentsView, applier -> {
mTransformParams.setSyncTransactionApplier(applier);

View File

@ -160,5 +160,12 @@ public class RecentsAnimationCallbacks implements
* Callback made when a task started from the recents is ready for an app transition.
*/
default void onTaskAppeared(RemoteAnimationTargetCompat appearedTaskTarget) {}
/**
* The time in milliseconds of the touch event that starts the recents animation.
*/
default long getStartTouchTime() {
return 0;
}
}
}

View File

@ -50,7 +50,7 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn
public void preloadRecentsAnimation(Intent intent) {
// Pass null animation handler to indicate this start is for preloading
UI_HELPER_EXECUTOR.execute(() -> ActivityManagerWrapper.getInstance()
.startRecentsActivity(intent, null, null, null, null));
.startRecentsActivity(intent, 0, null, null, null));
}
/**
@ -119,10 +119,11 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn
}
}
});
final long eventTime = listener.getStartTouchTime();
mCallbacks.addListener(gestureState);
mCallbacks.addListener(listener);
UI_HELPER_EXECUTOR.execute(() -> ActivityManagerWrapper.getInstance()
.startRecentsActivity(intent, null, mCallbacks, null, null));
.startRecentsActivity(intent, eventTime, mCallbacks, null, null));
gestureState.setState(STATE_RECENTS_ANIMATION_INITIALIZED);
return mCallbacks;
}