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

Commit 9d4a96ed authored by Riddle Hsu's avatar Riddle Hsu Committed by Hyunyoung Song
Browse files

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 63623967)
parent e9bf2bd1
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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);
+7 −0
Original line number Diff line number Diff line
@@ -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;
        }
    }
}
+3 −2
Original line number Diff line number Diff line
@@ -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;
    }