Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c250a09a authored by Hansong Zhang's avatar Hansong Zhang
Browse files

Clean up btm_int usage in btif, bta

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working

Change-Id: Ic10c01bd0333230a10594fa6950b56d44e8c30bd
parent 39c7b56b
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -35,13 +35,10 @@
#include "a2dp_sbc.h"
#include "avdt_api.h"
#include "avrcp_service.h"
#include "bt_utils.h"
#include "bta_av_int.h"
#include "btif/include/btif_av_co.h"
#include "btif/include/btif_config.h"
#include "btif/include/btif_storage.h"
#include "btm_int.h"
#include "device/include/controller.h"
#include "device/include/interop.h"
#include "l2c_api.h"
#include "l2cdefs.h"
@@ -53,9 +50,6 @@
#if (BTA_AR_INCLUDED == TRUE)
#include "bta_ar_api.h"
#endif
#include "btif/include/btif_av.h"
#include "btif/include/btif_hf.h"
#include "stack/include/acl_api.h"

/*****************************************************************************
 *  Constants
+1 −16
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@
#include "bta_sys.h"
#include "bta_sys_int.h"
#include "btm_api.h"
#include "btm_int.h"
#include "osi/include/osi.h"
#include "stack/include/btu.h"
#include "utl.h"
@@ -763,18 +762,4 @@ void BTA_VendorInit(void) { APPL_TRACE_API("BTA_VendorInit"); }
 * Returns          void
 *
 ******************************************************************************/
void BTA_VendorCleanup(void) {
  tBTM_BLE_VSC_CB cmn_ble_vsc_cb;
  BTM_BleGetVendorCapabilities(&cmn_ble_vsc_cb);

  if (cmn_ble_vsc_cb.max_filter > 0) {
    btm_ble_adv_filter_cleanup();
#if (BLE_PRIVACY_SPT == TRUE)
    btm_ble_resolving_list_cleanup();
#endif
  }

  if (cmn_ble_vsc_cb.tot_scan_results_strg > 0) btm_ble_batchscan_cleanup();

  if (cmn_ble_vsc_cb.adv_inst_max > 0) btm_ble_multi_adv_cleanup();
}
void BTA_VendorCleanup(void) { BTM_VendorCleanup(); }
+0 −1
Original line number Diff line number Diff line
@@ -35,7 +35,6 @@

#include "bt_common.h"
#include "bta_gattc_int.h"
#include "bta_sys.h"
#include "btm_api.h"
#include "btm_ble_api.h"
#include "btm_int.h"
+6 −12
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@

#include "bta_gatt_api.h"
#include "bta_gatt_queue.h"
#include "btm_int.h"
#include "btm_api.h"
#include "device/include/controller.h"
#include "embdrv/g722/g722_enc_dec.h"
#include "gap_api.h"
@@ -391,9 +391,7 @@ class HearingAidImpl : public HearingAid {
      hearingDevice->connection_update_status = AWAITING;
    }

    tACL_CONN* p_acl = btm_bda_to_acl(address, BT_TRANSPORT_LE);
    if (p_acl != nullptr && controller_get_interface()->supports_ble_2m_phy() &&
        HCI_LE_2M_PHY_SUPPORTED(p_acl->peer_le_features)) {
    if (controller_get_interface()->supports_ble_2m_phy()) {
      LOG(INFO) << address << " set preferred PHY to 2M";
      BTM_BleSetPhy(address, PHY_LE_2M, PHY_LE_2M, 0);
    }
@@ -402,15 +400,11 @@ class HearingAidImpl : public HearingAid {
    // TODO(jpawlowski: for 16khz only 87 is required, optimize
    BTM_SetBleDataLength(address, 167);

    tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev(address);
    if (p_dev_rec) {
      if (p_dev_rec->sec_state == BTM_SEC_STATE_ENCRYPTING ||
          p_dev_rec->sec_state == BTM_SEC_STATE_AUTHENTICATING) {
    if (BTM_SecIsSecurityPending(address)) {
      /* if security collision happened, wait for encryption done
       * (BTA_GATTC_ENC_CMPL_CB_EVT) */
      return;
    }
    }

    /* verify bond */
    uint8_t sec_flag = 0;
+5 −15
Original line number Diff line number Diff line
@@ -27,14 +27,12 @@
#include <string.h>

#include <base/bind.h>
#include <base/callback.h>

#include "bta_gatt_api.h"
#include "bta_gatt_queue.h"
#include "bta_hh_co.h"
#include "btm_api.h"
#include "btm_ble_api.h"
#include "btm_int.h"
#include "device/include/interop.h"
#include "osi/include/log.h"
#include "srvc_api.h"
@@ -50,9 +48,6 @@ using std::vector;

#define BTA_HH_APP_ID_LE 0xff

#define BTA_HH_LE_RPT_TYPE_VALID(x) \
  ((x) <= BTA_LE_HID_RPT_FEATURE && (x) >= BTA_LE_HID_RPT_INPUT)

#define BTA_HH_LE_PROTO_BOOT_MODE 0x00
#define BTA_HH_LE_PROTO_REPORT_MODE 0x01

@@ -1078,17 +1073,12 @@ void bta_hh_clear_service_cache(tBTA_HH_DEV_CB* p_cb) {
void bta_hh_start_security(tBTA_HH_DEV_CB* p_cb,
                           UNUSED_ATTR tBTA_HH_DATA* p_buf) {
  uint8_t sec_flag = 0;
  tBTM_SEC_DEV_REC* p_dev_rec;

  p_dev_rec = btm_find_dev(p_cb->addr);
  if (p_dev_rec) {
    if (p_dev_rec->sec_state == BTM_SEC_STATE_ENCRYPTING ||
        p_dev_rec->sec_state == BTM_SEC_STATE_AUTHENTICATING) {
  if (BTM_SecIsSecurityPending(p_cb->addr)) {
    /* if security collision happened, wait for encryption done */
    p_cb->security_pending = true;
    return;
  }
  }

  /* verify bond */
  BTM_GetSecurityFlagsByTransport(p_cb->addr, &sec_flag, BT_TRANSPORT_LE);
Loading