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

Commit bd483c03 authored by Mikhail Naganov's avatar Mikhail Naganov
Browse files

audio: Implement transient state testing

Add ModuleDebug.streamTransientStateDelayMs parameter to ensure
that streams stay in transient states for the specified amount of
time. This enabled sending commands from VTS while the stream is
still in a transient state.

Add 'getStatus' stream command to retrieve current positions,
counters, and stream state. Previously we were planning to use a
zero-sized burst command for that, however, after the
introduction of stream state machines, the 'burst' command is
not handled in every stream state, and may even affect the
current state, thus it's no more usable for this purpose.

Bug: 205884982
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I8717acace8d95d76bef2ec9fd6561796d7544992
parent 5eeb73be
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -35,4 +35,5 @@ package android.hardware.audio.core;
@JavaDerive(equals=true, toString=true) @VintfStability
parcelable ModuleDebug {
  boolean simulateDeviceConnections;
  int streamTransientStateDelayMs;
}
+2 −1
Original line number Diff line number Diff line
@@ -57,7 +57,8 @@ parcelable StreamDescriptor {
  }
  @FixedSize @VintfStability
  union Command {
    int hal_reserved_exit;
    int halReservedExit;
    android.media.audio.common.Void getStatus;
    android.media.audio.common.Void start;
    int burst;
    android.media.audio.common.Void drain;
+5 −1
Original line number Diff line number Diff line
@@ -53,9 +53,13 @@ interface IModule {
     * the HAL module behavior that would otherwise require human intervention.
     *
     * The HAL module must throw an error if there is an attempt to change
     * the debug behavior for the aspect which is currently in use.
     * the debug behavior for the aspect which is currently in use, or when
     * the value of any of the debug flags is invalid. See 'ModuleDebug' for
     * the full list of constraints.
     *
     * @param debug The debug options.
     * @throws EX_ILLEGAL_ARGUMENT If some of the configuration parameters are
     *                             invalid.
     * @throws EX_ILLEGAL_STATE If the flag(s) being changed affect functionality
     *                          which is currently in use.
     */
+9 −0
Original line number Diff line number Diff line
@@ -35,4 +35,13 @@ parcelable ModuleDebug {
     *    profiles.
     */
    boolean simulateDeviceConnections;
    /**
     * Must be non-negative. When set to non-zero, HAL module must delay
     * transition from "transient" stream states (see StreamDescriptor.aidl)
     * by the specified amount of milliseconds. The purpose of this delay
     * is to allow VTS to test sending of stream commands while the stream is
     * in a transient state. The delay must apply to newly created streams,
     * it is not required to apply the delay to already opened streams.
     */
    int streamTransientStateDelayMs;
}
+21 −12
Original line number Diff line number Diff line
@@ -90,7 +90,7 @@ import android.media.audio.common.Void;
 * consumer can become active, but not both at the same time. States 'STANDBY',
 * 'IDLE', 'READY', and '*PAUSED' are "stable"—they require an external event,
 * whereas a change from the 'DRAINING' state can happen with time as the buffer
 * gets empty.
 * gets empty, thus it's a "transient" state.
 *
 * The state machine for input streams is defined in the `stream-in-sm.gv` file,
 * for output streams—in the `stream-out-sm.gv` file. State machines define how
@@ -198,7 +198,14 @@ parcelable StreamDescriptor {
         * implementation must pass a random cookie as the command argument,
         * which is only known to the implementation.
         */
        int hal_reserved_exit;
        int halReservedExit;
        /**
         * Retrieve the current state of the stream. This command must be
         * processed by the stream in any state. The stream must provide current
         * positions, counters, and its state in the reply. This command must be
         * handled by the HAL module without any observable side effects.
         */
        Void getStatus;
        /**
         * See the state machines on the applicability of this command to
         * different states.
@@ -215,15 +222,14 @@ parcelable StreamDescriptor {
         *    read from the hardware into the 'audio.fmq' queue.
         *
         * In both cases it is allowed for this field to contain any
         * non-negative number. The value 0 can be used if the client only needs
         * to retrieve current positions and latency. Any sufficiently big value
         * which exceeds the size of the queue's area which is currently
         * available for reading or writing by the HAL module must be trimmed by
         * the HAL module to the available size. Note that the HAL module is
         * allowed to consume or provide less data than requested, and it must
         * return the amount of actually read or written data via the
         * 'Reply.fmqByteCount' field. Thus, only attempts to pass a negative
         * number must be constituted as a client's error.
         * non-negative number. Any sufficiently big value which exceeds the
         * size of the queue's area which is currently available for reading or
         * writing by the HAL module must be trimmed by the HAL module to the
         * available size. Note that the HAL module is allowed to consume or
         * provide less data than requested, and it must return the amount of
         * actually read or written data via the 'Reply.fmqByteCount'
         * field. Thus, only attempts to pass a negative number must be
         * constituted as a client's error.
         *
         * Differences for the MMap No IRQ mode:
         *
@@ -233,6 +239,9 @@ parcelable StreamDescriptor {
         *    with sending of this command.
         *
         *  - the value must always be set to 0.
         *
         * See the state machines on the applicability of this command to
         * different states.
         */
        int burst;
        /**
Loading