Added VSYNC and INTENDED_VSYNC timestamps to FrameMetrics API.
BUG: b/31650117 Test: cts-tradefed run singleCommand cts --skip-device-info --skip-preconditions -m CtsViewTestCases -t android.view.cts.FrameMetricsListenerTest Change-Id: I8341809b6dac420859dad8c21f30d4ee8897425d
This commit is contained in:
@@ -43115,11 +43115,13 @@ package android.view {
|
||||
field public static final int DRAW_DURATION = 4; // 0x4
|
||||
field public static final int FIRST_DRAW_FRAME = 9; // 0x9
|
||||
field public static final int INPUT_HANDLING_DURATION = 1; // 0x1
|
||||
field public static final int INTENDED_VSYNC_TIMESTAMP = 10; // 0xa
|
||||
field public static final int LAYOUT_MEASURE_DURATION = 3; // 0x3
|
||||
field public static final int SWAP_BUFFERS_DURATION = 7; // 0x7
|
||||
field public static final int SYNC_DURATION = 5; // 0x5
|
||||
field public static final int TOTAL_DURATION = 8; // 0x8
|
||||
field public static final int UNKNOWN_DELAY_DURATION = 0; // 0x0
|
||||
field public static final int VSYNC_TIMESTAMP = 11; // 0xb
|
||||
}
|
||||
|
||||
public abstract class FrameStats {
|
||||
|
||||
@@ -46660,11 +46660,13 @@ package android.view {
|
||||
field public static final int DRAW_DURATION = 4; // 0x4
|
||||
field public static final int FIRST_DRAW_FRAME = 9; // 0x9
|
||||
field public static final int INPUT_HANDLING_DURATION = 1; // 0x1
|
||||
field public static final int INTENDED_VSYNC_TIMESTAMP = 10; // 0xa
|
||||
field public static final int LAYOUT_MEASURE_DURATION = 3; // 0x3
|
||||
field public static final int SWAP_BUFFERS_DURATION = 7; // 0x7
|
||||
field public static final int SYNC_DURATION = 5; // 0x5
|
||||
field public static final int TOTAL_DURATION = 8; // 0x8
|
||||
field public static final int UNKNOWN_DELAY_DURATION = 0; // 0x0
|
||||
field public static final int VSYNC_TIMESTAMP = 11; // 0xb
|
||||
}
|
||||
|
||||
public abstract class FrameStats {
|
||||
|
||||
@@ -43468,11 +43468,13 @@ package android.view {
|
||||
field public static final int DRAW_DURATION = 4; // 0x4
|
||||
field public static final int FIRST_DRAW_FRAME = 9; // 0x9
|
||||
field public static final int INPUT_HANDLING_DURATION = 1; // 0x1
|
||||
field public static final int INTENDED_VSYNC_TIMESTAMP = 10; // 0xa
|
||||
field public static final int LAYOUT_MEASURE_DURATION = 3; // 0x3
|
||||
field public static final int SWAP_BUFFERS_DURATION = 7; // 0x7
|
||||
field public static final int SYNC_DURATION = 5; // 0x5
|
||||
field public static final int TOTAL_DURATION = 8; // 0x8
|
||||
field public static final int UNKNOWN_DELAY_DURATION = 0; // 0x0
|
||||
field public static final int VSYNC_TIMESTAMP = 11; // 0xb
|
||||
}
|
||||
|
||||
public abstract class FrameStats {
|
||||
|
||||
@@ -132,6 +132,26 @@ public final class FrameMetrics {
|
||||
*/
|
||||
public static final int FIRST_DRAW_FRAME = 9;
|
||||
|
||||
/**
|
||||
* Metric identifier for the timestamp of the intended vsync for this frame.
|
||||
* <p>
|
||||
* The intended start point for the frame. If this value is different from
|
||||
* {@link #VSYNC_TIMESTAMP}, there was work occurring on the UI thread that
|
||||
* prevented it from responding to the vsync signal in a timely fashion.
|
||||
* </p>
|
||||
*/
|
||||
public static final int INTENDED_VSYNC_TIMESTAMP = 10;
|
||||
|
||||
/**
|
||||
* Metric identifier for the timestamp of the actual vsync for this frame.
|
||||
* <p>
|
||||
* The time value that was used in all the vsync listeners and drawing for
|
||||
* the frame (Choreographer frame callbacks, animations,
|
||||
* {@link View#getDrawingTime()}, etc…)
|
||||
* </p>
|
||||
*/
|
||||
public static final int VSYNC_TIMESTAMP = 11;
|
||||
|
||||
private static final int FRAME_INFO_FLAG_FIRST_DRAW = 1 << 0;
|
||||
|
||||
/**
|
||||
@@ -151,6 +171,8 @@ public final class FrameMetrics {
|
||||
SWAP_BUFFERS_DURATION,
|
||||
TOTAL_DURATION,
|
||||
FIRST_DRAW_FRAME,
|
||||
INTENDED_VSYNC_TIMESTAMP,
|
||||
VSYNC_TIMESTAMP,
|
||||
})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface Metric {}
|
||||
@@ -261,7 +283,7 @@ public final class FrameMetrics {
|
||||
* @return the value of the metric or -1 if it is not available.
|
||||
*/
|
||||
public long getMetric(@Metric int id) {
|
||||
if (id < UNKNOWN_DELAY_DURATION || id > FIRST_DRAW_FRAME) {
|
||||
if (id < UNKNOWN_DELAY_DURATION || id > VSYNC_TIMESTAMP) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -271,6 +293,10 @@ public final class FrameMetrics {
|
||||
|
||||
if (id == FIRST_DRAW_FRAME) {
|
||||
return (mTimingData[Index.FLAGS] & FRAME_INFO_FLAG_FIRST_DRAW) != 0 ? 1 : 0;
|
||||
} else if (id == INTENDED_VSYNC_TIMESTAMP) {
|
||||
return mTimingData[Index.INTENDED_VSYNC];
|
||||
} else if (id == VSYNC_TIMESTAMP) {
|
||||
return mTimingData[Index.VSYNC];
|
||||
}
|
||||
|
||||
int durationsIdx = 2 * id;
|
||||
|
||||
Reference in New Issue
Block a user