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

Commit 8b85d991 authored by Mikhail Naganov's avatar Mikhail Naganov Committed by Automerger Merge Worker
Browse files

Merge "Audio: Add VTS tests for invalid enum-strings, Part 1" am: 254903f8 am: d5e5b72c

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1535386

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Iaad637212227062aea074ad7a6b034998cc370b0
parents bb567cff d5e5b72c
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -103,6 +103,11 @@ interface IDevice {
     * If the stream can not be opened with the proposed audio config,
     * HAL must provide suggested values for the audio config.
     *
     * Note: INVALID_ARGUMENTS is returned both in the case when the
     * HAL can not use the provided config and in the case when
     * the value of any argument is invalid. In the latter case the
     * HAL must provide a default initialized suggested config.
     *
     * @param ioHandle handle assigned by AudioFlinger.
     * @param device device type and (if needed) address.
     * @param config stream configuration.
@@ -111,7 +116,8 @@ interface IDevice {
                             May be used by implementations to configure hardware effects.
     * @return retval operation completion status.
     * @return outStream created output stream.
     * @return suggestedConfig in case of invalid parameters, suggested config.
     * @return suggestedConfig in the case of rejection of the proposed config,
     *                         a config suggested by the HAL.
     */
    openOutputStream(
            AudioIoHandle ioHandle,
@@ -128,6 +134,11 @@ interface IDevice {
     * If the stream can not be opened with the proposed audio config,
     * HAL must provide suggested values for the audio config.
     *
     * Note: INVALID_ARGUMENTS is returned both in the case when the
     * HAL can not use the provided config and in the case when
     * the value of any argument is invalid. In the latter case the
     * HAL must provide a default initialized suggested config.
     *
     * @param ioHandle handle assigned by AudioFlinger.
     * @param device device type and (if needed) address.
     * @param config stream configuration.
@@ -136,7 +147,8 @@ interface IDevice {
     *                     May be used by implementations to configure processing effects.
     * @return retval operation completion status.
     * @return inStream in case of success, created input stream.
     * @return suggestedConfig in case of invalid parameters, suggested config.
     * @return suggestedConfig in the case of rejection of the proposed config,
     *                         a config suggested by the HAL.
     */
    openInputStream(
            AudioIoHandle ioHandle,
+12 −6
Original line number Diff line number Diff line
@@ -40,6 +40,18 @@ interface IStreamIn extends IStream {
     */
    setGain(float gain) generates (Result retval);

    /**
     * Called when the metadata of the stream's sink has been changed.
     * Optional method
     *
     * @param sinkMetadata Description of the audio that is suggested by the clients.
     * @return retval operation completion status.
     *        If any of the metadata fields contains an invalid value,
     *        returns INVALID_ARGUMENTS.
     *        If method isn't supported by the HAL returns NOT_SUPPORTED.
     */
    updateSinkMetadata(SinkMetadata sinkMetadata) generates (Result retval);

    /**
     * Commands that can be executed on the driver reader thread.
     */
@@ -81,12 +93,6 @@ interface IStreamIn extends IStream {
        } reply;
    };

    /**
     * Called when the metadata of the stream's sink has been changed.
     * @param sinkMetadata Description of the audio that is suggested by the clients.
     */
    updateSinkMetadata(SinkMetadata sinkMetadata);

    /**
     * Set up required transports for receiving audio buffers from the driver.
     *
+12 −6
Original line number Diff line number Diff line
@@ -44,6 +44,18 @@ interface IStreamOut extends IStream {
     */
    setVolume(float left, float right) generates (Result retval);

    /**
     * Called when the metadata of the stream's source has been changed.
     * Optional method
     *
     * @param sourceMetadata Description of the audio that is played by the clients.
     * @return retval operation completion status.
     *        If any of the metadata fields contains an invalid value,
     *        returns INVALID_ARGUMENTS.
     *        If method isn't supported by the HAL returns NOT_SUPPORTED.
     */
    updateSourceMetadata(SourceMetadata sourceMetadata) generates (Result retval);

    /**
     * Commands that can be executed on the driver writer thread.
     */
@@ -76,12 +88,6 @@ interface IStreamOut extends IStream {
        } reply;
    };

    /**
     * Called when the metadata of the stream's source has been changed.
     * @param sourceMetadata Description of the audio that is played by the clients.
     */
    updateSourceMetadata(SourceMetadata sourceMetadata);

    /**
     * Set up required transports for passing audio buffers to the driver.
     *
+3 −4
Original line number Diff line number Diff line
@@ -212,12 +212,11 @@ static inline bool isOutputDevice(const std::string& device) {
    return isOutputDevice(stringToAudioDevice(device));
}

static inline bool isVendorExtension(const std::string& device) {
static inline bool isVendorExtension(const std::string& s) {
    // Must match the "vendorExtension" rule from the XSD file.
    static const std::string vendorPrefix = "VX_";
    return device.size() > vendorPrefix.size() &&
           device.substr(0, vendorPrefix.size()) == vendorPrefix &&
           std::all_of(device.begin() + vendorPrefix.size(), device.end(),
    return s.size() > vendorPrefix.size() && s.substr(0, vendorPrefix.size()) == vendorPrefix &&
           std::all_of(s.begin() + vendorPrefix.size(), s.end(),
                       [](unsigned char c) { return c == '_' || std::isalnum(c); });
}

+6 −2
Original line number Diff line number Diff line
@@ -270,7 +270,10 @@ struct AudioOffloadInfo {
 */
struct AudioConfig {
    AudioConfigBase base;
    AudioOffloadInfo offloadInfo;
    safe_union OffloadInfo {
        Monostate unspecified;
        AudioOffloadInfo info;
    } offloadInfo;
    uint64_t frameCount;
};

@@ -278,7 +281,8 @@ struct AudioConfig {
 * AudioTag is an additional use case qualifier complementing
 * AudioUsage and AudioContentType. Tags are set by vendor specific applications
 * and must be prefixed by "VX_". Vendor must namespace their tag
 * names to avoid conflicts.
 * names to avoid conflicts. See 'vendorExtension' in audio_policy_configuration.xsd
 * for a formal definition.
 */
typedef string AudioTag;

Loading