From 1d214226b53e8dbe764ba23f2cee99b7d194f3a2 Mon Sep 17 00:00:00 2001 From: Jakub Tyszkowski Date: Tue, 16 Jan 2024 09:44:48 +0000 Subject: [PATCH] LeAudio: Fix AIDL API review issues Bug: 319669518 Test: m android.hardware.bluetooth.audio-update-api && make && m VtsHalBluetoothAudioTargetTest Change-Id: Id128ed1eb09ada1e98b15351dc353fedc90fcbc8 --- .../audio/CodecSpecificCapabilitiesLtv.aidl | 4 +- .../bluetooth/audio/ConfigurationFlags.aidl | 8 +- .../audio/IBluetoothAudioProvider.aidl | 28 +-- .../hardware/bluetooth/audio/CodecId.aidl | 2 +- .../hardware/bluetooth/audio/CodecInfo.aidl | 14 +- .../audio/CodecSpecificCapabilitiesLtv.aidl | 12 +- .../bluetooth/audio/ConfigurationFlags.aidl | 20 +-- .../audio/IBluetoothAudioProvider.aidl | 164 ++++++++++++++---- .../hardware/bluetooth/audio/MetadataLtv.aidl | 5 +- .../default/LeAudioOffloadAudioProvider.cpp | 11 +- .../vts/VtsHalBluetoothAudioTargetTest.cpp | 10 +- 11 files changed, 197 insertions(+), 81 deletions(-) diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/CodecSpecificCapabilitiesLtv.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/CodecSpecificCapabilitiesLtv.aidl index 1049d983fb..60c276b0dd 100644 --- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/CodecSpecificCapabilitiesLtv.aidl +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/CodecSpecificCapabilitiesLtv.aidl @@ -74,8 +74,8 @@ union CodecSpecificCapabilitiesLtv { const int EIGHT = 0x80; } parcelable SupportedOctetsPerCodecFrame { - int minimum; - int maximum; + int min; + int max; } parcelable SupportedMaxCodecFramesPerSDU { int value; diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/ConfigurationFlags.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/ConfigurationFlags.aidl index baf0a4e9f6..6b3cf723cf 100644 --- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/ConfigurationFlags.aidl +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/ConfigurationFlags.aidl @@ -38,8 +38,8 @@ parcelable ConfigurationFlags { const int NONE = 0x0000; const int LOSSLESS = 0x0001; const int LOW_LATENCY = 0x0002; - const int ALLOW_ASYMMETRIC_CONFIGURATIONS = 0x0003; - const int SPATIAL_AUDIO = 0x0004; - const int PROVIDE_ASE_METADATA = 0x0005; - const int MONO_MIC_CONFIGURATION = 0x0006; + const int ALLOW_ASYMMETRIC_CONFIGURATIONS = 0x0004; + const int SPATIAL_AUDIO = 0x0008; + const int PROVIDE_ASE_METADATA = 0x0010; + const int MONO_MIC_CONFIGURATION = 0x0020; } diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl index 87401ff7fd..3a2dcef799 100644 --- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl @@ -43,13 +43,15 @@ interface IBluetoothAudioProvider { android.hardware.bluetooth.audio.A2dpStatus parseA2dpConfiguration(in android.hardware.bluetooth.audio.CodecId codecId, in byte[] configuration, out android.hardware.bluetooth.audio.CodecParameters codecParameters); @nullable android.hardware.bluetooth.audio.A2dpConfiguration getA2dpConfiguration(in List remoteA2dpCapabilities, in android.hardware.bluetooth.audio.A2dpConfigurationHint hint); void setCodecPriority(in android.hardware.bluetooth.audio.CodecId codecId, int priority); - List getLeAudioAseConfiguration(in @nullable List remoteSinkAudioCapabilities, in @nullable List remoteSourceAudioCapabilities, in List requirements); + android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioAseConfigurationSetting[] getLeAudioAseConfiguration(in @nullable android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioDeviceCapabilities[] remoteSinkAudioCapabilities, in @nullable android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioDeviceCapabilities[] remoteSourceAudioCapabilities, in android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioConfigurationRequirement[] requirements); android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioAseQosConfigurationPair getLeAudioAseQosConfiguration(in android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioAseQosConfigurationRequirement qosRequirement); android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioDataPathConfigurationPair getLeAudioAseDatapathConfiguration(in @nullable android.hardware.bluetooth.audio.IBluetoothAudioProvider.StreamConfig sinkConfig, in @nullable android.hardware.bluetooth.audio.IBluetoothAudioProvider.StreamConfig sourceConfig); void onSinkAseMetadataChanged(in android.hardware.bluetooth.audio.IBluetoothAudioProvider.AseState state, int cigId, int cisId, in @nullable android.hardware.bluetooth.audio.MetadataLtv[] metadata); void onSourceAseMetadataChanged(in android.hardware.bluetooth.audio.IBluetoothAudioProvider.AseState state, int cigId, int cisId, in @nullable android.hardware.bluetooth.audio.MetadataLtv[] metadata); - android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioBroadcastConfigurationSetting getLeAudioBroadcastConfiguration(in @nullable List remoteSinkAudioCapabilities, in android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioBroadcastConfigurationRequirement requirement); - android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioDataPathConfiguration getLeAudioBroadcastDatapathConfiguration(in android.hardware.bluetooth.audio.AudioContext context, in android.hardware.bluetooth.audio.LeAudioBroadcastConfiguration.BroadcastStreamMap[] streamMap); + android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioBroadcastConfigurationSetting getLeAudioBroadcastConfiguration(in @nullable android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioDeviceCapabilities[] remoteSinkAudioCapabilities, in android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioBroadcastConfigurationRequirement requirement); + android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioDataPathConfiguration getLeAudioBroadcastDatapathConfiguration(in android.hardware.bluetooth.audio.AudioContext audioContext, in android.hardware.bluetooth.audio.LeAudioBroadcastConfiguration.BroadcastStreamMap[] streamMap); + const int CODEC_PRIORITY_DISABLED = (-1) /* -1 */; + const int CODEC_PRIORITY_NONE = 0; @VintfStability parcelable LeAudioDeviceCapabilities { android.hardware.bluetooth.audio.CodecId codecId; @@ -97,8 +99,8 @@ interface IBluetoothAudioProvider { parcelable LeAudioAseConfigurationSetting { android.hardware.bluetooth.audio.AudioContext audioContext; android.hardware.bluetooth.audio.IBluetoothAudioProvider.Packing packing; - @nullable List sinkAseConfiguration; - @nullable List sourceAseConfiguration; + @nullable android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioAseConfigurationSetting.AseDirectionConfiguration[] sinkAseConfiguration; + @nullable android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioAseConfigurationSetting.AseDirectionConfiguration[] sourceAseConfiguration; @nullable android.hardware.bluetooth.audio.ConfigurationFlags flags; @VintfStability parcelable AseDirectionConfiguration { @@ -110,8 +112,8 @@ interface IBluetoothAudioProvider { @VintfStability parcelable LeAudioConfigurationRequirement { android.hardware.bluetooth.audio.AudioContext audioContext; - @nullable List sinkAseRequirement; - @nullable List sourceAseRequirement; + @nullable android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioConfigurationRequirement.AseDirectionRequirement[] sinkAseRequirement; + @nullable android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioConfigurationRequirement.AseDirectionRequirement[] sourceAseRequirement; @nullable android.hardware.bluetooth.audio.ConfigurationFlags flags; @VintfStability parcelable AseDirectionRequirement { @@ -120,7 +122,7 @@ interface IBluetoothAudioProvider { } @VintfStability parcelable LeAudioAseQosConfigurationRequirement { - android.hardware.bluetooth.audio.AudioContext contextType; + android.hardware.bluetooth.audio.AudioContext audioContext; @nullable android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioAseQosConfigurationRequirement.AseQosDirectionRequirement sinkAseQosRequirement; @nullable android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioAseQosConfigurationRequirement.AseQosDirectionRequirement sourceAseQosRequirement; @nullable android.hardware.bluetooth.audio.ConfigurationFlags flags; @@ -147,7 +149,7 @@ interface IBluetoothAudioProvider { @nullable android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioDataPathConfiguration outputConfig; } parcelable StreamConfig { - android.hardware.bluetooth.audio.AudioContext context; + android.hardware.bluetooth.audio.AudioContext audioContext; android.hardware.bluetooth.audio.LeAudioConfiguration.StreamMap[] streamMap; } @Backing(type="byte") @VintfStability @@ -163,13 +165,13 @@ interface IBluetoothAudioProvider { } @VintfStability parcelable LeAudioBroadcastSubgroupConfigurationRequirement { - android.hardware.bluetooth.audio.AudioContext context; + android.hardware.bluetooth.audio.AudioContext audioContext; android.hardware.bluetooth.audio.IBluetoothAudioProvider.BroadcastQuality quality; int bisNumPerSubgroup; } @VintfStability parcelable LeAudioBroadcastConfigurationRequirement { - List subgroupConfigurationRequirements; + android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioBroadcastSubgroupConfigurationRequirement[] subgroupConfigurationRequirements; } @VintfStability parcelable LeAudioSubgroupBisConfiguration { @@ -178,7 +180,7 @@ interface IBluetoothAudioProvider { } @VintfStability parcelable LeAudioBroadcastSubgroupConfiguration { - List bisConfigurations; + android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioSubgroupBisConfiguration[] bisConfigurations; @nullable byte[] vendorCodecConfiguration; } @VintfStability @@ -192,6 +194,6 @@ interface IBluetoothAudioProvider { android.hardware.bluetooth.audio.IBluetoothAudioProvider.Packing packing; android.hardware.bluetooth.audio.IBluetoothAudioProvider.Framing framing; @nullable android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioDataPathConfiguration dataPathConfiguration; - List subgroupsConfigurations; + android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioBroadcastSubgroupConfiguration[] subgroupsConfigurations; } } diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecId.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecId.aidl index 896a712fcd..22439574d5 100644 --- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecId.aidl +++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecId.aidl @@ -32,7 +32,7 @@ union CodecId { /** * Vendor Codec: - * id 16 bits - Assigned by BT Sig + * id 16 bits - Vendor identifier, assigned by BT Sig [Assigned Numbers - 7.1] * codecId 16 bits - Assigned by the vendor */ parcelable Vendor { diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecInfo.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecInfo.aidl index 33f0c04307..b60d70f3c8 100644 --- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecInfo.aidl +++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecInfo.aidl @@ -26,9 +26,12 @@ import android.hardware.bluetooth.audio.ConfigurationFlags; @VintfStability parcelable CodecInfo { /** - * Codec identifier and human readable name + * Codec identifier */ CodecId id; + /** + * Human readable name used to present codec to the user and for debug logs + */ String name; /** @@ -92,17 +95,18 @@ parcelable CodecInfo { */ parcelable LeAudio { /** - * Channel configuration: Mono, Dual-Mono or Stereo + * List of independently supported channel modes: Mono, Dual-Mono, or + * Stereo. */ ChannelMode[] channelMode; /** - * Supported sampling frequencies, in Hz. + * List of supported sampling frequencies, in Hz. */ int[] samplingFrequencyHz; - /* - * FrameDuration in microseconds. + /** + * List of supported FrameDurations in microseconds. */ int[] frameDurationUs; diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecSpecificCapabilitiesLtv.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecSpecificCapabilitiesLtv.aidl index ceb90baf51..fa302e3918 100644 --- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecSpecificCapabilitiesLtv.aidl +++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecSpecificCapabilitiesLtv.aidl @@ -23,6 +23,9 @@ package android.hardware.bluetooth.audio; */ @VintfStability union CodecSpecificCapabilitiesLtv { + /** + * Supported sampling frequencies in Hertz + */ parcelable SupportedSamplingFrequencies { const int HZ8000 = 0x0001; const int HZ11025 = 0x0002; @@ -41,10 +44,13 @@ union CodecSpecificCapabilitiesLtv { /* 16 bits wide bit mask */ int bitmask; } + /** + * Supported frame durations in microseconds + */ parcelable SupportedFrameDurations { const int US7500 = 0x01; const int US10000 = 0x02; - // Bits 2-3 are RFU + /* Bits 2-3 are RFU */ const int US7500PREFERRED = 0x10; const int US10000PREFERRED = 0x20; @@ -65,8 +71,8 @@ union CodecSpecificCapabilitiesLtv { int bitmask; } parcelable SupportedOctetsPerCodecFrame { - int minimum; - int maximum; + int min; + int max; } parcelable SupportedMaxCodecFramesPerSDU { int value; diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/ConfigurationFlags.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/ConfigurationFlags.aidl index 57c8be5b00..a12af4958c 100644 --- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/ConfigurationFlags.aidl +++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/ConfigurationFlags.aidl @@ -22,33 +22,33 @@ package android.hardware.bluetooth.audio; @VintfStability parcelable ConfigurationFlags { const int NONE = 0x0000; - /* + /** * Set for the lossless configurations */ const int LOSSLESS = 0x0001; - /* + /** * Set for the low latency configurations */ const int LOW_LATENCY = 0x0002; - /* + /** * When set, asymmetric configuration for SINK and SOURCE can be used. * e.g. in GAMING mode stream for 32kHz and back channel for 16 kHz */ - const int ALLOW_ASYMMETRIC_CONFIGURATIONS = 0x0003; - /* + const int ALLOW_ASYMMETRIC_CONFIGURATIONS = 0x0004; + /** * Set for the spatial audio configurations */ - const int SPATIAL_AUDIO = 0x0004; - /* + const int SPATIAL_AUDIO = 0x0008; + /** * When set, BluetoothAudioProvider requests to receive ASE metadata. * In such case onSinkAseMetadataChanged() and onSourceAseMetadataChanged * will be called. */ - const int PROVIDE_ASE_METADATA = 0x0005; - /* + const int PROVIDE_ASE_METADATA = 0x0010; + /** * Set for mono microphone configurations */ - const int MONO_MIC_CONFIGURATION = 0x0006; + const int MONO_MIC_CONFIGURATION = 0x0020; int bitmask; } diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl index 8c6fe692b7..14244316d9 100644 --- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl +++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl @@ -135,15 +135,32 @@ interface IBluetoothAudioProvider { @nullable A2dpConfiguration getA2dpConfiguration( in List remoteA2dpCapabilities, in A2dpConfigurationHint hint); + /** + * Predefined values for the codec priority, used by `setCodecPriority()`. + * Besides these special values, the codec priority can be set to 1 for + * the highest possible priority, or to any other 4 bytes wide integer N, + * where N has the higher priority than N + 1. + */ + const int CODEC_PRIORITY_DISABLED = -1; + const int CODEC_PRIORITY_NONE = 0; + /** * Set specific codec priority * * It should be assumed that the external module will start with all its - * integrated codecs priority 0 by default. + * integrated codecs priority set to `CODEC_PRIORITY_NONE` by default. + * + * Note: If the BT stack sets a particular codec priority to + * CODEC_PRIORITY_DISABLED, the configuration provider shal not return + * a particular codec when asked for the configuration. Other priority + * levels and the prioritization mechanism details are not specified + * and the vendor can implement them as desired. * * @param codecId: codecId - * @param priority: 0 for no priority, -1 for codec disabled, - * from 1 to N, where 1 is highest. + * @param priority: `CODEC_PRIORITY_NONE` for no priority, + * `CODEC_PRIORITY_DISABLED` for the disabled codec, or priority + * level from 1 to N, where the priority of N + 1 is lower than N, + * and N equal to 1 is the highest possible codec priority. */ void setCodecPriority(in CodecId codecId, int priority); @@ -240,7 +257,8 @@ interface IBluetoothAudioProvider { IsoDataPathConfiguration isoDataPathConfiguration; } - /* All the LeAudioAseQosConfiguration parameters are defined by the + /** + * All the LeAudioAseQosConfiguration parameters are defined by the * Bluetooth Audio Stream Control Service specification v.1.0, Sec. 5: "ASE * Control Operations". */ @@ -330,11 +348,11 @@ interface IBluetoothAudioProvider { /** * Sink ASEs configuration */ - @nullable List sinkAseConfiguration; + @nullable AseDirectionConfiguration[] sinkAseConfiguration; /** * Source ASEs configuration */ - @nullable List sourceAseConfiguration; + @nullable AseDirectionConfiguration[] sourceAseConfiguration; /** * Additional flags, used for configurations with special features */ @@ -371,11 +389,11 @@ interface IBluetoothAudioProvider { /** * Sink ASEs configuration setting */ - @nullable List sinkAseRequirement; + @nullable AseDirectionRequirement[] sinkAseRequirement; /** * Source ASEs configuration setting */ - @nullable List sourceAseRequirement; + @nullable AseDirectionRequirement[] sourceAseRequirement; /** * Additional flags, used to request configurations with special * features @@ -395,25 +413,57 @@ interface IBluetoothAudioProvider { * BluetoothStack expects to get configuration list for SINK and SOURCE * on either _ENCODING or _DECODING session. * - * @param remoteSinkAudioCapabilities List of remote sink capabilities + * Note: When the requirements are not met, either for one or both + * directions, the corresponding returned AseDirectionConfiguration + * can be set to null. Otherwise it shall contain an ASE configuration + * array with the number of configurations equal to the number of ASEs + * which should be configured by the BT stack for this particular + * direction. + * The provider shall match all the requirements set by the Bluetooth + * stack or return a null configuration for the direction when these + * requirements are not met. In response, the BT Stack may decide to + * reduce the requirements to the minimum, which is the `audioContext` + * and the `LeAudioAseConfiguration.codecConfiguration` with the + * mandatory `CodecSpecificConfigurationLtv.SamplingFrequency` and + * `CodecSpecificConfigurationLtv.AudioChannelAllocation` fields set. + * When these minimum requirements are not met as well, the Bt stack + * may set either `sinkAseRequirement` or `sourceAseRequirement`, or + * both to null. In such case the provider has the freedom of + * providing a configuration for the null-ed direction requirements or + * not for the particular audio context. However returning neither of + * the direction configurations (both nulled) is considered as an + * invalid behavior. + * If the returned configurations are not complete (either + * `qosConfiguration` or `dataPathConfiguration` are null), the BT + * stack will ask for these dynamically during the stream + * establishment, using the corresponding + * `getLeAudioAseQosConfiguration()` and + * `getLeAudioAseDatapathConfiguration()` API calls. This behavior + * is not desired as it slows down the stream establishment, and + * should be implemented only if really needed (e.g. when the provider + * needs to monitor the remote device ASE states, using the + * `onSinkAseMetadataChanged()` and `onSourceAseMetadataChanged()` + * callbacks to derive the valid QoS and/or data path configuration). + * + * @param remoteSinkAudioCapabilities Array of remote sink capabilities * supported by an active group devices. - * @param remoteSourceAudioCapabilities List of remote source capabilities + * @param remoteSourceAudioCapabilities Array of remote source capabilities * supported by an active group devices. * @param requirements ASE configuration requirements * - * @return List + * @return LeAudioAseConfigurationSetting[] */ - List getLeAudioAseConfiguration( - in @nullable List remoteSinkAudioCapabilities, - in @nullable List remoteSourceAudioCapabilities, - in List requirements); + LeAudioAseConfigurationSetting[] getLeAudioAseConfiguration( + in @nullable LeAudioDeviceCapabilities[] remoteSinkAudioCapabilities, + in @nullable LeAudioDeviceCapabilities[] remoteSourceAudioCapabilities, + in LeAudioConfigurationRequirement[] requirements); @VintfStability parcelable LeAudioAseQosConfigurationRequirement { /** * Audio Contect Type that this requirements apply to */ - AudioContext contextType; + AudioContext audioContext; /** * QoS preferences received in Codec Configured ASE state. As defined in @@ -501,6 +551,18 @@ interface IBluetoothAudioProvider { * parameters are not within the boundaries received from the remote device * after configuring the ASEs. * + * Note: When the requirements are not met, either for one or both + * directions, the corresponding configurations in the returned + * LeAudioAseQosConfigurationPair can be set to null. The minimum + * requirement can have only the `audioContext` field set and just a + * single (either sink or source) AseQosDirectionRequirement, where + * only the preferred parameter fields are not specified. The + * configuration provider should always be able to satisfy such + * requirement for all the audio contexts specified by Bluetooth SIG. + * The Bluetooth stack can reduce the requirements to the minimum, + * when more precisely specified requirements are not met by the + * configuration provider. + * * @param qosRequirement ASE QoS configurations requirements * * @return LeAudioAseQosConfigurationPair @@ -527,7 +589,7 @@ interface IBluetoothAudioProvider { * This can serve as a hint for selecting the proper configuration by * the offloader. */ - AudioContext context; + AudioContext audioContext; /** * Stream configuration, including connection handles and audio channel * allocations. @@ -545,13 +607,25 @@ interface IBluetoothAudioProvider { * @param sinkConfig - remote sink device stream configuration * @param sourceConfig - remote source device stream configuration * + * Note: The provider shall provide a data path configuration for each + * of the non-null configurations passed to this function if these + * configurations are supported by the configuration provider. + * The Bluetooth stack can set either only sink or source + * configuration if it expects just a single direction data path + * configuration. Not providing a valid data path configuration for + * the stream configured with the codec parameters provided by the + * configuration provider will be considered an invalid behavior. + * The BT stack can pass asymmetric sink and source configurations + * if `ALLOW_ASYMMETRIC_CONFIGURATIONS` flag was set by the provider + * in the `CodecInfo` information for the particular codec. + * * @return LeAudioDataPathConfigurationPair */ LeAudioDataPathConfigurationPair getLeAudioAseDatapathConfiguration( in @nullable StreamConfig sinkConfig, in @nullable StreamConfig sourceConfig); - /* + /** * Audio Stream Endpoint state used to report Metadata changes on the remote * device audio endpoints. */ @@ -564,14 +638,32 @@ interface IBluetoothAudioProvider { } /** - * Used to report metadata changes to the provider. This allows for a - * pseudo communication channel between the remote device and the provider, - * using the vendor specific metadata of the changing ASE state. - * It is used only when ASE is using configurations marked with the - * `PROVIDE_ASE_METADATA` flag. + * Used to report sink endpoint metadata changes to the provider. This + * allows for a pseudo communication channel between the remote device and + * the provider, using the vendor specific metadata of the changing ASE + * state. It is used only when Audio Stream Endpoint (ASE) is using + * configurations marked with the `PROVIDE_ASE_METADATA` flag. + * + * @param state - current Audio Stream Endpoint state of the remote device + * @param cigId - Coordinate Isochronous Group identifier + * @param cisId - Coordinate Isochronous Stream identifier + * @param metadata - remote sink device metadata for the given ASE */ void onSinkAseMetadataChanged( in AseState state, int cigId, int cisId, in @nullable MetadataLtv[] metadata); + + /** + * Used to report source endpoint metadata changes to the provider. This + * allows for a pseudo communication channel between the remote device and + * the provider, using the vendor specific metadata of the changing ASE + * state. It is used only when Audio Stream Endpoint (ASE) is using + * configurations marked with the `PROVIDE_ASE_METADATA` flag. + * + * @param state - current Audio Stream Endpoint state of the remote device + * @param cigId - Coordinate Isochronous Group identifier + * @param cisId - Coordinate Isochronous Stream identifier + * @param metadata - remote source device metadata for the given ASE + */ void onSourceAseMetadataChanged( in AseState state, int cigId, int cisId, in @nullable MetadataLtv[] metadata); @@ -595,7 +687,7 @@ interface IBluetoothAudioProvider { * This can serve as a hint for selecting the proper configuration by * the offloader. */ - AudioContext context; + AudioContext audioContext; /** * Streaming Broadcast Audio Quality */ @@ -614,7 +706,7 @@ interface IBluetoothAudioProvider { */ @VintfStability parcelable LeAudioBroadcastConfigurationRequirement { - List subgroupConfigurationRequirements; + LeAudioBroadcastSubgroupConfigurationRequirement[] subgroupConfigurationRequirements; } /** @@ -635,11 +727,10 @@ interface IBluetoothAudioProvider { /** * Subgroup configuration with a list of BIS configurations - * */ @VintfStability parcelable LeAudioBroadcastSubgroupConfiguration { - List bisConfigurations; + LeAudioSubgroupBisConfiguration[] bisConfigurations; /** * Vendor specific codec configuration for all the BISes inside this @@ -659,7 +750,6 @@ interface IBluetoothAudioProvider { * LeAudioBroadcastConfigurationSetting is a result of * getLeAudioBroadcastConfiguration. It is used in HCI_LE_Create_BIG command * and for creating the Broadcast Announcements. - * */ @VintfStability parcelable LeAudioBroadcastConfigurationSetting { @@ -705,18 +795,23 @@ interface IBluetoothAudioProvider { @nullable LeAudioDataPathConfiguration dataPathConfiguration; /** - * A list of subgroup configurations in the broadcast. + * An array of subgroup configurations in the broadcast. */ - List subgroupsConfigurations; + LeAudioBroadcastSubgroupConfiguration[] subgroupsConfigurations; } /** * Get Broadcast configuration. Output of this function will be used * in HCI_LE_Create_BIG (0x0068) command and also to create BIG INFO * + * @param remoteSinkAudioCapabilities - remote device sink endpoint + * capabilities + * @param requirement - requested configuration requirements + * + * @return the whole broadcast audio stream configuration */ LeAudioBroadcastConfigurationSetting getLeAudioBroadcastConfiguration( - in @nullable List remoteSinkAudioCapabilities, + in @nullable LeAudioDeviceCapabilities[] remoteSinkAudioCapabilities, in LeAudioBroadcastConfigurationRequirement requirement); /** @@ -725,7 +820,12 @@ interface IBluetoothAudioProvider { * not provided in LeAudioBroadcastConfigurationSetting. Calling this during * the broadcast audio stream establishment might slightly delay the stream * start. + * + * @param audioContext - audio stream context for the given stream map + * @param streamMap - channel map with BIS configurations + * + * @return broadcast audio stream data path configuration */ LeAudioDataPathConfiguration getLeAudioBroadcastDatapathConfiguration( - in AudioContext context, in BroadcastStreamMap[] streamMap); + in AudioContext audioContext, in BroadcastStreamMap[] streamMap); } diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/MetadataLtv.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/MetadataLtv.aidl index b0befc15b9..afe76cebea 100644 --- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/MetadataLtv.aidl +++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/MetadataLtv.aidl @@ -30,8 +30,9 @@ union MetadataLtv { parcelable StreamingAudioContexts { AudioContext values; } - /* This is an opaque container for passing metadata between the provider and - * the remote device. It must not be interpreted by the BT stack. + /** + * This is an opaque container for passing metadata between the provider and + * the remote device. It shall not be inspected by the BT stack. */ parcelable VendorSpecific { int companyId; diff --git a/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.cpp b/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.cpp index cff3b2582c..a692d84f99 100644 --- a/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.cpp +++ b/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.cpp @@ -157,8 +157,11 @@ ndk::ScopedAStatus LeAudioOffloadAudioProvider::setCodecPriority( bool LeAudioOffloadAudioProvider::isMatchedValidCodec(CodecId cfg_codec, CodecId req_codec) { auto priority = codec_priority_map_.find(cfg_codec); - if (priority != codec_priority_map_.end() && priority->second == -1) + if (priority != codec_priority_map_.end() && + priority->second == + LeAudioOffloadAudioProvider::CODEC_PRIORITY_DISABLED) { return false; + } return cfg_codec == req_codec; } @@ -222,8 +225,8 @@ bool LeAudioOffloadAudioProvider::isMatchedOctetsPerCodecFrame( CodecSpecificConfigurationLtv::OctetsPerCodecFrame& cfg_octets, CodecSpecificCapabilitiesLtv::SupportedOctetsPerCodecFrame& capability_octets) { - return cfg_octets.value >= capability_octets.minimum && - cfg_octets.value <= capability_octets.maximum; + return cfg_octets.value >= capability_octets.min && + cfg_octets.value <= capability_octets.max; } bool LeAudioOffloadAudioProvider::isCapabilitiesMatchedCodecConfiguration( @@ -568,7 +571,7 @@ ndk::ScopedAStatus LeAudioOffloadAudioProvider::getLeAudioAseQosConfiguration( for (auto& setting : ase_configuration_settings) { // Context matching - if (setting.audioContext != in_qosRequirement.contextType) continue; + if (setting.audioContext != in_qosRequirement.audioContext) continue; // Match configuration flags // Currently configuration flags are not populated, ignore. diff --git a/bluetooth/audio/aidl/vts/VtsHalBluetoothAudioTargetTest.cpp b/bluetooth/audio/aidl/vts/VtsHalBluetoothAudioTargetTest.cpp index 85bc48ad8d..7b98634621 100644 --- a/bluetooth/audio/aidl/vts/VtsHalBluetoothAudioTargetTest.cpp +++ b/bluetooth/audio/aidl/vts/VtsHalBluetoothAudioTargetTest.cpp @@ -2302,8 +2302,8 @@ class BluetoothAudioProviderLeAudioOutputHardwareAidl frame_duration.bitmask = CodecSpecificCapabilitiesLtv::SupportedFrameDurations::US7500; auto octets = CodecSpecificCapabilitiesLtv::SupportedOctetsPerCodecFrame(); - octets.minimum = 0; - octets.maximum = 60; + octets.min = 0; + octets.max = 60; auto frames = CodecSpecificCapabilitiesLtv::SupportedMaxCodecFramesPerSDU(); frames.value = 2; capability.codecSpecificCapabilities = {sampling_rate, frame_duration, @@ -2567,7 +2567,7 @@ TEST_P(BluetoothAudioProviderLeAudioOutputHardwareAidl, GetQoSConfiguration) { std::vector QoSConfigurations; for (auto bitmask : all_context_bitmasks) { - requirement.contextType = GetAudioContext(bitmask); + requirement.audioContext = GetAudioContext(bitmask); IBluetoothAudioProvider::LeAudioAseQosConfigurationPair result; auto aidl_retval = audio_provider_->getLeAudioAseQosConfiguration(requirement, &result); @@ -2590,8 +2590,8 @@ TEST_P(BluetoothAudioProviderLeAudioOutputHardwareAidl, bool is_supported = false; for (auto bitmask : all_context_bitmasks) { - sink_requirement.context = GetAudioContext(bitmask); - source_requirement.context = GetAudioContext(bitmask); + sink_requirement.audioContext = GetAudioContext(bitmask); + source_requirement.audioContext = GetAudioContext(bitmask); IBluetoothAudioProvider::LeAudioDataPathConfigurationPair result; auto aidl_retval = audio_provider_->getLeAudioAseDatapathConfiguration( sink_requirement, source_requirement, &result);