diff --git a/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp b/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp index 67ba93cdd7..d0f2a26e68 100644 --- a/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp +++ b/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp @@ -121,18 +121,41 @@ const AudioConfiguration BluetoothAudioSession::GetAudioConfig() { void BluetoothAudioSession::ReportAudioConfigChanged( const AudioConfiguration& audio_config) { - if (session_type_ != - SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH && - session_type_ != - SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH) { - return; - } - std::lock_guard guard(mutex_); - if (audio_config.getTag() != AudioConfiguration::leAudioConfig) { - LOG(ERROR) << __func__ << " invalid audio config type for SessionType =" - << toString(session_type_); - return; + if (com::android::btaudio::hal::flags::leaudio_report_broadcast_ac_to_hal()) { + if (session_type_ == + SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH || + session_type_ == + SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH) { + if (audio_config.getTag() != AudioConfiguration::leAudioConfig) { + LOG(ERROR) << __func__ << " invalid audio config type for SessionType =" + << toString(session_type_); + return; + } + } else if (session_type_ == + SessionType::LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH) { + if (audio_config.getTag() != AudioConfiguration::leAudioBroadcastConfig) { + LOG(ERROR) << __func__ << " invalid audio config type for SessionType =" + << toString(session_type_); + return; + } + } else { + LOG(ERROR) << __func__ << " invalid SessionType =" + << toString(session_type_); + return; + } + } else { + if (session_type_ != + SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH && + session_type_ != + SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH) { + return; + } + if (audio_config.getTag() != AudioConfiguration::leAudioConfig) { + LOG(ERROR) << __func__ << " invalid audio config type for SessionType =" + << toString(session_type_); + return; + } } audio_config_ = std::make_unique(audio_config);