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

Commit 1c1fc91e authored by Matt Buckley's avatar Matt Buckley
Browse files

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
parent 6dd8341f
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -35,10 +35,11 @@ package android.hardware.power;
@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;
+0 −1
Original line number Diff line number Diff line
@@ -34,7 +34,6 @@
package android.hardware.power;
@FixedSize @VintfStability
parcelable WorkDurationFixedV1 {
  long timeStampNanos;
  long durationNanos;
  long workPeriodStartTimestampNanos;
  long cpuDurationNanos;
+8 −5
Original line number Diff line number Diff line
@@ -37,6 +37,12 @@ parcelable ChannelMessage {
     */
    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 @@ parcelable ChannelMessage {
    @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
+0 −6
Original line number Diff line number Diff line
@@ -19,12 +19,6 @@ package android.hardware.power;
@FixedSize
@VintfStability
parcelable WorkDurationFixedV1 {
    /**
     * Timestamp in nanoseconds based on CLOCK_MONOTONIC when the duration
     * sample was measured.
     */
    long timeStampNanos;

    /**
     * Total work duration in nanoseconds.
     */