OSDN Git Service

HF Client: Flatten sec mask for outgoing connection
authorHansong Zhang <hsz@google.com>
Mon, 24 Aug 2020 21:28:07 +0000 (14:28 -0700)
committerHansong Zhang <hsz@google.com>
Tue, 25 Aug 2020 05:50:05 +0000 (22:50 -0700)
Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I0156d12087a649fa1fdff5de181cf68667444195

bta/hf_client/bta_hf_client_act.cc
bta/hf_client/bta_hf_client_api.cc
bta/hf_client/bta_hf_client_int.h
bta/hf_client/bta_hf_client_main.cc
bta/hf_client/bta_hf_client_rfc.cc
bta/include/bta_hf_client_api.h
btif/src/btif_hf_client.cc

index e3f25f6..768d57b 100644 (file)
@@ -99,7 +99,6 @@ void bta_hf_client_start_open(tBTA_HF_CLIENT_DATA* p_data) {
   /* store parameters */
   if (p_data) {
     client_cb->peer_addr = p_data->api_open.bd_addr;
-    client_cb->cli_sec_mask = p_data->api_open.sec_mask;
   }
 
   /* Check if RFCOMM has any incoming connection to avoid collision. */
index eb3bd6b..1200990 100644 (file)
@@ -76,8 +76,7 @@ void BTA_HfClientDisable(void) { bta_hf_client_api_disable(); }
  * Returns          void
  *
  ******************************************************************************/
-void BTA_HfClientOpen(const RawAddress& bd_addr, tBTA_SEC sec_mask,
-                      uint16_t* p_handle) {
+void BTA_HfClientOpen(const RawAddress& bd_addr, uint16_t* p_handle) {
   APPL_TRACE_DEBUG("%s", __func__);
   tBTA_HF_CLIENT_API_OPEN* p_buf =
       (tBTA_HF_CLIENT_API_OPEN*)osi_malloc(sizeof(tBTA_HF_CLIENT_API_OPEN));
@@ -90,7 +89,6 @@ void BTA_HfClientOpen(const RawAddress& bd_addr, tBTA_SEC sec_mask,
   p_buf->hdr.event = BTA_HF_CLIENT_API_OPEN_EVT;
   p_buf->hdr.layer_specific = *p_handle;
   p_buf->bd_addr = bd_addr;
-  p_buf->sec_mask = sec_mask;
 
   bta_sys_sendmsg(p_buf);
 }
index 32a7ef4..a685c76 100755 (executable)
@@ -109,7 +109,6 @@ typedef struct {
   BT_HDR hdr;
   RawAddress bd_addr;
   uint16_t* handle;
-  tBTA_SEC sec_mask;
 } tBTA_HF_CLIENT_API_OPEN;
 
 /* data type for BTA_HF_CLIENT_DISC_RESULT_EVT */
@@ -167,7 +166,6 @@ typedef struct {
   RawAddress peer_addr;         /* peer bd address */
   tSDP_DISCOVERY_DB* p_disc_db; /* pointer to discovery database */
   uint16_t conn_handle;         /* RFCOMM handle of connected service */
-  tBTA_SEC cli_sec_mask;        /* client security mask */
   tBTA_HF_CLIENT_PEER_FEAT peer_features; /* peer device features */
   tBTA_HF_CLIENT_CHLD_FEAT chld_features; /* call handling features */
   uint16_t peer_version;                  /* profile version of peer device */
index 85f1edf..052c899 100644 (file)
@@ -330,7 +330,6 @@ void bta_hf_client_resume_open(tBTA_HF_CLIENT_CB* client_cb) {
     tBTA_HF_CLIENT_DATA msg;
     msg.hdr.layer_specific = client_cb->handle;
     msg.api_open.bd_addr = client_cb->peer_addr;
-    msg.api_open.sec_mask = client_cb->cli_sec_mask;
     bta_hf_client_start_open(&msg);
   }
 }
index 9e081d9..dfa2f03 100644 (file)
@@ -244,7 +244,7 @@ void bta_hf_client_rfc_do_open(tBTA_HF_CLIENT_DATA* p_data) {
           UUID_SERVCLASS_HF_HANDSFREE, client_cb->peer_scn, false,
           BTA_HF_CLIENT_MTU, client_cb->peer_addr, &(client_cb->conn_handle),
           bta_hf_client_mgmt_cback, BTM_SEC_SERVICE_HF_HANDSFREE,
-          client_cb->cli_sec_mask) == PORT_SUCCESS) {
+          BTA_SEC_AUTHENTICATE | BTA_SEC_ENCRYPT) == PORT_SUCCESS) {
     bta_hf_client_setup_port(client_cb->conn_handle);
     APPL_TRACE_DEBUG("bta_hf_client_rfc_do_open : conn_handle = %d",
                      client_cb->conn_handle);
index 91c1b7f..ffe864e 100755 (executable)
@@ -317,8 +317,7 @@ void BTA_HfClientDisable(void);
  * Returns          void
  *
  ******************************************************************************/
-void BTA_HfClientOpen(const RawAddress& bd_addr, tBTA_SEC sec_mask,
-                      uint16_t* p_handle);
+void BTA_HfClientOpen(const RawAddress& bd_addr, uint16_t* p_handle);
 
 /*******************************************************************************
  *
index c649e93..eba5765 100755 (executable)
 
 #define LOG_TAG "bt_btif_hfc"
 
-#include <stdlib.h>
 #include <string.h>
 
 #include <hardware/bluetooth.h>
 #include <hardware/bt_hf_client.h>
 
-#include "bt_utils.h"
 #include "bta_hf_client_api.h"
 #include "btif_common.h"
 #include "btif_profile_queue.h"
 #define BTIF_HF_CLIENT_SERVICE_NAME ("Handsfree")
 #endif
 
-#ifndef BTIF_HF_CLIENT_SECURITY
-#define BTIF_HF_CLIENT_SECURITY (BTA_SEC_AUTHENTICATE | BTA_SEC_ENCRYPT)
-#endif
-
 #ifndef BTIF_HF_CLIENT_FEATURES
 #define BTIF_HF_CLIENT_FEATURES                                                \
   (BTA_HF_CLIENT_FEAT_ECNR | BTA_HF_CLIENT_FEAT_3WAY |                         \
@@ -314,7 +308,7 @@ static bt_status_t connect_int(RawAddress* bd_addr, uint16_t uuid) {
    * The handle is valid until we have called BTA_HfClientClose or the LL
    * has notified us of channel close due to remote closing, error etc.
    */
-  BTA_HfClientOpen(cb->peer_bda, BTIF_HF_CLIENT_SECURITY, &cb->handle);
+  BTA_HfClientOpen(cb->peer_bda, &cb->handle);
 
   return BT_STATUS_SUCCESS;
 }