From 4bcbffd584755b90eb0b8690375f02fd3850ad79 Mon Sep 17 00:00:00 2001 From: Siarhei Vishniakou Date: Wed, 17 Feb 2021 06:19:36 +0000 Subject: Add presentTime to FrameInfo Present time is available to apps, but is not currently stored inside FrameInfo. In this CL, we add a location for storing the present time inside FrameInfo. Currently, the metrics reporter is triggered after the buffer is sent to SurfaceFlinger. That means, metrics for anything that happens after gpu draw completes are currently not available. In a future CL, we will populate the 'presentTime' field. In a future CL, we will register a metrics observer inside ViewRootImpl in order to send this data to InputDispatcher. This will enable end-to-end touch latency metrics collection. Bug: 169866723 Test: printed present time inside FrameTimeline.cpp (surfaceflinger side) and compared to the values printed inside a metrics observer registered in ViewRootImpl (not done in this CL) Test: atest ViewFrameInfoTest Change-Id: I7d0f8c5d7b5a2572abdc4e107123e8938a36f582 --- graphics/java/android/graphics/FrameInfo.java | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'graphics/java/android') diff --git a/graphics/java/android/graphics/FrameInfo.java b/graphics/java/android/graphics/FrameInfo.java index d59abb5916a0..189be53a397f 100644 --- a/graphics/java/android/graphics/FrameInfo.java +++ b/graphics/java/android/graphics/FrameInfo.java @@ -69,28 +69,26 @@ public final class FrameInfo { // animation & drawing system public static final int VSYNC = 3; - // The time of the oldest input event - public static final int OLDEST_INPUT_EVENT = 4; - - // The time of the newest input event - public static final int NEWEST_INPUT_EVENT = 5; + // The id of the input event that caused the current frame + public static final int INPUT_EVENT_ID = 4; // When input event handling started - public static final int HANDLE_INPUT_START = 6; + public static final int HANDLE_INPUT_START = 5; // When animation evaluations started - public static final int ANIMATION_START = 7; + public static final int ANIMATION_START = 6; // When ViewRootImpl#performTraversals() started - public static final int PERFORM_TRAVERSALS_START = 8; + public static final int PERFORM_TRAVERSALS_START = 7; // When View:draw() started - public static final int DRAW_START = 9; + public static final int DRAW_START = 8; // When the frame needs to be ready by - public static final int FRAME_DEADLINE = 10; + public static final int FRAME_DEADLINE = 9; // Must be the last one + // This value must be in sync with `UI_THREAD_FRAME_INFO_SIZE` in FrameInfo.h private static final int FRAME_INFO_SIZE = FRAME_DEADLINE + 1; /** checkstyle */ -- cgit v1.2.3-59-g8ed1b