OSDN Git Service

Remove bta_hh_is_le_device check
authorChris Manton <cmanton@google.com>
Fri, 30 Apr 2021 20:00:54 +0000 (13:00 -0700)
committerChris Manton <cmanton@google.com>
Sat, 8 May 2021 05:14:50 +0000 (05:14 +0000)
Directly access BTM for le information and set state
accordingly.

Bug: 183374320
Test: gd/cert/run
Tag: #refactor

Change-Id: Ifca04d19bcd1a1892a7356bb3436923d77ba1350

bta/hh/bta_hh_act.cc
bta/hh/bta_hh_int.h
bta/hh/bta_hh_le.cc

index 0f8c8ac..8950ca0 100644 (file)
@@ -314,7 +314,8 @@ void bta_hh_start_sdp(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) {
   p_cb->mode = p_data->api_conn.mode;
   bta_hh_cb.p_cur = p_cb;
 
-  if (bta_hh_is_le_device(p_cb, p_data->api_conn.bd_addr)) {
+  if (BTM_UseLeLink(p_data->api_conn.bd_addr)) {
+    p_cb->is_le_device = true;
     bta_hh_le_open_conn(p_cb, p_data->api_conn.bd_addr);
     return;
   }
@@ -932,7 +933,8 @@ void bta_hh_maint_dev_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) {
       dev_info.bda = p_dev_info->bda;
       /* initialize callback data */
       if (p_cb->hid_handle == BTA_HH_INVALID_HANDLE) {
-        if (bta_hh_is_le_device(p_cb, p_data->api_conn.bd_addr)) {
+        if (BTM_UseLeLink(p_data->api_conn.bd_addr)) {
+          p_cb->is_le_device = true;
           dev_info.handle = bta_hh_le_add_device(p_cb, p_dev_info);
           if (dev_info.handle != BTA_HH_INVALID_HANDLE)
             dev_info.status = BTA_HH_OK;
index feb3e36..87e2908 100644 (file)
@@ -342,8 +342,6 @@ extern tBTA_HH_STATUS bta_hh_read_ssr_param(const RawAddress& bd_addr,
 extern void bta_hh_le_enable(void);
 extern bool bta_hh_le_is_hh_gatt_if(tGATT_IF client_if);
 extern void bta_hh_le_deregister(void);
-extern bool bta_hh_is_le_device(tBTA_HH_DEV_CB* p_cb,
-                                const RawAddress& remote_bda);
 extern void bta_hh_le_open_conn(tBTA_HH_DEV_CB* p_cb,
                                 const RawAddress& remote_bda);
 extern void bta_hh_le_api_disc_act(tBTA_HH_DEV_CB* p_cb);
index 83c5e4b..4a8c1d1 100644 (file)
@@ -206,21 +206,6 @@ bool bta_hh_le_is_hh_gatt_if(tGATT_IF client_if) {
  ******************************************************************************/
 void bta_hh_le_deregister(void) { BTA_GATTC_AppDeregister(bta_hh_cb.gatt_if); }
 
-/*******************************************************************************
- *
- * Function         bta_hh_is_le_device
- *
- * Description      Check to see if the remote device is a LE only device
- *
- * Parameters:
- *
- ******************************************************************************/
-bool bta_hh_is_le_device(tBTA_HH_DEV_CB* p_cb, const RawAddress& remote_bda) {
-  p_cb->is_le_device = BTM_UseLeLink(remote_bda);
-
-  return p_cb->is_le_device;
-}
-
 /******************************************************************************
  *
  * Function         bta_hh_le_get_le_cb