diff options
36 files changed, 130 insertions, 328 deletions
diff --git a/system/main/shim/le_scanning_manager.cc b/system/main/shim/le_scanning_manager.cc index 8214dea25c..cb2d3cdd84 100644 --- a/system/main/shim/le_scanning_manager.cc +++ b/system/main/shim/le_scanning_manager.cc @@ -24,6 +24,7 @@ #include <hardware/bluetooth.h> #include "btif/include/btif_common.h" +#include "btif/include/btif_dm.h" #include "hci/address.h" #include "hci/le_scanning_manager.h" #include "hci/msft.h" @@ -35,6 +36,7 @@ #include "main/shim/shim.h" #include "stack/btm/btm_int_types.h" #include "stack/include/advertise_data_parser.h" +#include "stack/include/ble_hci_link_interface.h" #include "stack/include/bt_dev_class.h" #include "stack/include/btm_log_history.h" #include "stack/include/btm_status.h" @@ -111,20 +113,6 @@ private: static_cast<::ScanningCallbacks*>(&default_scanning_callback_); extern ::ScanningCallbacks* bluetooth::shim::default_scanning_callback; -void btm_ble_process_adv_pkt_cont_for_inquiry(uint16_t event_type, tBLE_ADDR_TYPE address_type, - const RawAddress& raw_address, uint8_t primary_phy, - uint8_t secondary_phy, uint8_t advertising_sid, - int8_t tx_power, int8_t rssi, - uint16_t periodic_adv_int, - std::vector<uint8_t> advertising_data); - -extern void btif_update_remote_properties(const RawAddress& bd_addr, BD_NAME bd_name, - DEV_CLASS dev_class, tBT_DEVICE_TYPE dev_type); - -void btm_ble_process_adv_addr(RawAddress& raw_address, tBLE_ADDR_TYPE* address_type); - -extern DEV_CLASS btm_ble_get_appearance_as_cod(std::vector<uint8_t> const& data); - using bluetooth::shim::BleScannerInterfaceImpl; void BleScannerInterfaceImpl::Init() { diff --git a/system/stack/acl/ble_acl.cc b/system/stack/acl/ble_acl.cc index 0aeb9ceb91..ab439987ed 100644 --- a/system/stack/acl/ble_acl.cc +++ b/system/stack/acl/ble_acl.cc @@ -38,8 +38,6 @@ using namespace bluetooth; extern tBTM_CB btm_cb; -void btm_ble_increment_link_topology_mask(uint8_t link_role); - static bool acl_ble_common_connection(const tBLE_BD_ADDR& address_with_type, uint16_t handle, tHCI_ROLE role, bool is_in_security_db, uint16_t conn_interval, uint16_t conn_latency, diff --git a/system/stack/acl/btm_acl.cc b/system/stack/acl/btm_acl.cc index 16911e9cc5..2a55ee393d 100644 --- a/system/stack/acl/btm_acl.cc +++ b/system/stack/acl/btm_acl.cc @@ -61,6 +61,7 @@ #include "stack/btm/btm_int_types.h" #include "stack/btm/btm_sco.h" #include "stack/btm/btm_sec.h" +#include "stack/btm/internal/btm_api.h" #include "stack/btm/security_device_record.h" #include "stack/include/acl_api.h" #include "stack/include/acl_api_types.h" @@ -69,6 +70,7 @@ #include "stack/include/bt_types.h" #include "stack/include/btm_ble_api.h" #include "stack/include/btm_client_interface.h" +#include "stack/include/btm_iot_config.h" #include "stack/include/btm_iso_api.h" #include "stack/include/btm_status.h" #include "stack/include/hci_error_code.h" @@ -92,14 +94,7 @@ using namespace bluetooth; using bluetooth::legacy::hci::GetInterface; -void BTM_update_version_info(const RawAddress& bd_addr, - const remote_version_info& remote_version_info); - -void BTM_db_reset(void); - extern tBTM_CB btm_cb; -void btm_iot_save_remote_properties(tACL_CONN* p_acl_cb); -void btm_iot_save_remote_versions(tACL_CONN* p_acl_cb); struct StackAclBtmAcl { tACL_CONN* acl_allocate_connection(); @@ -157,8 +152,8 @@ static void btm_read_failed_contact_counter_timeout(void* data); static void btm_read_remote_ext_features(uint16_t handle, uint8_t page_number); static void btm_read_rssi_timeout(void* data); static void btm_read_tx_power_timeout(void* data); +static void btm_set_link_policy(tACL_CONN* conn, tLINK_POLICY policy); static void check_link_policy(tLINK_POLICY* settings); -void btm_set_link_policy(tACL_CONN* conn, tLINK_POLICY policy); namespace { void NotifyAclLinkUp(tACL_CONN& p_acl) { @@ -669,7 +664,7 @@ static void check_link_policy(tLINK_POLICY* settings) { } } -void btm_set_link_policy(tACL_CONN* conn, tLINK_POLICY policy) { +static void btm_set_link_policy(tACL_CONN* conn, tLINK_POLICY policy) { conn->link_policy = policy; check_link_policy(&conn->link_policy); if ((conn->link_policy & HCI_ENABLE_CENTRAL_PERIPHERAL_SWITCH) && diff --git a/system/stack/btm/btm_ble.cc b/system/stack/btm/btm_ble.cc index e71dfe67fa..b612b684b3 100644 --- a/system/stack/btm/btm_ble.cc +++ b/system/stack/btm/btm_ble.cc @@ -35,6 +35,7 @@ #include "stack/btm/btm_int_types.h" #include "stack/gatt/gatt_int.h" #include "stack/include/acl_api.h" +#include "stack/include/ble_hci_link_interface.h" #include "stack/include/bt_types.h" #include "stack/include/btm_ble_api.h" #include "stack/include/btm_client_interface.h" @@ -42,9 +43,6 @@ #include "stack/include/gatt_api.h" #include "stack/include/hcimsgs.h" -// TODO(b/369381361) Enfore -Wmissing-prototypes -#pragma GCC diagnostic ignored "-Wmissing-prototypes" - using namespace bluetooth; extern tBTM_CB btm_cb; @@ -136,8 +134,8 @@ bool BTM_UseLeLink(const RawAddress& bd_addr) { return dev_type == BT_DEVICE_TYPE_BLE; } -void read_phy_cb(base::Callback<void(uint8_t tx_phy, uint8_t rx_phy, uint8_t status)> cb, - uint8_t* data, uint16_t len) { +static void read_phy_cb(base::Callback<void(uint8_t tx_phy, uint8_t rx_phy, uint8_t status)> cb, + uint8_t* data, uint16_t len) { uint8_t status, tx_phy, rx_phy; uint16_t handle; @@ -188,8 +186,6 @@ void BTM_BleReadPhy(const RawAddress& bd_addr, base::Bind(&read_phy_cb, std::move(cb))); } -void doNothing(uint8_t* /* data */, uint16_t /* len */) {} - void BTM_BleSetPhy(const RawAddress& bd_addr, uint8_t tx_phys, uint8_t rx_phys, uint16_t phy_options) { if (!get_btm_client_interface().peer.BTM_IsAclConnectionUp(bd_addr, BT_TRANSPORT_LE)) { @@ -233,5 +229,6 @@ void BTM_BleSetPhy(const RawAddress& bd_addr, uint8_t tx_phys, uint8_t rx_phys, UINT8_TO_STREAM(pp, tx_phys); UINT8_TO_STREAM(pp, rx_phys); UINT16_TO_STREAM(pp, phy_options); - btu_hcif_send_cmd_with_cb(FROM_HERE, HCI_BLE_SET_PHY, data, len, base::Bind(doNothing)); + btu_hcif_send_cmd_with_cb(FROM_HERE, HCI_BLE_SET_PHY, data, len, + base::Bind([](uint8_t*, uint16_t) {})); } diff --git a/system/stack/btm/btm_ble_gap.cc b/system/stack/btm/btm_ble_gap.cc index 6e16d43c17..808c9491d1 100644 --- a/system/stack/btm/btm_ble_gap.cc +++ b/system/stack/btm/btm_ble_gap.cc @@ -71,15 +71,10 @@ #include "types/ble_address_with_type.h" #include "types/raw_address.h" -// TODO(b/369381361) Enfore -Wmissing-prototypes -#pragma GCC diagnostic ignored "-Wmissing-prototypes" - using namespace bluetooth; extern tBTM_CB btm_cb; -void btm_ble_adv_filter_init(void); - #define BTM_EXT_BLE_RMT_NAME_TIMEOUT_MS (30 * 1000) #define MIN_ADV_LENGTH 2 #define BTM_VSC_CHIP_CAPABILITY_RSP_LEN 9 @@ -197,7 +192,7 @@ AdvertisingCache cache; } // namespace -bool ble_vnd_is_included() { +static bool ble_vnd_is_included() { // replace build time config BLE_VND_INCLUDED with runtime return android::sysprop::bluetooth::Ble::vnd_included().value_or(true); } @@ -278,11 +273,6 @@ static void btm_ble_start_sync_timeout(void* data); * Local functions ******************************************************************************/ static void btm_ble_update_adv_flag(uint8_t flag); -void btm_ble_process_adv_pkt_cont(uint16_t evt_type, tBLE_ADDR_TYPE addr_type, - const RawAddress& bda, uint8_t primary_phy, uint8_t secondary_phy, - uint8_t advertising_sid, int8_t tx_power, int8_t rssi, - uint16_t periodic_adv_int, uint8_t data_len, const uint8_t* data, - const RawAddress& original_bda); static uint8_t btm_set_conn_mode_adv_init_addr(RawAddress& p_peer_addr_ptr, tBLE_ADDR_TYPE* p_peer_addr_type, tBLE_ADDR_TYPE* p_own_addr_type); @@ -488,7 +478,7 @@ void BTM_BleTargetAnnouncementObserve(bool enable, tBTM_INQ_RESULTS_CB* p_result } } -std::pair<uint16_t /* interval */, uint16_t /* window */> get_low_latency_scan_params() { +static std::pair<uint16_t /* interval */, uint16_t /* window */> get_low_latency_scan_params() { uint16_t scan_interval = osi_property_get_int32(kPropertyInquiryScanInterval, BTM_BLE_LOW_LATENCY_SCAN_INT); uint16_t scan_window = @@ -862,7 +852,8 @@ static void sync_queue_cleanup(remove_sync_node_t* p_param) { } } -void btm_ble_start_sync_request(uint8_t sid, RawAddress addr, uint16_t skip, uint16_t timeout) { +static void btm_ble_start_sync_request(uint8_t sid, RawAddress addr, uint16_t skip, + uint16_t timeout) { tBLE_ADDR_TYPE address_type = BLE_ADDR_RANDOM; tINQ_DB_ENT* p_i = btm_inq_db_find(addr); if (p_i) { @@ -1235,8 +1226,8 @@ static void btm_ble_select_adv_interval(uint8_t evt_type, uint16_t* p_adv_int_mi * Returns void * ******************************************************************************/ -void btm_ble_update_dmt_flag_bits(uint8_t* adv_flag_value, const uint16_t connect_mode, - const uint16_t disc_mode) { +static void btm_ble_update_dmt_flag_bits(uint8_t* adv_flag_value, const uint16_t connect_mode, + const uint16_t disc_mode) { /* BR/EDR non-discoverable , non-connectable */ if ((disc_mode & BTM_DISCOVERABLE_MASK) == 0 && (connect_mode & BTM_CONNECTABLE_MASK) == 0) { *adv_flag_value |= BTM_BLE_BREDR_NOT_SPT; @@ -1265,7 +1256,7 @@ void btm_ble_update_dmt_flag_bits(uint8_t* adv_flag_value, const uint16_t connec * Returns void * ******************************************************************************/ -void btm_ble_set_adv_flag(uint16_t connect_mode, uint16_t disc_mode) { +static void btm_ble_set_adv_flag(uint16_t connect_mode, uint16_t disc_mode) { uint8_t flag = 0, old_flag = 0; tBTM_BLE_LOCAL_ADV_DATA* p_adv_data = &btm_cb.ble_ctr_cb.inq_var.adv_data; @@ -1594,8 +1585,8 @@ tBTM_STATUS btm_ble_start_inquiry(uint8_t duration) { * Returns void * ******************************************************************************/ -void btm_ble_read_remote_name_cmpl(bool status, const RawAddress& bda, uint16_t length, - char* p_name) { +static void btm_ble_read_remote_name_cmpl(bool status, const RawAddress& bda, uint16_t length, + char* p_name) { tHCI_STATUS hci_status = HCI_SUCCESS; BD_NAME bd_name; bd_name_from_char_pointer(bd_name, p_name); diff --git a/system/stack/btm/btm_ble_int.h b/system/stack/btm/btm_ble_int.h index eb8e88a2ce..bc2b4a896b 100644 --- a/system/stack/btm/btm_ble_int.h +++ b/system/stack/btm/btm_ble_int.h @@ -23,11 +23,11 @@ * ******************************************************************************/ -#ifndef BTM_BLE_INT_H -#define BTM_BLE_INT_H +#pragma once #include "stack/btm/btm_ble_int_types.h" #include "stack/btm/security_device_record.h" +#include "stack/include/ble_hci_link_interface.h" #include "stack/include/hci_error_code.h" #include "types/ble_address_with_type.h" #include "types/raw_address.h" @@ -53,8 +53,10 @@ void btm_ble_adv_filter_init(void); bool btm_ble_topology_check(tBTM_BLE_STATE_MASK request); bool btm_ble_clear_topology_mask(tBTM_BLE_STATE_MASK request_state); bool btm_ble_set_topology_mask(tBTM_BLE_STATE_MASK request_state); +tBTM_STATUS btm_ble_start_inquiry(uint8_t duration); +void btm_ble_stop_inquiry(void); +tBTM_STATUS btm_ble_set_connectability(uint16_t combined_mode); +tBTM_STATUS btm_ble_set_discoverability(uint16_t combined_mode); void btm_ble_scanner_init(void); void btm_ble_scanner_cleanup(void); - -#endif diff --git a/system/stack/btm/btm_ble_privacy.cc b/system/stack/btm/btm_ble_privacy.cc index bba53e0448..c0b83336b5 100644 --- a/system/stack/btm/btm_ble_privacy.cc +++ b/system/stack/btm/btm_ble_privacy.cc @@ -35,14 +35,12 @@ #include "main/shim/entry.h" #include "osi/include/allocator.h" #include "stack/btm/btm_int_types.h" +#include "stack/include/ble_hci_link_interface.h" #include "stack/include/bt_octets.h" #include "stack/include/bt_types.h" #include "stack/include/btm_client_interface.h" #include "types/raw_address.h" -// TODO(b/369381361) Enfore -Wmissing-prototypes -#pragma GCC diagnostic ignored "-Wmissing-prototypes" - using namespace bluetooth; extern tBTM_CB btm_cb; diff --git a/system/stack/btm/btm_ble_sec.cc b/system/stack/btm/btm_ble_sec.cc index e05091f656..9d6a604ee7 100644 --- a/system/stack/btm/btm_ble_sec.cc +++ b/system/stack/btm/btm_ble_sec.cc @@ -44,6 +44,7 @@ #include "stack/btm/security_device_record.h" #include "stack/eatt/eatt.h" #include "stack/include/acl_api.h" +#include "stack/include/ble_hci_link_interface.h" #include "stack/include/bt_name.h" #include "stack/include/bt_octets.h" #include "stack/include/bt_types.h" @@ -52,6 +53,7 @@ #include "stack/include/btm_ble_sec_api.h" #include "stack/include/btm_client_interface.h" #include "stack/include/btm_log_history.h" +#include "stack/include/btm_sec_api.h" #include "stack/include/btm_status.h" #include "stack/include/gatt_api.h" #include "stack/include/l2cap_security_interface.h" @@ -59,17 +61,10 @@ #include "stack/include/smp_api_types.h" #include "types/raw_address.h" -// TODO(b/369381361) Enfore -Wmissing-prototypes -#pragma GCC diagnostic ignored "-Wmissing-prototypes" - using namespace bluetooth; extern tBTM_CB btm_cb; -bool btm_ble_init_pseudo_addr(tBTM_SEC_DEV_REC* p_dev_rec, const RawAddress& new_pseudo_addr); -tBTM_STATUS btm_ble_read_remote_name(const RawAddress& remote_bda, tBTM_NAME_CMPL_CB* p_cb); -tBTM_STATUS btm_ble_read_remote_cod(const RawAddress& remote_bda); - namespace { constexpr char kBtmLogTag[] = "SEC"; } diff --git a/system/stack/btm/btm_dev.cc b/system/stack/btm/btm_dev.cc index 4840a6d36e..b7275d00d7 100644 --- a/system/stack/btm/btm_dev.cc +++ b/system/stack/btm/btm_dev.cc @@ -49,9 +49,6 @@ #include "stack/include/l2cap_interface.h" #include "types/raw_address.h" -// TODO(b/369381361) Enfore -Wmissing-prototypes -#pragma GCC diagnostic ignored "-Wmissing-prototypes" - using namespace bluetooth; extern tBTM_CB btm_cb; @@ -825,11 +822,11 @@ void DumpsysRecord(int fd) { #undef DUMPSYS_TAG namespace bluetooth { -namespace testing { namespace legacy { +namespace testing { void wipe_secrets_and_remove(tBTM_SEC_DEV_REC* p_dev_rec) { ::wipe_secrets_and_remove(p_dev_rec); } -} // namespace legacy } // namespace testing +} // namespace legacy } // namespace bluetooth diff --git a/system/stack/btm/btm_dev.h b/system/stack/btm/btm_dev.h index ca9a38ad57..463a84c104 100644 --- a/system/stack/btm/btm_dev.h +++ b/system/stack/btm/btm_dev.h @@ -215,3 +215,7 @@ const tBLE_BD_ADDR BTM_Sec_GetAddressWithType(const RawAddress& bd_addr); * ******************************************************************************/ void DumpsysRecord(int fd); + +namespace bluetooth::legacy::testing { +void wipe_secrets_and_remove(tBTM_SEC_DEV_REC* p_dev_rec); +} // namespace bluetooth::legacy::testing diff --git a/system/stack/btm/btm_devctl.cc b/system/stack/btm/btm_devctl.cc index 953487b183..834834f61c 100644 --- a/system/stack/btm/btm_devctl.cc +++ b/system/stack/btm/btm_devctl.cc @@ -38,6 +38,7 @@ #include "main/shim/entry.h" #include "stack/btm/btm_int_types.h" #include "stack/btm/btm_sec.h" +#include "stack/btm/internal/btm_api.h" #include "stack/connection_manager/connection_manager.h" #include "stack/include/acl_api.h" #include "stack/include/acl_api_types.h" @@ -45,19 +46,17 @@ #include "stack/include/bt_types.h" #include "stack/include/btm_ble_privacy.h" #include "stack/include/btm_inq.h" +#include "stack/include/btm_sec_api.h" #include "stack/include/btm_status.h" +#include "stack/include/dev_hci_link_interface.h" #include "stack/include/hcidefs.h" #include "stack/include/l2cap_controller_interface.h" #include "types/raw_address.h" -// TODO(b/369381361) Enfore -Wmissing-prototypes -#pragma GCC diagnostic ignored "-Wmissing-prototypes" - using namespace ::bluetooth; extern tBTM_CB btm_cb; -void btm_inq_db_reset(void); /******************************************************************************/ /* L O C A L D A T A D E F I N I T I O N S */ /******************************************************************************/ @@ -81,34 +80,6 @@ static void decode_controller_support(); /******************************************************************************* * - * Function btm_dev_init - * - * Description This function is on the BTM startup - * - * Returns void - * - ******************************************************************************/ -void btm_dev_init() { - /* Initialize nonzero defaults */ - memset(btm_sec_cb.cfg.bd_name, 0, sizeof(BD_NAME)); - - btm_cb.devcb.read_rssi_timer = alarm_new("btm.read_rssi_timer"); - btm_cb.devcb.read_failed_contact_counter_timer = - alarm_new("btm.read_failed_contact_counter_timer"); - btm_cb.devcb.read_automatic_flush_timeout_timer = - alarm_new("btm.read_automatic_flush_timeout_timer"); - btm_cb.devcb.read_tx_power_timer = alarm_new("btm.read_tx_power_timer"); -} - -void btm_dev_free() { - alarm_free(btm_cb.devcb.read_rssi_timer); - alarm_free(btm_cb.devcb.read_failed_contact_counter_timer); - alarm_free(btm_cb.devcb.read_automatic_flush_timeout_timer); - alarm_free(btm_cb.devcb.read_tx_power_timer); -} - -/******************************************************************************* - * * Function btm_db_reset * * Returns void diff --git a/system/stack/btm/btm_inq.cc b/system/stack/btm/btm_inq.cc index b1ed1c6d03..f478aff768 100644 --- a/system/stack/btm/btm_inq.cc +++ b/system/stack/btm/btm_inq.cc @@ -48,6 +48,7 @@ #include "osi/include/properties.h" #include "osi/include/stack_power_telemetry.h" #include "packet/bit_inserter.h" +#include "stack/btm/btm_ble_int.h" #include "stack/btm/btm_eir.h" #include "stack/btm/btm_int_types.h" #include "stack/btm/neighbor_inquiry.h" @@ -85,9 +86,6 @@ ((uint32_t)1 << (((uint32_t)(service)) % BTM_EIR_ARRAY_BITS))) >> \ (((uint32_t)(service)) % BTM_EIR_ARRAY_BITS)) -// TODO(b/369381361) Enfore -Wmissing-prototypes -#pragma GCC diagnostic ignored "-Wmissing-prototypes" - namespace { constexpr char kBtmLogTag[] = "SCAN"; @@ -118,12 +116,6 @@ uint16_t max_bd_entries_; /* Maximum number of entries that can be stored */ } // namespace extern tBTM_CB btm_cb; -void btm_inq_db_set_inq_by_rssi(void); -tBTM_STATUS btm_ble_set_discoverability(uint16_t combined_mode); -tBTM_STATUS btm_ble_set_connectability(uint16_t combined_mode); - -tBTM_STATUS btm_ble_start_inquiry(uint8_t duration); -void btm_ble_stop_inquiry(void); using namespace bluetooth; using bluetooth::Uuid; @@ -241,16 +233,15 @@ const uint16_t BTM_EIR_UUID_LKUP_TBL[BTM_EIR_MAX_SERVICES] = { /******************************************************************************/ static void btm_clr_inq_db(const RawAddress* p_bda); static void btm_init_inq_result_flt(void); -void btm_clr_inq_result_flt(void); static uint8_t btm_convert_uuid_to_eir_service(uint16_t uuid16); -void btm_set_eir_uuid(const uint8_t* p_eir, tBTM_INQ_RESULTS* p_results); static const uint8_t* btm_eir_get_uuid_list(const uint8_t* p_eir, size_t eir_len, uint8_t uuid_size, uint8_t* p_num_uuid, uint8_t* p_uuid_list_type); - +static void btm_set_eir_uuid(const uint8_t* p_eir, tBTM_INQ_RESULTS* p_results); static void btm_process_cancel_complete(tHCI_STATUS status, uint8_t mode); static void on_incoming_hci_event(EventView event); static bool is_inquery_by_rssi() { return osi_property_get_bool(PROPERTY_INQ_BY_RSSI, false); } + /******************************************************************************* * * Function BTM_SetDiscoverability @@ -889,7 +880,7 @@ tBTM_STATUS BTM_ClearInqDb(const RawAddress* p_bda) { * Returns void * ******************************************************************************/ -void btm_clear_all_pending_le_entry(void) { +static void btm_clear_all_pending_le_entry(void) { uint16_t xx; std::lock_guard<std::mutex> lock(inq_db_lock_); tINQ_DB_ENT* p_ent = inq_db_; @@ -989,11 +980,11 @@ void btm_inq_db_reset(void) { * Returns void * ******************************************************************************/ -void btm_clr_inq_db(const RawAddress* p_bda) { +static void btm_clr_inq_db(const RawAddress* p_bda) { uint16_t xx; #if (BTM_INQ_DEBUG == TRUE) - log::verbose("btm_clr_inq_db: inq_active:0x{:x} state:{}", btm_cb.btm_inq_vars.inq_active, + log::verbose("inq_active:0x{:x} state:{}", btm_cb.btm_inq_vars.inq_active, btm_cb.btm_inq_vars.state); #endif std::lock_guard<std::mutex> lock(inq_db_lock_); @@ -1600,7 +1591,7 @@ static void btm_process_inq_results_extended(EventView event) { * Returns void * ******************************************************************************/ -void btm_sort_inq_result(void) { +static void btm_sort_inq_result(void) { uint8_t xx, yy, num_resp; std::lock_guard<std::mutex> lock(inq_db_lock_); tINQ_DB_ENT* p_ent = inq_db_; @@ -2073,7 +2064,7 @@ static uint16_t btm_convert_uuid_to_uuid16(const uint8_t* p_uuid, uint8_t uuid_s * Returns None * ******************************************************************************/ -void btm_set_eir_uuid(const uint8_t* p_eir, tBTM_INQ_RESULTS* p_results) { +static void btm_set_eir_uuid(const uint8_t* p_eir, tBTM_INQ_RESULTS* p_results) { const uint8_t* p_uuid_data; uint8_t num_uuid; uint16_t uuid16; @@ -2192,12 +2183,3 @@ void tBTM_INQUIRY_VAR_ST::Init() { } void tBTM_INQUIRY_VAR_ST::Free() { alarm_free(classic_inquiry_timer); } - -namespace bluetooth { -namespace legacy { -namespace testing { -void btm_clr_inq_db(const RawAddress* p_bda) { ::btm_clr_inq_db(p_bda); } -uint16_t btm_get_num_bd_entries() { return num_bd_entries_; } -} // namespace testing -} // namespace legacy -} // namespace bluetooth diff --git a/system/stack/btm/btm_iot_config.cc b/system/stack/btm/btm_iot_config.cc index 27990d3e86..56d6c90ef9 100644 --- a/system/stack/btm/btm_iot_config.cc +++ b/system/stack/btm/btm_iot_config.cc @@ -18,6 +18,8 @@ #define LOG_TAG "btm_iot" +#include "stack/include/btm_iot_config.h" + #include <bluetooth/log.h> #include "btif/include/btif_storage.h" @@ -26,9 +28,6 @@ #include "stack/acl/acl.h" #include "stack/include/btm_client_interface.h" -// TODO(b/369381361) Enfore -Wmissing-prototypes -#pragma GCC diagnostic ignored "-Wmissing-prototypes" - using namespace bluetooth; /******************************************************************************* diff --git a/system/stack/btm/btm_main.cc b/system/stack/btm/btm_main.cc index 581b4d6445..8cf5328ad6 100644 --- a/system/stack/btm/btm_main.cc +++ b/system/stack/btm/btm_main.cc @@ -30,12 +30,12 @@ #include "common/strings.h" #include "main/shim/dumpsys.h" #include "stack/btm/btm_int_types.h" +#include "stack/btm/internal/btm_api.h" +#include "stack/include/btm_client_interface.h" +#include "stack/include/btm_log_history.h" #include "stack/include/security_client_callbacks.h" #include "types/raw_address.h" -// TODO(b/369381361) Enfore -Wmissing-prototypes -#pragma GCC diagnostic ignored "-Wmissing-prototypes" - using namespace bluetooth; /* Global BTM control block structure diff --git a/system/stack/btm/btm_sco.cc b/system/stack/btm/btm_sco.cc index ecb0c4d734..c48b321448 100644 --- a/system/stack/btm/btm_sco.cc +++ b/system/stack/btm/btm_sco.cc @@ -58,13 +58,11 @@ #include "stack/include/hci_error_code.h" #include "stack/include/hcimsgs.h" #include "stack/include/main_thread.h" +#include "stack/include/sco_hci_link_interface.h" #include "stack/include/sdpdefs.h" #include "stack/include/stack_metrics_logging.h" #include "types/raw_address.h" -// TODO(b/369381361) Enfore -Wmissing-prototypes -#pragma GCC diagnostic ignored "-Wmissing-prototypes" - extern tBTM_CB btm_cb; /* Default to allow enhanced connections where supported. */ @@ -92,11 +90,15 @@ constexpr char kBtmLogTag[] = "SCO"; using namespace bluetooth; using bluetooth::legacy::hci::GetInterface; -// forward declaration for dequeueing packets +/******************************************************************************/ +/* L O C A L F U N C T I O N P R O T O T Y P E S */ +/******************************************************************************/ +static tBTM_STATUS BTM_ChangeEScoLinkParms(uint16_t sco_inx, tBTM_CHG_ESCO_PARAMS* p_parms); + +static void btm_sco_on_disconnected(uint16_t hci_handle, tHCI_REASON reason); +static uint16_t btm_sco_voice_settings_to_legacy(enh_esco_params_t* p_parms); static void btm_route_sco_data(bluetooth::hci::ScoView valid_packet); -void btm_sco_conn_req(const RawAddress& bda, const DEV_CLASS& dev_class, uint8_t link_type); -void btm_sco_on_disconnected(uint16_t hci_handle, tHCI_REASON reason); -bool btm_sco_removed(uint16_t hci_handle, tHCI_REASON reason); +static bool btm_sco_removed(uint16_t hci_handle, tHCI_REASON reason); namespace cpp { bluetooth::common::BidiQueueEnd<bluetooth::hci::ScoBuilder, bluetooth::hci::ScoView>* @@ -214,7 +216,7 @@ enum btm_pcm_buf_state { DECODE_BUF_PARTIAL, }; -void incr_btm_pcm_buf_offset(size_t& offset, bool& mirror, size_t amount) { +static void incr_btm_pcm_buf_offset(size_t& offset, bool& mirror, size_t amount) { size_t bytes_remaining = BTM_SCO_DATA_SIZE_MAX - offset; if (bytes_remaining > amount) { offset += amount; @@ -225,7 +227,7 @@ void incr_btm_pcm_buf_offset(size_t& offset, bool& mirror, size_t amount) { offset = amount - bytes_remaining; } -btm_pcm_buf_state btm_pcm_buf_status() { +static btm_pcm_buf_state btm_pcm_buf_status() { if (btm_pcm_buf_read_offset == btm_pcm_buf_write_offset) { if (btm_pcm_buf_read_mirror == btm_pcm_buf_write_mirror) { return DECODE_BUF_EMPTY; @@ -235,7 +237,7 @@ btm_pcm_buf_state btm_pcm_buf_status() { return DECODE_BUF_PARTIAL; } -size_t btm_pcm_buf_data_len() { +static size_t btm_pcm_buf_data_len() { switch (btm_pcm_buf_status()) { case DECODE_BUF_EMPTY: return 0; @@ -250,9 +252,9 @@ size_t btm_pcm_buf_data_len() { }; } -size_t btm_pcm_buf_avail_len() { return BTM_SCO_DATA_SIZE_MAX - btm_pcm_buf_data_len(); } +static size_t btm_pcm_buf_avail_len() { return BTM_SCO_DATA_SIZE_MAX - btm_pcm_buf_data_len(); } -size_t write_btm_pcm_buf(uint8_t* source, size_t amount) { +static size_t write_btm_pcm_buf(uint8_t* source, size_t amount) { if (btm_pcm_buf_avail_len() < amount) { return 0; } @@ -269,13 +271,6 @@ size_t write_btm_pcm_buf(uint8_t* source, size_t amount) { return amount; } -/******************************************************************************/ -/* L O C A L F U N C T I O N P R O T O T Y P E S */ -/******************************************************************************/ -static tBTM_STATUS BTM_ChangeEScoLinkParms(uint16_t sco_inx, tBTM_CHG_ESCO_PARAMS* p_parms); - -static uint16_t btm_sco_voice_settings_to_legacy(enh_esco_params_t* p_parms); - /******************************************************************************* * * Function btm_esco_conn_rsp @@ -1226,7 +1221,7 @@ void BTM_RemoveScoByBdaddr(const RawAddress& bda) { * Returns true if the link is known about, else false * ******************************************************************************/ -bool btm_sco_removed(uint16_t hci_handle, tHCI_REASON reason) { +static bool btm_sco_removed(uint16_t hci_handle, tHCI_REASON reason) { tSCO_CONN* p = &btm_cb.sco_cb.sco_db[0]; uint16_t xx; @@ -1255,7 +1250,7 @@ bool btm_sco_removed(uint16_t hci_handle, tHCI_REASON reason) { return false; } -void btm_sco_on_disconnected(uint16_t hci_handle, tHCI_REASON reason) { +static void btm_sco_on_disconnected(uint16_t hci_handle, tHCI_REASON reason) { tSCO_CONN* p_sco = btm_cb.sco_cb.get_sco_connection_from_handle(hci_handle); if (p_sco == nullptr) { log::debug("Unable to find sco connection"); diff --git a/system/stack/btm/btm_sco.h b/system/stack/btm/btm_sco.h index eea4ebe94a..ab55e78e44 100644 --- a/system/stack/btm/btm_sco.h +++ b/system/stack/btm/btm_sco.h @@ -302,3 +302,4 @@ void btm_send_sco_packet(std::vector<uint8_t> data); bool btm_peer_supports_esco_2m_phy(RawAddress remote_bda); bool btm_peer_supports_esco_3m_phy(RawAddress remote_bda); bool btm_peer_supports_esco_ev3(RawAddress remote_bda); +void btm_sco_acl_removed(const RawAddress* bda); diff --git a/system/stack/btm/btm_sec.cc b/system/stack/btm/btm_sec.cc index 63be75bffd..149791017a 100644 --- a/system/stack/btm/btm_sec.cc +++ b/system/stack/btm/btm_sec.cc @@ -79,13 +79,8 @@ #include "types/bt_transport.h" #include "types/raw_address.h" -// TODO(b/369381361) Enfore -Wmissing-prototypes -#pragma GCC diagnostic ignored "-Wmissing-prototypes" - namespace { - constexpr char kBtmLogTag[] = "SEC"; - } using namespace bluetooth; @@ -103,9 +98,6 @@ extern tBTM_CB btm_cb; (BTM_SEC_LE_AUTHENTICATED | BTM_SEC_LE_ENCRYPTED | BTM_SEC_LE_LINK_KEY_KNOWN | \ BTM_SEC_LE_LINK_KEY_AUTHED) -bool btm_ble_init_pseudo_addr(tBTM_SEC_DEV_REC* p_dev_rec, const RawAddress& new_pseudo_addr); -void bta_dm_remove_device(const RawAddress& bd_addr); - static tBTM_STATUS btm_sec_execute_procedure(tBTM_SEC_DEV_REC* p_dev_rec); static bool btm_sec_start_get_name(tBTM_SEC_DEV_REC* p_dev_rec); static void btm_sec_wait_and_start_authentication(tBTM_SEC_DEV_REC* p_dev_rec); @@ -177,12 +169,6 @@ static bool handleUnexpectedEncryptionChange() { return sHandleUnexpectedEncryptionChange; } -void NotifyBondingCanceled(tBTM_STATUS /* btm_status */) { - if (btm_sec_cb.api.p_bond_cancel_cmpl_callback) { - btm_sec_cb.api.p_bond_cancel_cmpl_callback(tBTM_STATUS::BTM_SUCCESS); - } -} - /******************************************************************************* * * Function btm_dev_authenticated @@ -2142,9 +2128,9 @@ static void call_registered_rmt_name_callbacks(const RawAddress* p_bd_addr, * nullptr if record is not found * ******************************************************************************/ -tBTM_SEC_DEV_REC* btm_rnr_add_name_to_security_record(const RawAddress* p_bd_addr, - const uint8_t* p_bd_name, - tHCI_STATUS hci_status) { +static tBTM_SEC_DEV_REC* btm_rnr_add_name_to_security_record(const RawAddress* p_bd_addr, + const uint8_t* p_bd_name, + tHCI_STATUS hci_status) { /* If remote name request failed, p_bd_addr is null and we need to search */ /* based on state assuming that we are doing 1 at a time */ tBTM_SEC_DEV_REC* p_dev_rec = nullptr; diff --git a/system/stack/btm/btm_sec.h b/system/stack/btm/btm_sec.h index 117edc0c3c..ade49b883e 100644 --- a/system/stack/btm/btm_sec.h +++ b/system/stack/btm/btm_sec.h @@ -60,6 +60,8 @@ bool BTM_IsLinkKeyAuthed(const RawAddress& bd_addr, tBT_TRANSPORT transport); bool BTM_IsLinkKeyKnown(const RawAddress& bd_addr, tBT_TRANSPORT transport); bool BTM_IsAuthenticated(const RawAddress& bd_addr, tBT_TRANSPORT transport); bool BTM_CanReadDiscoverableCharacteristics(const RawAddress& bd_addr); +void BTM_update_version_info(const RawAddress& bd_addr, + const remote_version_info& remote_version_info); /******************************************************************************* * @@ -401,7 +403,7 @@ void btm_sec_conn_req(const RawAddress& bda, const DEV_CLASS dc); * Returns void * ******************************************************************************/ -void btm_create_conn_cancel_complete(uint8_t status, const RawAddress bd_addr, uint32_t value); +void btm_create_conn_cancel_complete(uint8_t status, const RawAddress bd_addr); /******************************************************************************* * diff --git a/system/stack/btm/internal/btm_api.h b/system/stack/btm/internal/btm_api.h index 88960be4fd..21df1fe46c 100644 --- a/system/stack/btm/internal/btm_api.h +++ b/system/stack/btm/internal/btm_api.h @@ -49,6 +49,7 @@ void btm_free(); * DEVICE CONTROL and COMMON FUNCTIONS ****************************************************************************/ +void BTM_db_reset(void); void BTM_reset_complete(); /******************************************************************************* diff --git a/system/stack/include/ble_hci_link_interface.h b/system/stack/include/ble_hci_link_interface.h index 068368bfb6..41f689ecab 100644 --- a/system/stack/include/ble_hci_link_interface.h +++ b/system/stack/include/ble_hci_link_interface.h @@ -18,8 +18,10 @@ #pragma once #include <cstdint> +#include <vector> #include "stack/include/hci_error_code.h" +#include "stack/include/rnr_interface.h" // This header contains functions for HCI-ble to invoke void btm_ble_read_remote_features_complete(uint8_t* p, uint8_t length); @@ -30,3 +32,21 @@ void btm_ble_read_resolving_list_entry_complete(const uint8_t* p, uint16_t evt_l void btm_ble_remove_resolving_list_entry_complete(uint8_t* p, uint16_t evt_len); void btm_ble_add_resolving_list_entry_complete(uint8_t* p, uint16_t evt_len); void btm_ble_clear_resolving_list_complete(uint8_t* p, uint16_t evt_len); +tBTM_STATUS btm_ble_read_remote_cod(const RawAddress& remote_bda); +tBTM_STATUS btm_ble_read_remote_name(const RawAddress& remote_bda, tBTM_NAME_CMPL_CB* p_cb); +bool btm_ble_cancel_remote_name(const RawAddress& remote_bda); +void btm_ble_decrement_link_topology_mask(uint8_t link_role); +void btm_ble_increment_link_topology_mask(uint8_t link_role); +DEV_CLASS btm_ble_get_appearance_as_cod(std::vector<uint8_t> const& data); +void btm_ble_process_adv_addr(RawAddress& raw_address, tBLE_ADDR_TYPE* address_type); +void btm_ble_process_adv_pkt_cont_for_inquiry(uint16_t event_type, tBLE_ADDR_TYPE address_type, + const RawAddress& raw_address, uint8_t primary_phy, + uint8_t secondary_phy, uint8_t advertising_sid, + int8_t tx_power, int8_t rssi, + uint16_t periodic_adv_int, + std::vector<uint8_t> advertising_data); +void btm_ble_process_adv_pkt_cont(uint16_t evt_type, tBLE_ADDR_TYPE addr_type, + const RawAddress& bda, uint8_t primary_phy, uint8_t secondary_phy, + uint8_t advertising_sid, int8_t tx_power, int8_t rssi, + uint16_t periodic_adv_int, uint8_t data_len, const uint8_t* data, + const RawAddress& original_bda); diff --git a/system/stack/include/btm_inq.h b/system/stack/include/btm_inq.h index d0ae28b01b..c49912180c 100644 --- a/system/stack/include/btm_inq.h +++ b/system/stack/include/btm_inq.h @@ -158,3 +158,6 @@ void BTM_EnableInterlacedInquiryScan(); * ******************************************************************************/ void BTM_EnableInterlacedPageScan(); + +void btm_inq_db_reset(void); +void btm_clr_inq_result_flt(void); diff --git a/system/stack/include/btm_iot_config.h b/system/stack/include/btm_iot_config.h new file mode 100644 index 0000000000..19b575ffdf --- /dev/null +++ b/system/stack/include/btm_iot_config.h @@ -0,0 +1,24 @@ +/****************************************************************************** + * + * Copyright 2025 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + ******************************************************************************/ + +#pragma once + +#include "stack/acl/acl.h" + +void btm_iot_save_remote_properties(tACL_CONN* p_acl_cb); +void btm_iot_save_remote_versions(tACL_CONN* p_acl_cb); diff --git a/system/stack/include/sco_hci_link_interface.h b/system/stack/include/sco_hci_link_interface.h index 5aa2cd128b..9de4eea367 100644 --- a/system/stack/include/sco_hci_link_interface.h +++ b/system/stack/include/sco_hci_link_interface.h @@ -33,8 +33,5 @@ void btm_sco_connection_failed(tHCI_STATUS hci_status, const RawAddress& bda, ui tBTM_ESCO_DATA* p_esco_data); void btm_sco_create_command_status_failed(tHCI_STATUS hci_status); -bool btm_sco_removed(uint16_t hci_handle, tHCI_REASON reason); - -void btm_sco_on_disconnected(uint16_t hci_handle, tHCI_REASON reason); void btm_sco_on_esco_connect_request(const RawAddress&, const bluetooth::hci::ClassOfDevice&); void btm_sco_on_sco_connect_request(const RawAddress&, const bluetooth::hci::ClassOfDevice&); diff --git a/system/stack/l2cap/l2c_link.cc b/system/stack/l2cap/l2c_link.cc index a202c36549..9a78588840 100644 --- a/system/stack/l2cap/l2c_link.cc +++ b/system/stack/l2cap/l2c_link.cc @@ -34,7 +34,10 @@ #include "internal_include/bt_target.h" #include "osi/include/allocator.h" #include "stack/btm/btm_int_types.h" +#include "stack/btm/btm_sco.h" +#include "stack/btm/btm_sec.h" #include "stack/include/acl_api.h" +#include "stack/include/ble_hci_link_interface.h" #include "stack/include/bt_hdr.h" #include "stack/include/bt_types.h" #include "stack/include/btm_status.h" @@ -51,14 +54,6 @@ using namespace bluetooth; extern tBTM_CB btm_cb; -bool BTM_ReadPowerMode(const RawAddress& remote_bda, tBTM_PM_MODE* p_mode); -tBTM_STATUS btm_sec_disconnect(uint16_t handle, tHCI_STATUS reason, std::string); -void btm_acl_created(const RawAddress& bda, uint16_t hci_handle, uint8_t link_role, - tBT_TRANSPORT transport); -void btm_acl_removed(uint16_t handle); -void btm_ble_decrement_link_topology_mask(uint8_t link_role); -void btm_sco_acl_removed(const RawAddress* bda); - static void l2c_link_send_to_lower(tL2C_LCB* p_lcb, BT_HDR* p_buf, tL2C_TX_COMPLETE_CB_INFO* p_cbi); static BT_HDR* l2cu_get_next_buffer_to_send(tL2C_LCB* p_lcb, tL2C_TX_COMPLETE_CB_INFO* p_cbi); diff --git a/system/stack/rnr/remote_name_request.cc b/system/stack/rnr/remote_name_request.cc index bd0fcbce44..989a77bda0 100644 --- a/system/stack/rnr/remote_name_request.cc +++ b/system/stack/rnr/remote_name_request.cc @@ -25,15 +25,13 @@ #include "stack/btm/btm_int_types.h" #include "stack/btm/btm_sec.h" #include "stack/btm/security_device_record.h" +#include "stack/include/ble_hci_link_interface.h" #include "stack/include/btm_client_interface.h" using namespace bluetooth; extern tBTM_CB btm_cb; -tBTM_STATUS btm_ble_read_remote_name(const RawAddress& remote_bda, tBTM_NAME_CMPL_CB* p_cb); -bool btm_ble_cancel_remote_name(const RawAddress& remote_bda); - bool BTM_SecAddRmtNameNotifyCallback(tBTM_RMT_NAME_CALLBACK* p_callback) { int i; diff --git a/system/stack/test/btm/stack_btm_dm_inq_db_test.cc b/system/stack/test/btm/stack_btm_dm_inq_db_test.cc index 7f5e27f26f..7fc971a5c3 100644 --- a/system/stack/test/btm/stack_btm_dm_inq_db_test.cc +++ b/system/stack/test/btm/stack_btm_dm_inq_db_test.cc @@ -23,6 +23,7 @@ #include "stack/btm/btm_int_types.h" #include "stack/btm/neighbor_inquiry.h" +#include "stack/include/btm_inq.h" #include "stack/include/inq_hci_link_interface.h" #include "test/common/mock_functions.h" #include "test/fake/fake_looper.h" @@ -32,8 +33,6 @@ #include "test/mock/mock_osi_thread.h" extern tBTM_CB btm_cb; -extern void btm_init_inq_result_flt(void); -extern void btm_clr_inq_result_flt(void); namespace { constexpr size_t kNumberOfThreads = 8; diff --git a/system/stack/test/btm/stack_btm_sec_test.cc b/system/stack/test/btm/stack_btm_sec_test.cc index 3bfac8572d..58317afc29 100644 --- a/system/stack/test/btm/stack_btm_sec_test.cc +++ b/system/stack/test/btm/stack_btm_sec_test.cc @@ -48,17 +48,7 @@ const uint8_t kBdName[] = "kBdName"; constexpr char kTimeFormat[] = "%Y-%m-%d %H:%M:%S"; } // namespace -namespace bluetooth { -namespace testing { -namespace legacy { - -void wipe_secrets_and_remove(tBTM_SEC_DEV_REC* p_dev_rec); - -} // namespace legacy -} // namespace testing -} // namespace bluetooth - -using bluetooth::testing::legacy::wipe_secrets_and_remove; +using bluetooth::legacy::testing::wipe_secrets_and_remove; constexpr size_t kBtmSecMaxDeviceRecords = static_cast<size_t>(BTM_SEC_MAX_DEVICE_RECORDS + 1); diff --git a/system/test/mock/mock_stack_btm_ble.cc b/system/test/mock/mock_stack_btm_ble.cc index 7e1a2154b9..620b9e252c 100644 --- a/system/test/mock/mock_stack_btm_ble.cc +++ b/system/test/mock/mock_stack_btm_ble.cc @@ -81,8 +81,6 @@ struct btm_ble_update_sec_key_size btm_ble_update_sec_key_size; struct btm_get_local_div btm_get_local_div; struct btm_proc_smp_cback btm_proc_smp_cback; struct btm_sec_save_le_key btm_sec_save_le_key; -struct doNothing doNothing; -struct read_phy_cb read_phy_cb; } // namespace stack_btm_ble } // namespace mock @@ -292,15 +290,6 @@ void btm_sec_save_le_key(const RawAddress& bd_addr, tBTM_LE_KEY_TYPE key_type, inc_func_call_count(__func__); test::mock::stack_btm_ble::btm_sec_save_le_key(bd_addr, key_type, p_keys, pass_to_application); } -void doNothing(uint8_t* data, uint16_t len) { - inc_func_call_count(__func__); - test::mock::stack_btm_ble::doNothing(data, len); -} -void read_phy_cb(base::Callback<void(uint8_t tx_phy, uint8_t rx_phy, uint8_t status)> cb, - uint8_t* data, uint16_t len) { - inc_func_call_count(__func__); - test::mock::stack_btm_ble::read_phy_cb(cb, data, len); -} // Mocked functions complete // END mockcify generation diff --git a/system/test/mock/mock_stack_btm_ble.h b/system/test/mock/mock_stack_btm_ble.h index 1133b60b4c..9c1b14d014 100644 --- a/system/test/mock/mock_stack_btm_ble.h +++ b/system/test/mock/mock_stack_btm_ble.h @@ -545,32 +545,6 @@ struct btm_sec_save_le_key { }; extern struct btm_sec_save_le_key btm_sec_save_le_key; -// Name: doNothing -// Params: uint8_t* data, uint16_t len -// Return: void -struct doNothing { - std::function<void(uint8_t* data, uint16_t len)> body{ - [](uint8_t* /* data */, uint16_t /* len */) {}}; - void operator()(uint8_t* data, uint16_t len) { body(data, len); } -}; -extern struct doNothing doNothing; - -// Name: read_phy_cb -// Params: base::Callback<void(uint8_t tx_phy, uint8_t rx_phy, uint8_t status -// Return: void -struct read_phy_cb { - std::function<void(base::Callback<void(uint8_t tx_phy, uint8_t rx_phy, uint8_t status)> callback, - uint8_t* data, uint16_t len)> - body{[](base::Callback<void(uint8_t tx_phy, uint8_t rx_phy, uint8_t status)> - /* callback */, - uint8_t* /* data */, uint16_t /* len */) {}}; - void operator()(base::Callback<void(uint8_t tx_phy, uint8_t rx_phy, uint8_t status)> callback, - uint8_t* data, uint16_t len) { - body(callback, data, len); - } -}; -extern struct read_phy_cb read_phy_cb; - } // namespace stack_btm_ble } // namespace mock } // namespace test diff --git a/system/test/mock/mock_stack_btm_ble_gap.cc b/system/test/mock/mock_stack_btm_ble_gap.cc index 93e134c4a8..de8731ef54 100644 --- a/system/test/mock/mock_stack_btm_ble_gap.cc +++ b/system/test/mock/mock_stack_btm_ble_gap.cc @@ -46,10 +46,6 @@ using SyncReportCb = using SyncLostCb = base::Callback<void(uint16_t /*sync_handle*/)>; using SyncTransferCb = base::Callback<void(uint8_t /*status*/, RawAddress)>; -bool ble_vnd_is_included() { - inc_func_call_count(__func__); - return false; -} bool BTM_BleConfigPrivacy(bool /* privacy_mode */) { inc_func_call_count(__func__); return false; @@ -58,9 +54,9 @@ bool BTM_BleLocalPrivacyEnabled(void) { inc_func_call_count(__func__); return false; } -bool btm_ble_read_remote_cod(const RawAddress& /* remote_bda */) { +tBTM_STATUS btm_ble_read_remote_cod(const RawAddress& /* remote_bda */) { inc_func_call_count(__func__); - return false; + return tBTM_STATUS::BTM_SUCCESS; } bool btm_ble_cancel_remote_name(const RawAddress& /* remote_bda */) { inc_func_call_count(__func__); @@ -144,18 +140,7 @@ void btm_ble_process_adv_pkt_cont_for_inquiry( void btm_ble_read_remote_features_complete(uint8_t* /* p */, uint8_t /* length */) { inc_func_call_count(__func__); } -void btm_ble_read_remote_name_cmpl(bool /* status */, const RawAddress& /* bda */, - uint16_t /* length */, char* /* p_name */) { - inc_func_call_count(__func__); -} -void btm_ble_set_adv_flag(uint16_t /* connect_mode */, uint16_t /* disc_mode */) { - inc_func_call_count(__func__); -} void btm_ble_stop_inquiry(void) { inc_func_call_count(__func__); } -void btm_ble_update_dmt_flag_bits(uint8_t* /* adv_flag_value */, const uint16_t /* connect_mode */, - const uint16_t /* disc_mode */) { - inc_func_call_count(__func__); -} void btm_ble_update_mode_operation(uint8_t /* link_role */, const RawAddress* /* bd_addr */, tHCI_STATUS /* status */) { inc_func_call_count(__func__); diff --git a/system/test/mock/mock_stack_btm_devctl.cc b/system/test/mock/mock_stack_btm_devctl.cc index fc27fab6db..da8d8b2053 100644 --- a/system/test/mock/mock_stack_btm_devctl.cc +++ b/system/test/mock/mock_stack_btm_devctl.cc @@ -32,14 +32,6 @@ // TODO(b/369381361) Enfore -Wmissing-prototypes #pragma GCC diagnostic ignored "-Wmissing-prototypes" -namespace test { -namespace mock { -namespace stack_btm_devctl { - -} -} // namespace mock -} // namespace test - tBTM_STATUS BTM_DeleteStoredLinkKey(const RawAddress* /* bd_addr */, tBTM_CMPL_CB* /* p_cb */) { inc_func_call_count(__func__); return tBTM_STATUS::BTM_SUCCESS; @@ -56,5 +48,3 @@ void BTM_db_reset(void) { inc_func_call_count(__func__); } void btm_delete_stored_link_key_complete(uint8_t* /* p */, uint16_t /* evt_len */) { inc_func_call_count(__func__); } -void btm_dev_free() { inc_func_call_count(__func__); } -void btm_dev_init() { inc_func_call_count(__func__); } diff --git a/system/test/mock/mock_stack_btm_inq.cc b/system/test/mock/mock_stack_btm_inq.cc index b137827eb9..ed99d05e6f 100644 --- a/system/test/mock/mock_stack_btm_inq.cc +++ b/system/test/mock/mock_stack_btm_inq.cc @@ -48,7 +48,6 @@ struct BTM_SetConnectability BTM_SetConnectability; struct BTM_SetDiscoverability BTM_SetDiscoverability; struct BTM_SetInquiryMode BTM_SetInquiryMode; struct BTM_StartInquiry BTM_StartInquiry; -struct btm_clear_all_pending_le_entry btm_clear_all_pending_le_entry; struct btm_clr_inq_db btm_clr_inq_db; struct btm_clr_inq_result_flt btm_clr_inq_result_flt; struct btm_inq_db_find btm_inq_db_find; @@ -56,8 +55,6 @@ struct btm_inq_db_new btm_inq_db_new; struct btm_inq_db_reset btm_inq_db_reset; struct btm_inq_find_bdaddr btm_inq_find_bdaddr; struct btm_process_inq_complete btm_process_inq_complete; -struct btm_set_eir_uuid btm_set_eir_uuid; -struct btm_sort_inq_result btm_sort_inq_result; } // namespace stack_btm_inq } // namespace mock @@ -119,10 +116,6 @@ tBTM_STATUS BTM_StartInquiry(tBTM_INQ_RESULTS_CB* p_results_cb, tBTM_CMPL_CB* p_ inc_func_call_count(__func__); return test::mock::stack_btm_inq::BTM_StartInquiry(p_results_cb, p_cmpl_cb); } -void btm_clear_all_pending_le_entry(void) { - inc_func_call_count(__func__); - test::mock::stack_btm_inq::btm_clear_all_pending_le_entry(); -} void btm_clr_inq_db(const RawAddress* p_bda) { inc_func_call_count(__func__); test::mock::stack_btm_inq::btm_clr_inq_db(p_bda); @@ -151,13 +144,5 @@ void btm_process_inq_complete(tHCI_STATUS status, uint8_t mode) { inc_func_call_count(__func__); test::mock::stack_btm_inq::btm_process_inq_complete(status, mode); } -void btm_set_eir_uuid(const uint8_t* p_eir, tBTM_INQ_RESULTS* p_results) { - inc_func_call_count(__func__); - test::mock::stack_btm_inq::btm_set_eir_uuid(p_eir, p_results); -} -void btm_sort_inq_result(void) { - inc_func_call_count(__func__); - test::mock::stack_btm_inq::btm_sort_inq_result(); -} // Mocked functions complete // END mockcify generation diff --git a/system/test/mock/mock_stack_btm_inq.h b/system/test/mock/mock_stack_btm_inq.h index d89dd534c2..4c0acd08a4 100644 --- a/system/test/mock/mock_stack_btm_inq.h +++ b/system/test/mock/mock_stack_btm_inq.h @@ -143,15 +143,6 @@ struct BTM_StartInquiry { }; extern struct BTM_StartInquiry BTM_StartInquiry; -// Name: btm_clear_all_pending_le_entry -// Params: void -// Return: void -struct btm_clear_all_pending_le_entry { - std::function<void(void)> body{[](void) {}}; - void operator()(void) { body(); } -}; -extern struct btm_clear_all_pending_le_entry btm_clear_all_pending_le_entry; - // Name: btm_clr_inq_db // Params: const RawAddress* p_bda // Return: void @@ -222,25 +213,6 @@ struct btm_process_inq_complete { }; extern struct btm_process_inq_complete btm_process_inq_complete; -// Name: btm_set_eir_uuid -// Params: const uint8_t* p_eir, tBTM_INQ_RESULTS* p_results -// Return: void -struct btm_set_eir_uuid { - std::function<void(const uint8_t* p_eir, tBTM_INQ_RESULTS* p_results)> body{ - [](const uint8_t* /* p_eir */, tBTM_INQ_RESULTS* /* p_results */) {}}; - void operator()(const uint8_t* p_eir, tBTM_INQ_RESULTS* p_results) { body(p_eir, p_results); } -}; -extern struct btm_set_eir_uuid btm_set_eir_uuid; - -// Name: btm_sort_inq_result -// Params: void -// Return: void -struct btm_sort_inq_result { - std::function<void(void)> body{[](void) {}}; - void operator()(void) { body(); } -}; -extern struct btm_sort_inq_result btm_sort_inq_result; - } // namespace stack_btm_inq } // namespace mock } // namespace test diff --git a/system/test/mock/mock_stack_btm_sco.cc b/system/test/mock/mock_stack_btm_sco.cc index 949e635b09..0128227349 100644 --- a/system/test/mock/mock_stack_btm_sco.cc +++ b/system/test/mock/mock_stack_btm_sco.cc @@ -33,10 +33,6 @@ // TODO(b/369381361) Enfore -Wmissing-prototypes #pragma GCC diagnostic ignored "-Wmissing-prototypes" -bool btm_sco_removed(uint16_t /* hci_handle */, tHCI_REASON /* reason */) { - inc_func_call_count(__func__); - return false; -} const RawAddress* BTM_ReadScoBdAddr(uint16_t /* sco_inx */) { inc_func_call_count(__func__); return nullptr; @@ -91,9 +87,6 @@ void btm_sco_on_sco_connect_request(const RawAddress& /* bda */, const bluetooth::hci::ClassOfDevice& /* cod */) { inc_func_call_count(__func__); } -void btm_sco_on_disconnected(uint16_t /* hci_handle */, tHCI_REASON /* reason */) { - inc_func_call_count(__func__); -} bool btm_peer_supports_esco_2m_phy(RawAddress /* bd_addr */) { inc_func_call_count(__func__); return true; diff --git a/system/test/mock/mock_stack_btm_sec.cc b/system/test/mock/mock_stack_btm_sec.cc index cdf4b97df6..4ca3189b30 100644 --- a/system/test/mock/mock_stack_btm_sec.cc +++ b/system/test/mock/mock_stack_btm_sec.cc @@ -64,7 +64,6 @@ struct BTM_SetEncryption BTM_SetEncryption; struct BTM_SetPinType BTM_SetPinType; struct BTM_SetSecurityLevel BTM_SetSecurityLevel; struct BTM_update_version_info BTM_update_version_info; -struct NotifyBondingCanceled NotifyBondingCanceled; struct btm_create_conn_cancel_complete btm_create_conn_cancel_complete; struct btm_get_dev_class btm_get_dev_class; struct btm_io_capabilities_req btm_io_capabilities_req; @@ -235,10 +234,6 @@ void BTM_update_version_info(const RawAddress& bd_addr, inc_func_call_count(__func__); test::mock::stack_btm_sec::BTM_update_version_info(bd_addr, remote_version_info); } -void NotifyBondingCanceled(tBTM_STATUS btm_status) { - inc_func_call_count(__func__); - test::mock::stack_btm_sec::NotifyBondingCanceled(btm_status); -} void btm_create_conn_cancel_complete(uint8_t status, const RawAddress bd_addr) { inc_func_call_count(__func__); test::mock::stack_btm_sec::btm_create_conn_cancel_complete(status, bd_addr); diff --git a/system/test/mock/mock_stack_btm_sec.h b/system/test/mock/mock_stack_btm_sec.h index c40e57c593..688ab5dca1 100644 --- a/system/test/mock/mock_stack_btm_sec.h +++ b/system/test/mock/mock_stack_btm_sec.h @@ -331,15 +331,6 @@ struct BTM_update_version_info { }; extern struct BTM_update_version_info BTM_update_version_info; -// Name: NotifyBondingCanceled -// Params: tBTM_STATUS btm_status -// Return: void -struct NotifyBondingCanceled { - std::function<void(tBTM_STATUS btm_status)> body{[](tBTM_STATUS /* btm_status */) {}}; - void operator()(tBTM_STATUS btm_status) { body(btm_status); } -}; -extern struct NotifyBondingCanceled NotifyBondingCanceled; - // Name: btm_create_conn_cancel_complete // Params: uint8_t status, RawAddress bd_addr // Return: void |