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

Commit 674ae7f5 authored by Hui Peng's avatar Hui Peng
Browse files

[Invisalign2] Move btm_ble.cc to btm_ble_sec.cc

toward separating ble security code

Bug: 301661850
Test: m com.android.btservices
Change-Id: I9fb87084fa8917171d19b8d7e455de208e6e9cb5
parent 21b51a29
Loading
Loading
Loading
Loading
+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 −12
Original line number Diff line number Diff line
@@ -94,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));
@@ -173,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.
@@ -1485,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);
  }