Add timestamps to FMQ ChannelMessage
Figuring out relative message ordering is harder with FMQ because
messages on different channels without timestamps do not have a
guaranteed ordering. This CL adds timestamps to all channel messages
to ensure relative ordering is always known precisely, and to make
timing more accurate.
Bug: 321810554
Test: atest VtsHalPowerTargetTest
Change-Id: Iac341dec2526ac46ae9db57aadbd267224a77989
diff --git a/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/ChannelMessage.aidl b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/ChannelMessage.aidl
index 25f01c0..ab38fcc 100644
--- a/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/ChannelMessage.aidl
+++ b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/ChannelMessage.aidl
@@ -35,10 +35,11 @@
@FixedSize @VintfStability
parcelable ChannelMessage {
int sessionID;
+ long timeStampNanos;
android.hardware.power.ChannelMessage.ChannelMessageContents data;
@FixedSize @VintfStability
union ChannelMessageContents {
- int[20] tids = {(-1) /* -1 */, (-1) /* -1 */, (-1) /* -1 */, (-1) /* -1 */, (-1) /* -1 */, (-1) /* -1 */, (-1) /* -1 */, (-1) /* -1 */, (-1) /* -1 */, (-1) /* -1 */, (-1) /* -1 */, (-1) /* -1 */, (-1) /* -1 */, (-1) /* -1 */, (-1) /* -1 */, (-1) /* -1 */, (-1) /* -1 */, (-1) /* -1 */, (-1) /* -1 */, (-1) /* -1 */};
+ long[16] reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
long targetDuration;
android.hardware.power.SessionHint hint;
android.hardware.power.ChannelMessage.ChannelMessageContents.SessionModeSetter mode;
diff --git a/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/WorkDurationFixedV1.aidl b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/WorkDurationFixedV1.aidl
index 8cd246d..45310b8 100644
--- a/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/WorkDurationFixedV1.aidl
+++ b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/WorkDurationFixedV1.aidl
@@ -34,7 +34,6 @@
package android.hardware.power;
@FixedSize @VintfStability
parcelable WorkDurationFixedV1 {
- long timeStampNanos;
long durationNanos;
long workPeriodStartTimestampNanos;
long cpuDurationNanos;
diff --git a/power/aidl/android/hardware/power/ChannelMessage.aidl b/power/aidl/android/hardware/power/ChannelMessage.aidl
index 4747d90..fa16911 100644
--- a/power/aidl/android/hardware/power/ChannelMessage.aidl
+++ b/power/aidl/android/hardware/power/ChannelMessage.aidl
@@ -38,6 +38,12 @@
int sessionID;
/**
+ * Timestamp in nanoseconds based on CLOCK_MONOTONIC when the message was sent,
+ * used to ensure all messages can be processed in a coherent order.
+ */
+ long timeStampNanos;
+
+ /**
* A union defining the different messages that can be passed through the
* channel. Each type corresponds to a different call in IPowerHintSession.
*/
@@ -47,12 +53,9 @@
@VintfStability
union ChannelMessageContents {
/**
- * List of TIDs for this session to change to. Can be used in cases
- * where HintManagerService is not needed to validate the TIDs, such as
- * when all TIDs directly belong to the process that owns the session.
+ * Reserves the maximum fixed size for the ChannelMessage.
*/
- int[20] tids = {
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
+ long[16] reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
/**
* Setting this field will update the session’s target duration, equivalent
diff --git a/power/aidl/android/hardware/power/WorkDurationFixedV1.aidl b/power/aidl/android/hardware/power/WorkDurationFixedV1.aidl
index 2d202ff..ef5c755 100644
--- a/power/aidl/android/hardware/power/WorkDurationFixedV1.aidl
+++ b/power/aidl/android/hardware/power/WorkDurationFixedV1.aidl
@@ -20,12 +20,6 @@
@VintfStability
parcelable WorkDurationFixedV1 {
/**
- * Timestamp in nanoseconds based on CLOCK_MONOTONIC when the duration
- * sample was measured.
- */
- long timeStampNanos;
-
- /**
* Total work duration in nanoseconds.
*/
long durationNanos;