From b1a1f6c9c82f196e28d4d85ba09de05842733805 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Mon, 24 Aug 2020 14:28:07 -0700 Subject: [PATCH] HF Client: Flatten sec mask for outgoing connection Bug: 159815595 Tag: #refactor Test: compile & verify basic functions working Change-Id: I0156d12087a649fa1fdff5de181cf68667444195 --- bta/hf_client/bta_hf_client_act.cc | 1 - bta/hf_client/bta_hf_client_api.cc | 4 +--- bta/hf_client/bta_hf_client_int.h | 2 -- bta/hf_client/bta_hf_client_main.cc | 1 - bta/hf_client/bta_hf_client_rfc.cc | 2 +- bta/include/bta_hf_client_api.h | 3 +-- btif/src/btif_hf_client.cc | 8 +------- 7 files changed, 4 insertions(+), 17 deletions(-) diff --git a/bta/hf_client/bta_hf_client_act.cc b/bta/hf_client/bta_hf_client_act.cc index e3f25f61c..768d57ba3 100644 --- a/bta/hf_client/bta_hf_client_act.cc +++ b/bta/hf_client/bta_hf_client_act.cc @@ -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. */ diff --git a/bta/hf_client/bta_hf_client_api.cc b/bta/hf_client/bta_hf_client_api.cc index eb3bd6bd4..12009909d 100644 --- a/bta/hf_client/bta_hf_client_api.cc +++ b/bta/hf_client/bta_hf_client_api.cc @@ -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); } diff --git a/bta/hf_client/bta_hf_client_int.h b/bta/hf_client/bta_hf_client_int.h index 32a7ef403..a685c7646 100755 --- a/bta/hf_client/bta_hf_client_int.h +++ b/bta/hf_client/bta_hf_client_int.h @@ -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 */ diff --git a/bta/hf_client/bta_hf_client_main.cc b/bta/hf_client/bta_hf_client_main.cc index 85f1edf5d..052c89984 100644 --- a/bta/hf_client/bta_hf_client_main.cc +++ b/bta/hf_client/bta_hf_client_main.cc @@ -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); } } diff --git a/bta/hf_client/bta_hf_client_rfc.cc b/bta/hf_client/bta_hf_client_rfc.cc index 9e081d9fe..dfa2f03e0 100644 --- a/bta/hf_client/bta_hf_client_rfc.cc +++ b/bta/hf_client/bta_hf_client_rfc.cc @@ -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); diff --git a/bta/include/bta_hf_client_api.h b/bta/include/bta_hf_client_api.h index 91c1b7ff1..ffe864e72 100755 --- a/bta/include/bta_hf_client_api.h +++ b/bta/include/bta_hf_client_api.h @@ -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); /******************************************************************************* * diff --git a/btif/src/btif_hf_client.cc b/btif/src/btif_hf_client.cc index c649e9346..eba5765a9 100755 --- a/btif/src/btif_hf_client.cc +++ b/btif/src/btif_hf_client.cc @@ -44,13 +44,11 @@ #define LOG_TAG "bt_btif_hfc" -#include #include #include #include -#include "bt_utils.h" #include "bta_hf_client_api.h" #include "btif_common.h" #include "btif_profile_queue.h" @@ -66,10 +64,6 @@ #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; } -- 2.11.0