diff --git a/bluetooth/audio/aidl/default/A2dpOffloadAudioProvider.cpp b/bluetooth/audio/aidl/default/A2dpOffloadAudioProvider.cpp index c7761c5e76..1eb6a6d610 100644 --- a/bluetooth/audio/aidl/default/A2dpOffloadAudioProvider.cpp +++ b/bluetooth/audio/aidl/default/A2dpOffloadAudioProvider.cpp @@ -120,6 +120,12 @@ ndk::ScopedAStatus A2dpOffloadAudioProvider::onSessionReady( ndk::ScopedAStatus A2dpOffloadAudioProvider::parseA2dpConfiguration( const CodecId& codec_id, const std::vector& configuration, CodecParameters* codec_parameters, A2dpStatus* _aidl_return) { + if (!kEnableA2dpCodecExtensibility) { + // parseA2dpConfiguration must not be implemented if A2dp codec + // extensibility is not supported. + return ndk::ScopedAStatus::fromStatus(STATUS_UNKNOWN_TRANSACTION); + } + auto codec = codec_factory_.GetCodec(codec_id); if (!codec) { LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_) @@ -136,6 +142,12 @@ ndk::ScopedAStatus A2dpOffloadAudioProvider::getA2dpConfiguration( const std::vector& remote_a2dp_capabilities, const A2dpConfigurationHint& hint, std::optional* _aidl_return) { + if (!kEnableA2dpCodecExtensibility) { + // getA2dpConfiguration must not be implemented if A2dp codec + // extensibility is not supported. + return ndk::ScopedAStatus::fromStatus(STATUS_UNKNOWN_TRANSACTION); + } + *_aidl_return = std::nullopt; A2dpConfiguration avdtp_configuration; diff --git a/bluetooth/audio/aidl/default/BluetoothAudioProvider.h b/bluetooth/audio/aidl/default/BluetoothAudioProvider.h index 2c21440ab2..866eaebad6 100644 --- a/bluetooth/audio/aidl/default/BluetoothAudioProvider.h +++ b/bluetooth/audio/aidl/default/BluetoothAudioProvider.h @@ -35,6 +35,23 @@ namespace hardware { namespace bluetooth { namespace audio { +/// Enable flag for the reference implementation for A2dp Codec +/// Extensibility. +/// +/// A2dp Codec extensibility cannot be enabled until the following +/// requirements are fulfilled. +/// +/// 1. The Bluetooth controller must support the HCI Requirements +/// v1.04 or later, and must support the vendor HCI command +/// A2DP Offload Start (v2), A2DP Offload Stop (v2) as indicated +/// by the field a2dp_offload_v2 of the vendor capabilities. +/// +/// 2. The implementation of the provider must be completed with +/// DSP configuration for streaming. +enum : bool { + kEnableA2dpCodecExtensibility = false, +}; + class BluetoothAudioProvider : public BnBluetoothAudioProvider { public: BluetoothAudioProvider(); diff --git a/bluetooth/audio/aidl/default/BluetoothAudioProviderFactory.cpp b/bluetooth/audio/aidl/default/BluetoothAudioProviderFactory.cpp index c7c6e6d6fc..584640b232 100644 --- a/bluetooth/audio/aidl/default/BluetoothAudioProviderFactory.cpp +++ b/bluetooth/audio/aidl/default/BluetoothAudioProviderFactory.cpp @@ -159,6 +159,12 @@ ndk::ScopedAStatus BluetoothAudioProviderFactory::getProviderInfo( if (session_type == SessionType::A2DP_HARDWARE_OFFLOAD_ENCODING_DATAPATH || session_type == SessionType::A2DP_HARDWARE_OFFLOAD_DECODING_DATAPATH) { + if (!kEnableA2dpCodecExtensibility) { + // Implementing getProviderInfo equates supporting + // A2dp codec extensibility. + return ndk::ScopedAStatus::fromStatus(STATUS_UNKNOWN_TRANSACTION); + } + auto& provider_info = _aidl_return->emplace(); provider_info.name = a2dp_offload_codec_factory_.name;