From 6f765ce3e3d53e42ac50e18f326b2cdcdd41c021 Mon Sep 17 00:00:00 2001 From: Alice Kuo Date: Fri, 10 Dec 2021 13:30:24 +0800 Subject: [PATCH] Clean up: remove LE audio hardware offload in Bluetooth audio HAL 2.1 LE audio offload plan to fully support on aidl or temporal HAL 2.2. Remove it in HAL 2.1 to make the compatible work easier Bug: 197296692 Bug: 150670922 Test: HAL 2.1/2.2 work for A2DP software/hardware media, and LE audio software media/voip call Change-Id: Icc68bea357d2ee0427826e0c20888399662e9bcb --- .../BluetoothAudioSessionControl_2_1.h | 2 +- .../session/BluetoothAudioSession_2_1.cpp | 23 ++----------------- .../utils/session/BluetoothAudioSession_2_1.h | 4 ---- 3 files changed, 3 insertions(+), 26 deletions(-) diff --git a/bluetooth/audio/utils/session/BluetoothAudioSessionControl_2_1.h b/bluetooth/audio/utils/session/BluetoothAudioSessionControl_2_1.h index 95f740850f..4d7be21d7a 100644 --- a/bluetooth/audio/utils/session/BluetoothAudioSessionControl_2_1.h +++ b/bluetooth/audio/utils/session/BluetoothAudioSessionControl_2_1.h @@ -35,7 +35,7 @@ class BluetoothAudioSessionControl_2_1 { std::shared_ptr session_ptr = BluetoothAudioSessionInstance_2_1::GetSessionInstance(session_type); if (session_ptr != nullptr) { - return session_ptr->IsSessionReady(); + return session_ptr->GetAudioSession()->IsSessionReady(); } return false; } diff --git a/bluetooth/audio/utils/session/BluetoothAudioSession_2_1.cpp b/bluetooth/audio/utils/session/BluetoothAudioSession_2_1.cpp index c250ef1f16..646e22532f 100644 --- a/bluetooth/audio/utils/session/BluetoothAudioSession_2_1.cpp +++ b/bluetooth/audio/utils/session/BluetoothAudioSession_2_1.cpp @@ -60,16 +60,6 @@ BluetoothAudioSession_2_1::BluetoothAudioSession_2_1( } } -bool BluetoothAudioSession_2_1::IsSessionReady() { - if (session_type_2_1_ != - SessionType_2_1::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH) { - return audio_session->IsSessionReady(); - } - - std::lock_guard guard(audio_session->mutex_); - return audio_session->stack_iface_ != nullptr; -} - std::shared_ptr BluetoothAudioSession_2_1::GetAudioSession() { return audio_session; @@ -80,7 +70,7 @@ BluetoothAudioSession_2_1::GetAudioSession() { const ::android::hardware::bluetooth::audio::V2_1::AudioConfiguration BluetoothAudioSession_2_1::GetAudioConfig() { std::lock_guard guard(audio_session->mutex_); - if (IsSessionReady()) { + if (audio_session->IsSessionReady()) { // If session is unknown it means it should be 2.0 type if (session_type_2_1_ != SessionType_2_1::UNKNOWN) return audio_config_2_1_; @@ -122,9 +112,6 @@ bool BluetoothAudioSession_2_1::UpdateAudioConfig( SessionType_2_1::LE_AUDIO_SOFTWARE_DECODED_DATAPATH); bool is_offload_a2dp_session = (session_type_2_1_ == SessionType_2_1::A2DP_HARDWARE_OFFLOAD_DATAPATH); - bool is_offload_le_audio_session = - (session_type_2_1_ == SessionType_2_1::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH || - session_type_2_1_ == SessionType_2_1::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH); auto audio_config_discriminator = audio_config.getDiscriminator(); bool is_software_audio_config = (is_software_session && @@ -136,13 +123,7 @@ bool BluetoothAudioSession_2_1::UpdateAudioConfig( audio_config_discriminator == ::android::hardware::bluetooth::audio::V2_1::AudioConfiguration:: hidl_discriminator::codecConfig); - bool is_le_audio_offload_audio_config = - (is_offload_le_audio_session && - audio_config_discriminator == - ::android::hardware::bluetooth::audio::V2_1::AudioConfiguration:: - hidl_discriminator::leAudioCodecConfig); - if (!is_software_audio_config && !is_a2dp_offload_audio_config && - !is_le_audio_offload_audio_config) { + if (!is_software_audio_config && !is_a2dp_offload_audio_config) { return false; } audio_config_2_1_ = audio_config; diff --git a/bluetooth/audio/utils/session/BluetoothAudioSession_2_1.h b/bluetooth/audio/utils/session/BluetoothAudioSession_2_1.h index db82c733f4..5a351531a3 100644 --- a/bluetooth/audio/utils/session/BluetoothAudioSession_2_1.h +++ b/bluetooth/audio/utils/session/BluetoothAudioSession_2_1.h @@ -50,10 +50,6 @@ class BluetoothAudioSession_2_1 { const ::android::hardware::bluetooth::audio::V2_1::SessionType& session_type); - // The function helps to check if this session is ready or not - // @return: true if the Bluetooth stack has started the specified session - bool IsSessionReady(); - std::shared_ptr GetAudioSession(); // The report function is used to report that the Bluetooth stack has started