OSDN Git Service

Move btm_ble_increment_link_topology_mask l2c=>btm
authorChris Manton <cmanton@google.com>
Tue, 22 Sep 2020 02:13:47 +0000 (19:13 -0700)
committerChris Manton <cmanton@google.com>
Wed, 7 Oct 2020 22:26:55 +0000 (22:26 +0000)
Towards readable code

Bug: 163134718
Tag: #refactor
Test: act.py -tc BleCocTest
Test: ble paired 2 phones
Test: classic paired Bose SoundLink

Change-Id: I683d68030531bbc635c5f357a8cc356d925d40c8

stack/acl/ble_acl.cc
stack/l2cap/l2c_ble.cc

index f294ed3..9509996 100644 (file)
@@ -25,6 +25,7 @@
 
 void btm_ble_advertiser_notify_terminated_legacy(uint8_t status,
                                                  uint16_t connection_handle);
+void btm_ble_increment_link_topology_mask(uint8_t link_role);
 
 void acl_ble_connection_complete(const tBLE_BD_ADDR& address_with_type,
                                  uint16_t handle, uint8_t role, bool match,
@@ -34,6 +35,8 @@ void acl_ble_connection_complete(const tBLE_BD_ADDR& address_with_type,
   btm_ble_connected(address_with_type.bda, handle, HCI_ENCRYPT_MODE_DISABLED,
                     role, address_with_type.type, match);
 
+  btm_ble_increment_link_topology_mask(role);
+
   l2cble_conn_comp(handle, role, address_with_type.bda, address_with_type.type,
                    conn_interval, conn_latency, conn_timeout);
 
@@ -52,6 +55,8 @@ void acl_ble_enhanced_connection_complete(
   btm_ble_connected(address_with_type.bda, handle, HCI_ENCRYPT_MODE_DISABLED,
                     role, address_with_type.type, match);
 
+  btm_ble_increment_link_topology_mask(role);
+
   l2cble_conn_comp(handle, role, address_with_type.bda, address_with_type.type,
                    conn_interval, conn_latency, conn_timeout);
 
index b4b0fc6..bd19cc0 100644 (file)
@@ -41,7 +41,6 @@
 
 using base::StringPrintf;
 
-void btm_ble_increment_link_topology_mask(uint8_t link_role);
 tL2CAP_LE_RESULT_CODE btm_ble_start_sec_check(const RawAddress& bd_addr,
                                               uint16_t psm, bool is_originator,
                                               tBTM_SEC_CALLBACK* p_callback,
@@ -267,8 +266,6 @@ void l2cble_notify_le_connection(const RawAddress& bda) {
 void l2cble_conn_comp(uint16_t handle, uint8_t role, const RawAddress& bda,
                       tBLE_ADDR_TYPE type, uint16_t conn_interval,
                       uint16_t conn_latency, uint16_t conn_timeout) {
-  btm_ble_increment_link_topology_mask(role);
-
   // role == HCI_ROLE_MASTER => scanner completed connection
   // role == HCI_ROLE_SLAVE => advertiser completed connection