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

Commit 2324dace authored by Hui Peng's avatar Hui Peng Committed by Gerrit Code Review
Browse files

Merge changes I9fb87084,Ife34e144 into main

* changes:
  [Invisalign2] Move btm_ble.cc to btm_ble_sec.cc
  [Invisalign2] Move the following APIs to ble_api
parents d53037c5 674ae7f5
Loading
Loading
Loading
Loading
+0 −25
Original line number Diff line number Diff line
@@ -1120,31 +1120,6 @@ uint16_t BTM_BleReadDiscoverability();
 ******************************************************************************/
uint16_t BTM_BleReadConnectability();

/*******************************************************************************
 *
 * Function         BTM_BleConfigPrivacy
 *
 * Description      This function is called to enable or disable the privacy in
 *                  the local device.
 *
 * Parameters       enable: true to enable it; false to disable it.
 *
 * Returns          bool    privacy mode set success; otherwise failed.
 *
 ******************************************************************************/
bool BTM_BleConfigPrivacy(bool enable);

/*******************************************************************************
 *
 * Function         BTM_BleLocalPrivacyEnabled
 *
 * Description        Checks if local device supports private address
 *
 * Returns          Return true if local privacy is enabled else false
 *
 ******************************************************************************/
bool BTM_BleLocalPrivacyEnabled(void);

/**
 * This functions are called to configure the adv data payload filter condition
 */
+2 −2
Original line number Diff line number Diff line
@@ -238,7 +238,6 @@ cc_library_static {
        "arbiter/acl_arbiter.cc",
        "btm/ble_advertiser_hci_interface.cc",
        "btm/ble_scanner_hci_interface.cc",
        "btm/btm_ble.cc",
        "btm/btm_ble_addr.cc",
        "btm/btm_ble_adv_filter.cc",
        "btm/btm_ble_batchscan.cc",
@@ -247,6 +246,7 @@ cc_library_static {
        "btm/btm_ble_gap.cc",
        "btm/btm_ble_privacy.cc",
        "btm/btm_ble_scanner.cc",
        "btm/btm_ble_sec.cc",
        "btm/btm_client_interface.cc",
        "btm/btm_dev.cc",
        "btm/btm_devctl.cc",
@@ -1511,7 +1511,6 @@ cc_test {
        "acl/btm_pm.cc",
        "btm/ble_advertiser_hci_interface.cc",
        "btm/ble_scanner_hci_interface.cc",
        "btm/btm_ble.cc",
        "btm/btm_ble_addr.cc",
        "btm/btm_ble_adv_filter.cc",
        "btm/btm_ble_batchscan.cc",
@@ -1520,6 +1519,7 @@ cc_test {
        "btm/btm_ble_gap.cc",
        "btm/btm_ble_privacy.cc",
        "btm/btm_ble_scanner.cc",
        "btm/btm_ble_sec.cc",
        "btm/btm_client_interface.cc",
        "btm/btm_dev.cc",
        "btm/btm_devctl.cc",
+1 −1
Original line number Diff line number Diff line
@@ -105,7 +105,6 @@ source_set("stack") {
    "bnep/bnep_utils.cc",
    "btm/ble_advertiser_hci_interface.cc",
    "btm/ble_scanner_hci_interface.cc",
    "btm/btm_ble.cc",
    "btm/btm_ble_addr.cc",
    "btm/btm_ble_adv_filter.cc",
    "btm/btm_ble_batchscan.cc",
@@ -114,6 +113,7 @@ source_set("stack") {
    "btm/btm_ble_gap.cc",
    "btm/btm_ble_privacy.cc",
    "btm/btm_ble_scanner.cc",
    "btm/btm_ble_sec.cc",
    "btm/btm_client_interface.cc",
    "btm/btm_dev.cc",
    "btm/btm_devctl.cc",
+11 −16
Original line number Diff line number Diff line
@@ -65,10 +65,6 @@ bool btm_ble_init_pseudo_addr(tBTM_SEC_DEV_REC* p_dev_rec,
void gatt_notify_phy_updated(tHCI_STATUS status, uint16_t handle,
                             uint8_t tx_phy, uint8_t rx_phy);

#ifndef PROPERTY_BLE_PRIVACY_ENABLED
#define PROPERTY_BLE_PRIVACY_ENABLED "bluetooth.core.gap.le.privacy.enabled"
#endif

namespace {
constexpr char kBtmLogTag[] = "SEC";
}
@@ -98,7 +94,8 @@ void BTM_SecAddBleDevice(const RawAddress& bd_addr, tBT_DEVICE_TYPE dev_type,
    p_dev_rec->conn_params.peripheral_latency = BTM_BLE_CONN_PARAM_UNDEF;

    LOG_DEBUG("Device added, handle=0x%x, p_dev_rec=%p, bd_addr=%s",
              p_dev_rec->ble_hci_handle, p_dev_rec, ADDRESS_TO_LOGGABLE_CSTR(bd_addr));
              p_dev_rec->ble_hci_handle, p_dev_rec,
              ADDRESS_TO_LOGGABLE_CSTR(bd_addr));
  }

  memset(p_dev_rec->sec_bd_name, 0, sizeof(tBTM_BD_NAME));
@@ -177,8 +174,8 @@ void BTM_SecAddBleKey(const RawAddress& bd_addr, tBTM_LE_KEY_VALUE* p_le_key,
    return;
  }

  LOG_DEBUG("Adding BLE key device:%s key_type:%hhu", ADDRESS_TO_LOGGABLE_CSTR(bd_addr),
            key_type);
  LOG_DEBUG("Adding BLE key device:%s key_type:%hhu",
            ADDRESS_TO_LOGGABLE_CSTR(bd_addr), key_type);

  btm_sec_save_le_key(bd_addr, key_type, p_le_key, false);
  // Only set peer irk. Local irk is always the same.
@@ -1489,16 +1486,14 @@ void btm_ble_link_encrypted(const RawAddress& bd_addr, uint8_t encr_enable) {

  p_dev_rec->sec_state = BTM_SEC_STATE_IDLE;
  if (p_dev_rec->p_callback && enc_cback) {
    if (encr_enable)
      btm_sec_dev_rec_cback_event(p_dev_rec, BTM_SUCCESS, true);
    if (encr_enable) btm_sec_dev_rec_cback_event(p_dev_rec, BTM_SUCCESS, true);
    /* LTK missing on peripheral */
    else if (p_dev_rec->role_central && (p_dev_rec->sec_status == HCI_ERR_KEY_MISSING)) {
    else if (p_dev_rec->role_central &&
             (p_dev_rec->sec_status == HCI_ERR_KEY_MISSING)) {
      btm_sec_dev_rec_cback_event(p_dev_rec, BTM_ERR_KEY_MISSING, true);
    }
    else if (!(p_dev_rec->sec_flags & BTM_SEC_LE_LINK_KEY_KNOWN)) {
    } else if (!(p_dev_rec->sec_flags & BTM_SEC_LE_LINK_KEY_KNOWN)) {
      btm_sec_dev_rec_cback_event(p_dev_rec, BTM_FAILED_ON_SECURITY, true);
    }
    else if (p_dev_rec->role_central)
    } else if (p_dev_rec->role_central)
      btm_sec_dev_rec_cback_event(p_dev_rec, BTM_ERR_PROCESSING, true);
  }

+26 −0
Original line number Diff line number Diff line
@@ -580,4 +580,30 @@ void BTM_BlePeriodicSyncSetInfo(RawAddress addr, uint16_t service_data,
void BTM_BlePeriodicSyncTxParameters(RawAddress addr, uint8_t mode,
                                     uint16_t skip, uint16_t timeout,
                                     StartSyncCb syncCb);

/*******************************************************************************
 *
 * Function         BTM_BleConfigPrivacy
 *
 * Description      This function is called to enable or disable the privacy in
 *                  the local device.
 *
 * Parameters       enable: true to enable it; false to disable it.
 *
 * Returns          bool    privacy mode set success; otherwise failed.
 *
 ******************************************************************************/
bool BTM_BleConfigPrivacy(bool enable);

/*******************************************************************************
 *
 * Function         BTM_BleLocalPrivacyEnabled
 *
 * Description        Checks if local device supports private address
 *
 * Returns          Return true if local privacy is enabled else false
 *
 ******************************************************************************/
bool BTM_BleLocalPrivacyEnabled(void);

#endif
Loading