summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jakub Pawlowski <jpawlowski@google.com> 2025-01-09 13:08:25 +0100
committer Jakub Pawlowski <jpawlowski@google.com> 2025-01-09 21:56:58 +0100
commit32f4aaaf9d3a8837960278cccc58994c658ff3cd (patch)
treeaa9cfa560164fde9cff127e96354efdfbc2c559d
parentfe4bf87a69c9c10d3b6cdc8a537be842990daead (diff)
delete gatt_cancel_connect
It's called from just one place. It's short, and it's logic will be further reduced in next patch. Bug: 372202918 Test: mma -j32 Flag: EXEMPT, no functional change Change-Id: I7a79e2494c8354fbc7e0ceeba5f600389606e301
-rw-r--r--system/stack/gatt/gatt_int.h1
-rw-r--r--system/stack/gatt/gatt_main.cc36
-rw-r--r--system/stack/test/gatt/gatt_sr_test.cc1
-rw-r--r--system/stack/test/gatt/mock_gatt_utils_ref.cc1
-rw-r--r--system/test/mock/mock_stack_gatt_main.cc3
5 files changed, 9 insertions, 33 deletions
diff --git a/system/stack/gatt/gatt_int.h b/system/stack/gatt/gatt_int.h
index c366c7aca8..906c99eb2f 100644
--- a/system/stack/gatt/gatt_int.h
+++ b/system/stack/gatt/gatt_int.h
@@ -489,7 +489,6 @@ extern bluetooth::common::TimestampedCircularBuffer<tTCB_STATE_HISTORY> tcb_stat
/* from gatt_main.cc */
bool gatt_disconnect(tGATT_TCB* p_tcb);
-void gatt_cancel_connect(const RawAddress& bd_addr, tBT_TRANSPORT transport);
bool gatt_act_connect(tGATT_REG* p_reg, const RawAddress& bd_addr, tBT_TRANSPORT transport,
int8_t initiating_phys);
bool gatt_act_connect(tGATT_REG* p_reg, const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
diff --git a/system/stack/gatt/gatt_main.cc b/system/stack/gatt/gatt_main.cc
index 976707b140..2688cfa582 100644
--- a/system/stack/gatt/gatt_main.cc
+++ b/system/stack/gatt/gatt_main.cc
@@ -240,32 +240,6 @@ static bool gatt_connect(const RawAddress& rem_bda, tBLE_ADDR_TYPE addr_type, tG
/*******************************************************************************
*
- * Function gatt_cancel_connect
- *
- * Description This will remove device from allow list and cancel connection
- *
- * Parameter bd_addr: peer device address.
- * transport: transport
- *
- *
- ******************************************************************************/
-void gatt_cancel_connect(const RawAddress& bd_addr, tBT_TRANSPORT transport) {
- /* This shall be call only when device is not connected */
- log::debug("{}, transport {}", bd_addr, transport);
-
- if (!connection_manager::direct_connect_remove(CONN_MGR_ID_L2CAP, bd_addr)) {
- bluetooth::shim::ACL_IgnoreLeConnectionFrom(BTM_Sec_GetAddressWithType(bd_addr));
- log::info(
- "GATT connection manager has no record but removed filter "
- "acceptlist gatt_if:{} peer:{}",
- static_cast<uint8_t>(CONN_MGR_ID_L2CAP), bd_addr);
- }
-
- gatt_cleanup_upon_disc(bd_addr, GATT_CONN_TERMINATE_LOCAL_HOST, transport);
-}
-
-/*******************************************************************************
- *
* Function gatt_disconnect
*
* Description This function is called to disconnect to an ATT device.
@@ -302,7 +276,15 @@ bool gatt_disconnect(tGATT_TCB* p_tcb) {
/* att_lcid == L2CAP_ATT_CID */
if (ch_state != GATT_CH_OPEN) {
- gatt_cancel_connect(p_tcb->peer_bda, p_tcb->transport);
+ if (!connection_manager::direct_connect_remove(CONN_MGR_ID_L2CAP, p_tcb->peer_bda)) {
+ bluetooth::shim::ACL_IgnoreLeConnectionFrom(BTM_Sec_GetAddressWithType(p_tcb->peer_bda));
+ log::info(
+ "GATT connection manager has no record but removed filter "
+ "acceptlist gatt_if:{} peer:{}",
+ static_cast<uint8_t>(CONN_MGR_ID_L2CAP), p_tcb->peer_bda);
+ }
+
+ gatt_cleanup_upon_disc(p_tcb->peer_bda, GATT_CONN_TERMINATE_LOCAL_HOST, p_tcb->transport);
return true;
}
diff --git a/system/stack/test/gatt/gatt_sr_test.cc b/system/stack/test/gatt/gatt_sr_test.cc
index f61df0833e..9c5eb868d0 100644
--- a/system/stack/test/gatt/gatt_sr_test.cc
+++ b/system/stack/test/gatt/gatt_sr_test.cc
@@ -71,7 +71,6 @@ tGATT_STATUS attp_send_sr_msg(tGATT_TCB& /*tcb*/, uint16_t /*cid*/, BT_HDR* /*p_
void gatt_act_discovery(tGATT_CLCB* /*p_clcb*/) {}
bool gatt_disconnect(tGATT_TCB* /*p_tcb*/) { return false; }
-void gatt_cancel_connect(const RawAddress& /*bd_addr*/, tBT_TRANSPORT /*transport*/) {}
tGATT_CH_STATE gatt_get_ch_state(tGATT_TCB* /*p_tcb*/) { return GATT_CH_CLOSE; }
tGATT_STATUS gatts_db_read_attr_value_by_type(tGATT_TCB& /*tcb*/, uint16_t /*cid*/,
tGATT_SVC_DB* /*p_db*/, uint8_t /*op_code*/,
diff --git a/system/stack/test/gatt/mock_gatt_utils_ref.cc b/system/stack/test/gatt/mock_gatt_utils_ref.cc
index a7b9082824..f4df22397b 100644
--- a/system/stack/test/gatt/mock_gatt_utils_ref.cc
+++ b/system/stack/test/gatt/mock_gatt_utils_ref.cc
@@ -46,7 +46,6 @@ void gatt_update_app_use_link_flag(tGATT_IF /*gatt_if*/, tGATT_TCB* /*p_tcb*/, b
bool /*check_acl_link*/) {}
void gatts_proc_srv_chg_ind_ack(tGATT_TCB) {}
bool gatt_disconnect(tGATT_TCB* /*p_tcb*/) { return false; }
-void gatt_cancel_connect(const RawAddress& /*bd_addr*/, tBT_TRANSPORT /*transport*/) {}
tGATT_CH_STATE gatt_get_ch_state(tGATT_TCB* /*p_tcb*/) { return GATT_CH_CLOSE; }
void gatt_set_ch_state(tGATT_TCB* /*p_tcb*/, tGATT_CH_STATE /*ch_state*/) {}
diff --git a/system/test/mock/mock_stack_gatt_main.cc b/system/test/mock/mock_stack_gatt_main.cc
index 2c09b4a768..ead90a71d1 100644
--- a/system/test/mock/mock_stack_gatt_main.cc
+++ b/system/test/mock/mock_stack_gatt_main.cc
@@ -33,9 +33,6 @@ bool gatt_act_connect(tGATT_REG* /* p_reg */, const RawAddress& /* bd_addr */,
inc_func_call_count(__func__);
return false;
}
-void gatt_cancel_connect(const RawAddress& /* bd_addr */, tBT_TRANSPORT /* transport*/) {
- inc_func_call_count(__func__);
-}
bool gatt_disconnect(tGATT_TCB* /* p_tcb */) {
inc_func_call_count(__func__);
return false;