summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jakub Pawlowski <jpawlowski@google.com> 2024-10-09 16:20:10 +0200
committer Jakub Pawlowski <jpawlowski@google.com> 2024-10-09 22:13:04 +0200
commit9a5b6b8dab52df8fbd99c57357fd03c7f080a1d6 (patch)
treefbd16cdd37f8d7a89cdf8a452e29bfa0f6602aaa
parenta2e3a18730c1e37ed1ffcbac2d7cb5e473dfa681 (diff)
Remove acl_create_le_connection
It's just another version of acl_create_le_connection_with_id. Having just one method with mocks for that is enough. Bug: 372202918 Test: mma -j32 Flag: EXEMPT, trivial Change-Id: If88160675537dbbe190f423bada13d67f6a36a41
-rw-r--r--system/stack/acl/btm_acl.cc4
-rw-r--r--system/stack/fuzzers/l2cap_fuzzer.cc9
-rw-r--r--system/stack/include/l2cap_acl_interface.h1
-rw-r--r--system/stack/l2cap/l2c_ble.cc2
-rw-r--r--system/test/mock/mock_stack_acl.cc5
-rw-r--r--system/test/mock/mock_stack_acl.h9
6 files changed, 6 insertions, 24 deletions
diff --git a/system/stack/acl/btm_acl.cc b/system/stack/acl/btm_acl.cc
index c99ab7fcfc..d88f447160 100644
--- a/system/stack/acl/btm_acl.cc
+++ b/system/stack/acl/btm_acl.cc
@@ -2494,10 +2494,6 @@ bool acl_create_le_connection_with_id(uint8_t id, const RawAddress& bd_addr,
return true;
}
-bool acl_create_le_connection(const RawAddress& bd_addr) {
- return acl_create_le_connection_with_id(CONN_MGR_ID_L2CAP, bd_addr);
-}
-
void acl_rcv_acl_data(BT_HDR* p_msg) {
acl_header_t acl_header{
.handle = HCI_INVALID_HANDLE,
diff --git a/system/stack/fuzzers/l2cap_fuzzer.cc b/system/stack/fuzzers/l2cap_fuzzer.cc
index 74b3590a45..d9793509b4 100644
--- a/system/stack/fuzzers/l2cap_fuzzer.cc
+++ b/system/stack/fuzzers/l2cap_fuzzer.cc
@@ -100,9 +100,10 @@ namespace {
class FakeBtStack {
public:
FakeBtStack() {
- test::mock::stack_acl::acl_create_le_connection.body = [](const RawAddress& /*bd_addr*/) {
- return true;
- };
+ test::mock::stack_acl::acl_create_le_connection_with_id.body =
+ [](uint8_t /* id */, const RawAddress& /* bd_addr */, tBLE_ADDR_TYPE /* addr_type */) {
+ return true;
+ };
test::mock::stack_acl::acl_send_data_packet_br_edr.body = [](const RawAddress& /*bd_addr*/,
BT_HDR* hdr) {
ConsumeData((const uint8_t*)hdr, hdr->offset + hdr->len);
@@ -131,7 +132,7 @@ public:
}
~FakeBtStack() {
- test::mock::stack_acl::acl_create_le_connection = {};
+ test::mock::stack_acl::acl_create_le_connection_with_id = {};
test::mock::stack_acl::acl_send_data_packet_br_edr = {};
test::mock::stack_acl::acl_send_data_packet_ble = {};
bluetooth::hci::testing::mock_controller_ = nullptr;
diff --git a/system/stack/include/l2cap_acl_interface.h b/system/stack/include/l2cap_acl_interface.h
index 026724817e..7e4a17dc46 100644
--- a/system/stack/include/l2cap_acl_interface.h
+++ b/system/stack/include/l2cap_acl_interface.h
@@ -25,7 +25,6 @@
// This header contains functions for L2cap-ACL to invoke
//
-bool acl_create_le_connection(const RawAddress& bd_addr);
bool acl_create_le_connection_with_id(uint8_t id, const RawAddress& bd_addr,
tBLE_ADDR_TYPE addr_type = BLE_ADDR_PUBLIC);
void acl_send_data_packet_br_edr(const RawAddress& bd_addr, BT_HDR* p_buf);
diff --git a/system/stack/l2cap/l2c_ble.cc b/system/stack/l2cap/l2c_ble.cc
index e2a1fbceff..92753f8049 100644
--- a/system/stack/l2cap/l2c_ble.cc
+++ b/system/stack/l2cap/l2c_ble.cc
@@ -926,7 +926,7 @@ void l2cble_process_sig_cmd(tL2C_LCB* p_lcb, uint8_t* p, uint16_t pkt_len) {
/** This function is to initate a direct connection. Returns true if connection
* initiated, false otherwise. */
bool l2cble_create_conn(tL2C_LCB* p_lcb) {
- if (!acl_create_le_connection(p_lcb->remote_bd_addr)) {
+ if (!acl_create_le_connection_with_id(CONN_MGR_ID_L2CAP, p_lcb->remote_bd_addr)) {
return false;
}
diff --git a/system/test/mock/mock_stack_acl.cc b/system/test/mock/mock_stack_acl.cc
index 22822f2f89..c5989b3bbd 100644
--- a/system/test/mock/mock_stack_acl.cc
+++ b/system/test/mock/mock_stack_acl.cc
@@ -48,7 +48,6 @@ struct BTM_IsAclConnectionUp BTM_IsAclConnectionUp;
struct BTM_IsBleConnection BTM_IsBleConnection;
struct BTM_ReadRemoteConnectionAddr BTM_ReadRemoteConnectionAddr;
struct BTM_is_sniff_allowed_for BTM_is_sniff_allowed_for;
-struct acl_create_le_connection acl_create_le_connection;
struct acl_create_le_connection_with_id acl_create_le_connection_with_id;
struct acl_is_role_switch_allowed acl_is_role_switch_allowed;
struct acl_is_switch_role_idle acl_is_switch_role_idle;
@@ -153,10 +152,6 @@ bool BTM_is_sniff_allowed_for(const RawAddress& peer_addr) {
inc_func_call_count(__func__);
return test::mock::stack_acl::BTM_is_sniff_allowed_for(peer_addr);
}
-bool acl_create_le_connection(const RawAddress& bd_addr) {
- inc_func_call_count(__func__);
- return test::mock::stack_acl::acl_create_le_connection(bd_addr);
-}
bool acl_create_le_connection_with_id(uint8_t id, const RawAddress& bd_addr,
tBLE_ADDR_TYPE addr_type) {
inc_func_call_count(__func__);
diff --git a/system/test/mock/mock_stack_acl.h b/system/test/mock/mock_stack_acl.h
index d175d230a0..2f4dc13ca1 100644
--- a/system/test/mock/mock_stack_acl.h
+++ b/system/test/mock/mock_stack_acl.h
@@ -97,15 +97,6 @@ struct acl_send_data_packet_br_edr {
void operator()(const RawAddress& bd_addr, BT_HDR* p_buf) { return body(bd_addr, p_buf); }
};
extern struct acl_send_data_packet_br_edr acl_send_data_packet_br_edr;
-// Name: acl_create_le_connection
-// Params: const RawAddress& bd_addr
-// Returns: bool
-struct acl_create_le_connection {
- std::function<bool(const RawAddress& bd_addr)> body{
- [](const RawAddress& /* bd_addr */) { return false; }};
- bool operator()(const RawAddress& bd_addr) { return body(bd_addr); }
-};
-extern struct acl_create_le_connection acl_create_le_connection;
// Name: acl_create_le_connection_with_id
// Params: uint8_t id, const RawAddress& bd_addr
// Returns: bool