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

Commit 117af818 authored by Mikhail Naganov's avatar Mikhail Naganov Committed by Automerger Merge Worker
Browse files

Implement a.h.audio.common@7.0-util module am: 1b444a53

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

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I1a6e957ad7772bc3b91e13ead896d5ff16dd798a
parents 1183e868 1b444a53
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -360,7 +360,7 @@ package android.audio.policy.configuration.V7_0 {
  public static class DevicePorts.DevicePort {
    ctor public DevicePorts.DevicePort();
    method @Nullable public String getAddress();
    method @Nullable public java.util.List<android.audio.policy.configuration.V7_0.AudioFormat> getEncodedFormats();
    method @Nullable public java.util.List<java.lang.String> getEncodedFormats();
    method @Nullable public android.audio.policy.configuration.V7_0.Gains getGains();
    method @Nullable public java.util.List<android.audio.policy.configuration.V7_0.Profile> getProfile();
    method @Nullable public android.audio.policy.configuration.V7_0.Role getRole();
@@ -368,7 +368,7 @@ package android.audio.policy.configuration.V7_0 {
    method @Nullable public String getType();
    method @Nullable public boolean get_default();
    method public void setAddress(@Nullable String);
    method public void setEncodedFormats(@Nullable java.util.List<android.audio.policy.configuration.V7_0.AudioFormat>);
    method public void setEncodedFormats(@Nullable java.util.List<java.lang.String>);
    method public void setGains(@Nullable android.audio.policy.configuration.V7_0.Gains);
    method public void setRole(@Nullable android.audio.policy.configuration.V7_0.Role);
    method public void setTagName(@Nullable String);
@@ -527,10 +527,10 @@ package android.audio.policy.configuration.V7_0 {

  public static class SurroundFormats.Format {
    ctor public SurroundFormats.Format();
    method @Nullable public android.audio.policy.configuration.V7_0.AudioFormat getName();
    method @Nullable public java.util.List<android.audio.policy.configuration.V7_0.AudioFormat> getSubformats();
    method public void setName(@Nullable android.audio.policy.configuration.V7_0.AudioFormat);
    method public void setSubformats(@Nullable java.util.List<android.audio.policy.configuration.V7_0.AudioFormat>);
    method @Nullable public String getName();
    method @Nullable public java.util.List<java.lang.String> getSubformats();
    method public void setName(@Nullable String);
    method public void setSubformats(@Nullable java.util.List<java.lang.String>);
  }

  public class SurroundSound {
+2 −2
Original line number Diff line number Diff line
@@ -774,13 +774,13 @@
        </xs:sequence>
    </xs:complexType>
    <xs:simpleType name="audioFormatsList">
        <xs:list itemType="audioFormat" />
        <xs:list itemType="extendableAudioFormat" />
    </xs:simpleType>
    <xs:complexType name="surroundFormats">
        <xs:sequence>
            <xs:element name="format" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:attribute name="name" type="audioFormat" use="required"/>
                    <xs:attribute name="name" type="extendableAudioFormat" use="required"/>
                    <xs:attribute name="subformats" type="audioFormatsList" />
                </xs:complexType>
            </xs:element>
+21 −14
Original line number Diff line number Diff line
@@ -179,7 +179,8 @@ struct AudioFrequencyResponsePoint {
 * Used by StreamIn and Device
 */
struct MicrophoneInfo {
    /** Unique alphanumeric id for microphone. Guaranteed to be the same
    /**
     * Unique alphanumeric id for microphone. Guaranteed to be the same
     * even after rebooting.
     */
    string                                  deviceId;
@@ -187,17 +188,20 @@ struct MicrophoneInfo {
     * Device specific information
     */
    DeviceAddress                           deviceAddress;
    /** Each element of the vector must describe the channel with the same
    /**
     * Each element of the vector must describe the channel with the same
     * index.
     */
    vec<AudioMicrophoneChannelMapping>      channelMapping;
    /** Location of the microphone in regard to the body of the device */
    AudioMicrophoneLocation                 location;
    /** Identifier to help group related microphones together
    /**
     * Identifier to help group related microphones together
     * e.g. microphone arrays should belong to the same group
     */
    AudioMicrophoneGroup                    group;
    /** Index of this microphone within the group.
    /**
     * Index of this microphone within the group.
     * (group, index) must be unique within the same device.
     */
    uint32_t                                indexInTheGroup;
@@ -209,16 +213,19 @@ struct MicrophoneInfo {
    float                                   minSpl;
    /** Standard polar pattern of the microphone */
    AudioMicrophoneDirectionality           directionality;
    /** Vector with ordered frequency responses (from low to high frequencies)
    /**
     * Vector with ordered frequency responses (from low to high frequencies)
     * with the frequency response of the microphone.
     * Levels are in dB, relative to level at 1000 Hz
     */
    vec<AudioFrequencyResponsePoint>        frequencyResponse;
    /** Position of the microphone's capsule in meters, from the
    /**
     * Position of the microphone's capsule in meters, from the
     * bottom-left-back corner of the bounding box of device.
     */
    AudioMicrophoneCoordinate               position;
    /** Normalized point to signal the main orientation of the microphone's
    /**
     * Normalized point to signal the main orientation of the microphone's
     * capsule. sqrt(x^2 + y^2 + z^2) = 1
     */
    AudioMicrophoneCoordinate               orientation;
+39 −0
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@
#define ANDROID_AUDIO_POLICY_CONFIGURATION_V7_0_ENUMS_H

#include <sys/types.h>
#include <algorithm>
#include <cctype>

#include <android_audio_policy_configuration_V7_0.h>

@@ -210,6 +212,43 @@ static inline bool isOutputDevice(const std::string& device) {
    return isOutputDevice(stringToAudioDevice(device));
}

static inline bool isVendorExtension(const std::string& device) {
    // 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(),
                       [](unsigned char c) { return c == '_' || std::isalnum(c); });
}

static inline bool isUnknownAudioChannelMask(const std::string& mask) {
    return stringToAudioChannelMask(mask) == AudioChannelMask::UNKNOWN;
}

static inline bool isUnknownAudioDevice(const std::string& device) {
    return stringToAudioDevice(device) == AudioDevice::UNKNOWN && !isVendorExtension(device);
}

static inline bool isUnknownAudioFormat(const std::string& format) {
    return stringToAudioFormat(format) == AudioFormat::UNKNOWN && !isVendorExtension(format);
}

static inline bool isUnknownAudioGainMode(const std::string& mode) {
    return stringToAudioGainMode(mode) == AudioGainMode::UNKNOWN;
}

static inline bool isUnknownAudioSource(const std::string& source) {
    return stringToAudioSource(source) == AudioSource::UNKNOWN;
}

static inline bool isUnknownAudioStreamType(const std::string& streamType) {
    return stringToAudioStreamType(streamType) == AudioStreamType::UNKNOWN;
}

static inline bool isUnknownAudioUsage(const std::string& usage) {
    return stringToAudioUsage(usage) == AudioUsage::UNKNOWN;
}

}  // namespace android::audio::policy::configuration::V7_0

#endif  // ANDROID_AUDIO_POLICY_CONFIGURATION_V7_0_ENUMS_H
+18 −12
Original line number Diff line number Diff line
@@ -118,9 +118,9 @@ typedef string AudioChannelMask;
 * Base configuration attributes applicable to any stream of audio.
 */
struct AudioConfigBase {
    AudioFormat format;                 // 'DEFAULT' means 'unspecified'
    AudioFormat format;                 // empty means 'unspecified'
    uint32_t sampleRateHz;              // 0 means 'unspecified'
    vec<AudioChannelMask> channelMask;  // empty means 'unspecified'
    AudioChannelMask channelMask;       // empty means 'unspecified'
};

/**
@@ -167,10 +167,18 @@ struct DeviceAddress {
    AudioDevice deviceType;
    safe_union Address {
        /**
         * The address may be left unspecified if 'device' specifies
         * a physical device unambiguously.
         */
        Monostate unspecified;
         * String uniquely identifying the device among other devices
         * of the same type. Can be empty in case there is only one device
         * of this type.
         *
         * Depending on the device type, its id may be assigned by the framework
         * (this is done for REMOTE_SUBMIX), or specified in the audio policy
         * configuration file (typically done for BUS devices), or assigned
         * by the HAL service. In any case, both framework and HAL must
         * never attempt to parse the value of the id. If the address must
         * be parsed, one of the members below must be used instead of 'id'.
         */
        string id;
        /** IEEE 802 MAC address. Set for Bluetooth devices. */
        uint8_t[6] mac;
        /** IPv4 Address. Set for IPv4 devices. */
@@ -182,10 +190,6 @@ struct DeviceAddress {
            int32_t card;
            int32_t device;
        } alsa;
        /** Arbitrary BUS device unique address. Not interpreted by the framework. */
        string bus;
        /** Arbitrary REMOTE_SUBMIX device unique address. Not interpreted by the HAL. */
        string rSubmix;
    } address;
};

@@ -349,9 +353,9 @@ struct AudioGainConfig {
    /**
     * Gain values in millibels for each channel ordered from LSb to MSb in
     * channel mask. The number of values is 1 in joint mode or
     * popcount(channel_mask).
     * the number of channels in the channel mask.
     */
    int32_t[4 * 8] values;
    vec<int32_t> values;
    uint32_t rampDurationMs;  // ramp duration in ms
};

@@ -409,7 +413,7 @@ struct AudioPortConfig {
     * parameters (or none) may be set. See the documentation of the
     * AudioConfigBase struct.
     */
    AudioConfigBase config;
    AudioConfigBase base;
    /** Associated gain control. */
    safe_union OptionalGain {
        Monostate unspecified;
@@ -439,6 +443,8 @@ struct AudioPort {
    vec<AudioProfile> profiles;
    /** List of gain controls attached to the port. */
    vec<AudioGain> gains;
    /** Parameters that depend on the actual port role. */
    AudioPortExtendedInfo ext;
    /**
     * Current configuration of the audio port, may have all the fields left
     * unspecified.
Loading