Loading system/bta/le_audio/client.cc +6 −1 Original line number Diff line number Diff line Loading @@ -1160,6 +1160,8 @@ class LeAudioClientImpl : public LeAudioClient { log::assert_that(true, "Both configs are invalid"); } L2CA_SetEcosystemBaseInterval(frame_duration_us / 1250); audio_framework_source_config.data_interval_us = frame_duration_us; le_audio_source_hal_client_->Start(audio_framework_source_config, audioSinkReceiver, dsa_modes); Loading Loading @@ -3838,7 +3840,10 @@ class LeAudioClientImpl : public LeAudioClient { CleanCachedMicrophoneData(); } void StopAudio(void) { SuspendAudio(); } void StopAudio(void) { SuspendAudio(); L2CA_SetEcosystemBaseInterval(0 /* clear recommendation */); } void printCurrentStreamConfiguration(int fd) { std::stringstream stream; Loading system/stack/fuzzers/l2cap_fuzzer.cc +2 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ #include <vector> #include "btif/include/stack_manager_t.h" #include "common/message_loop_thread.h" #include "hal/snoop_logger.h" #include "hci/controller_interface_mock.h" #include "osi/include/allocator.h" Loading Loading @@ -66,6 +67,7 @@ bt_status_t do_in_main_thread_delayed(base::Location const&, // any test cases abort(); } bluetooth::common::MessageLoopThread* get_main_thread() { return nullptr; } namespace bluetooth { namespace os { Loading system/stack/include/l2c_api.h +2 −0 Original line number Diff line number Diff line Loading @@ -887,6 +887,8 @@ void L2CA_AdjustConnectionIntervals(uint16_t* min_interval, uint16_t* max_interval, uint16_t floor_interval); void L2CA_SetEcosystemBaseInterval(uint32_t base_interval); /** * Check whether an ACL or LE link to the remote device is established */ Loading system/stack/l2cap/l2c_ble.cc +27 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ #include <base/strings/stringprintf.h> #include <bluetooth/log.h> #include <com_android_bluetooth_flags.h> #ifdef __ANDROID__ #include <android/sysprop/BluetoothProperties.sysprop.h> Loading @@ -34,6 +35,7 @@ #include "btif/include/core_callbacks.h" #include "btif/include/stack_manager_t.h" #include "hci/controller_interface.h" #include "hci/hci_layer.h" #include "internal_include/bt_target.h" #include "main/shim/entry.h" #include "osi/include/allocator.h" Loading @@ -50,6 +52,7 @@ #include "stack/include/l2c_api.h" #include "stack/include/l2cap_acl_interface.h" #include "stack/include/l2cdefs.h" #include "stack/include/main_thread.h" #include "stack/l2cap/l2c_int.h" #include "types/raw_address.h" Loading Loading @@ -1419,3 +1422,27 @@ void L2CA_AdjustConnectionIntervals(uint16_t* min_interval, *max_interval = phone_min_interval; } } void L2CA_SetEcosystemBaseInterval(uint32_t base_interval) { if (!com::android::bluetooth::flags::le_audio_base_ecosystem_interval()) { return; } log::info("base_interval: {}ms", base_interval); bluetooth::shim::GetHciLayer()->EnqueueCommand( bluetooth::hci::SetEcosystemBaseIntervalBuilder::Create(base_interval), get_main_thread()->BindOnce([](bluetooth::hci::CommandCompleteView view) { ASSERT(view.IsValid()); auto status_view = bluetooth::hci::SetEcosystemBaseIntervalCompleteView::Create( bluetooth::hci::SetEcosystemBaseIntervalCompleteView::Create( view)); ASSERT(status_view.IsValid()); if (status_view.GetStatus() != bluetooth::hci::ErrorCode::SUCCESS) { log::warn("Set Ecosystem Base Interval status {}", ErrorCodeText(status_view.GetStatus())); return; } })); } system/test/mock/mock_stack_l2cap_ble.cc +5 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,7 @@ struct l2cble_send_peer_disc_req l2cble_send_peer_disc_req; struct l2cble_sec_comp l2cble_sec_comp; struct l2ble_sec_access_req l2ble_sec_access_req; struct L2CA_AdjustConnectionIntervals L2CA_AdjustConnectionIntervals; struct L2CA_SetEcosystemBaseInterval L2CA_SetEcosystemBaseInterval; struct l2cble_use_preferred_conn_params l2cble_use_preferred_conn_params; struct L2CA_SubrateRequest L2CA_SubrateRequest; struct l2cble_process_subrate_change_evt l2cble_process_subrate_change_evt; Loading Loading @@ -180,6 +181,10 @@ void L2CA_AdjustConnectionIntervals(uint16_t* min_interval, test::mock::stack_l2cap_ble::L2CA_AdjustConnectionIntervals( min_interval, max_interval, floor_interval); } void L2CA_SetEcosystemBaseInterval(uint32_t base_interval) { inc_func_call_count(__func__); test::mock::stack_l2cap_ble::L2CA_SetEcosystemBaseInterval(base_interval); } void l2cble_use_preferred_conn_params(const RawAddress& bda) { inc_func_call_count(__func__); test::mock::stack_l2cap_ble::l2cble_use_preferred_conn_params(bda); Loading Loading
system/bta/le_audio/client.cc +6 −1 Original line number Diff line number Diff line Loading @@ -1160,6 +1160,8 @@ class LeAudioClientImpl : public LeAudioClient { log::assert_that(true, "Both configs are invalid"); } L2CA_SetEcosystemBaseInterval(frame_duration_us / 1250); audio_framework_source_config.data_interval_us = frame_duration_us; le_audio_source_hal_client_->Start(audio_framework_source_config, audioSinkReceiver, dsa_modes); Loading Loading @@ -3838,7 +3840,10 @@ class LeAudioClientImpl : public LeAudioClient { CleanCachedMicrophoneData(); } void StopAudio(void) { SuspendAudio(); } void StopAudio(void) { SuspendAudio(); L2CA_SetEcosystemBaseInterval(0 /* clear recommendation */); } void printCurrentStreamConfiguration(int fd) { std::stringstream stream; Loading
system/stack/fuzzers/l2cap_fuzzer.cc +2 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ #include <vector> #include "btif/include/stack_manager_t.h" #include "common/message_loop_thread.h" #include "hal/snoop_logger.h" #include "hci/controller_interface_mock.h" #include "osi/include/allocator.h" Loading Loading @@ -66,6 +67,7 @@ bt_status_t do_in_main_thread_delayed(base::Location const&, // any test cases abort(); } bluetooth::common::MessageLoopThread* get_main_thread() { return nullptr; } namespace bluetooth { namespace os { Loading
system/stack/include/l2c_api.h +2 −0 Original line number Diff line number Diff line Loading @@ -887,6 +887,8 @@ void L2CA_AdjustConnectionIntervals(uint16_t* min_interval, uint16_t* max_interval, uint16_t floor_interval); void L2CA_SetEcosystemBaseInterval(uint32_t base_interval); /** * Check whether an ACL or LE link to the remote device is established */ Loading
system/stack/l2cap/l2c_ble.cc +27 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ #include <base/strings/stringprintf.h> #include <bluetooth/log.h> #include <com_android_bluetooth_flags.h> #ifdef __ANDROID__ #include <android/sysprop/BluetoothProperties.sysprop.h> Loading @@ -34,6 +35,7 @@ #include "btif/include/core_callbacks.h" #include "btif/include/stack_manager_t.h" #include "hci/controller_interface.h" #include "hci/hci_layer.h" #include "internal_include/bt_target.h" #include "main/shim/entry.h" #include "osi/include/allocator.h" Loading @@ -50,6 +52,7 @@ #include "stack/include/l2c_api.h" #include "stack/include/l2cap_acl_interface.h" #include "stack/include/l2cdefs.h" #include "stack/include/main_thread.h" #include "stack/l2cap/l2c_int.h" #include "types/raw_address.h" Loading Loading @@ -1419,3 +1422,27 @@ void L2CA_AdjustConnectionIntervals(uint16_t* min_interval, *max_interval = phone_min_interval; } } void L2CA_SetEcosystemBaseInterval(uint32_t base_interval) { if (!com::android::bluetooth::flags::le_audio_base_ecosystem_interval()) { return; } log::info("base_interval: {}ms", base_interval); bluetooth::shim::GetHciLayer()->EnqueueCommand( bluetooth::hci::SetEcosystemBaseIntervalBuilder::Create(base_interval), get_main_thread()->BindOnce([](bluetooth::hci::CommandCompleteView view) { ASSERT(view.IsValid()); auto status_view = bluetooth::hci::SetEcosystemBaseIntervalCompleteView::Create( bluetooth::hci::SetEcosystemBaseIntervalCompleteView::Create( view)); ASSERT(status_view.IsValid()); if (status_view.GetStatus() != bluetooth::hci::ErrorCode::SUCCESS) { log::warn("Set Ecosystem Base Interval status {}", ErrorCodeText(status_view.GetStatus())); return; } })); }
system/test/mock/mock_stack_l2cap_ble.cc +5 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,7 @@ struct l2cble_send_peer_disc_req l2cble_send_peer_disc_req; struct l2cble_sec_comp l2cble_sec_comp; struct l2ble_sec_access_req l2ble_sec_access_req; struct L2CA_AdjustConnectionIntervals L2CA_AdjustConnectionIntervals; struct L2CA_SetEcosystemBaseInterval L2CA_SetEcosystemBaseInterval; struct l2cble_use_preferred_conn_params l2cble_use_preferred_conn_params; struct L2CA_SubrateRequest L2CA_SubrateRequest; struct l2cble_process_subrate_change_evt l2cble_process_subrate_change_evt; Loading Loading @@ -180,6 +181,10 @@ void L2CA_AdjustConnectionIntervals(uint16_t* min_interval, test::mock::stack_l2cap_ble::L2CA_AdjustConnectionIntervals( min_interval, max_interval, floor_interval); } void L2CA_SetEcosystemBaseInterval(uint32_t base_interval) { inc_func_call_count(__func__); test::mock::stack_l2cap_ble::L2CA_SetEcosystemBaseInterval(base_interval); } void l2cble_use_preferred_conn_params(const RawAddress& bda) { inc_func_call_count(__func__); test::mock::stack_l2cap_ble::l2cble_use_preferred_conn_params(bda); Loading