summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Melody Hsu <melodymhsu@google.com> 2025-02-12 23:03:03 +0000
committer Melody Hsu <melodymhsu@google.com> 2025-02-13 02:39:50 +0000
commitfe048f8d5b9192e6104bcf444d898c78fb0ae19e (patch)
tree4814fc07b9c86bbfb017ca3144e4316daf13457f
parent0a400b05e75158be4070b31692c170f8b331e4a1 (diff)
Init workload target in java FrameInfo
FrameInfo's workload target was never initialized on the Java side, and it resulted in occasions where the workload target value was 0. FrameInfo in DrawFrameTask populates itself from the FrameInfo.java, and this info is propagated into CanvasContext. This change ensures that the workload target also has a value going into JankTracker. Fixes: b/395917245 Test: presubmit, wear metric tests Flag: EXEMPT, bug fix Change-Id: I6540ee66d1ad8b0a22da516120cb2b9135c70398
-rw-r--r--graphics/java/android/graphics/FrameInfo.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/graphics/java/android/graphics/FrameInfo.java b/graphics/java/android/graphics/FrameInfo.java
index 7d236d203201..3b8f46630344 100644
--- a/graphics/java/android/graphics/FrameInfo.java
+++ b/graphics/java/android/graphics/FrameInfo.java
@@ -93,10 +93,12 @@ public final class FrameInfo {
// Interval between two consecutive frames
public static final int FRAME_INTERVAL = 11;
+ // Workload target deadline for a frame
+ public static final int WORKLOAD_TARGET = 12;
+
// Must be the last one
// This value must be in sync with `UI_THREAD_FRAME_INFO_SIZE` in FrameInfo.h
- // In calculating size, + 1 for Flags, and + 1 for WorkloadTarget from FrameInfo.h
- private static final int FRAME_INFO_SIZE = FRAME_INTERVAL + 2;
+ private static final int FRAME_INFO_SIZE = WORKLOAD_TARGET + 1;
/** checkstyle */
public void setVsync(long intendedVsync, long usedVsync, long frameTimelineVsyncId,
@@ -108,6 +110,7 @@ public final class FrameInfo {
frameInfo[FRAME_DEADLINE] = frameDeadline;
frameInfo[FRAME_START_TIME] = frameStartTime;
frameInfo[FRAME_INTERVAL] = frameInterval;
+ frameInfo[WORKLOAD_TARGET] = frameDeadline - intendedVsync;
}
/** checkstyle */