Merge "Report broacast audio config to HAL" into main am: 9534a2dc4c am: a2dbddc48b

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

Change-Id: Ieae124a10eaa30613f07ae0b7b0b9c005601c5cf
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Silen Sun 2024-05-24 01:51:27 +00:00 committed by Automerger Merge Worker
commit 0cd67924b5

View file

@ -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<std::recursive_mutex> 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<AudioConfiguration>(audio_config);