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

Commit 8133afd6 authored by Hui Peng's avatar Hui Peng Committed by Automerger Merge Worker
Browse files

Merge "[Invisalign2] Move tBTM_BOND_TYPE to btm_sec_api_types.h" into main am:...

Merge "[Invisalign2] Move tBTM_BOND_TYPE to btm_sec_api_types.h" into main am: 36c17efa am: a929becc am: 90b60bd2

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/2816366



Change-Id: Idc380086a05c4d8ebbe0fbde68ce62603daeb853
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 7a165a1e 90b60bd2
Loading
Loading
Loading
Loading
+13 −18
Original line number Original line Diff line number Diff line
@@ -146,7 +146,7 @@ struct btif_dm_pairing_cb_t {
  bt_bond_state_t state;
  bt_bond_state_t state;
  RawAddress static_bdaddr;
  RawAddress static_bdaddr;
  RawAddress bd_addr;
  RawAddress bd_addr;
  tBTM_SEC_DEV_REC::tBTM_BOND_TYPE bond_type;
  tBTM_BOND_TYPE bond_type;
  uint8_t pin_code_len;
  uint8_t pin_code_len;
  uint8_t is_ssp;
  uint8_t is_ssp;
  uint8_t auth_req;
  uint8_t auth_req;
@@ -565,7 +565,7 @@ static void bond_state_changed(bt_status_t status, const RawAddress& bd_addr,
    return;
    return;
  }
  }


  if (pairing_cb.bond_type == tBTM_SEC_DEV_REC::BOND_TYPE_TEMPORARY) {
  if (pairing_cb.bond_type == BOND_TYPE_TEMPORARY) {
    state = BT_BOND_STATE_NONE;
    state = BT_BOND_STATE_NONE;
  }
  }


@@ -1047,9 +1047,9 @@ static void btif_dm_ssp_cfm_req_evt(tBTA_DM_SP_CFM_REQ* p_ssp_cfm_req) {
      !(p_ssp_cfm_req->loc_auth_req & BTM_AUTH_BONDS) &&
      !(p_ssp_cfm_req->loc_auth_req & BTM_AUTH_BONDS) &&
      !(p_ssp_cfm_req->rmt_auth_req & BTM_AUTH_BONDS) &&
      !(p_ssp_cfm_req->rmt_auth_req & BTM_AUTH_BONDS) &&
      !(check_cod_hid_major(p_ssp_cfm_req->bd_addr, COD_HID_POINTING)))
      !(check_cod_hid_major(p_ssp_cfm_req->bd_addr, COD_HID_POINTING)))
    pairing_cb.bond_type = tBTM_SEC_DEV_REC::BOND_TYPE_TEMPORARY;
    pairing_cb.bond_type = BOND_TYPE_TEMPORARY;
  else
  else
    pairing_cb.bond_type = tBTM_SEC_DEV_REC::BOND_TYPE_PERSISTENT;
    pairing_cb.bond_type = BOND_TYPE_PERSISTENT;


  btm_set_bond_type_dev(p_ssp_cfm_req->bd_addr, pairing_cb.bond_type);
  btm_set_bond_type_dev(p_ssp_cfm_req->bd_addr, pairing_cb.bond_type);


@@ -1060,8 +1060,7 @@ static void btif_dm_ssp_cfm_req_evt(tBTA_DM_SP_CFM_REQ* p_ssp_cfm_req) {
    /* Pairing consent for JustWorks NOT needed if:
    /* Pairing consent for JustWorks NOT needed if:
     * 1. Incoming temporary pairing is detected
     * 1. Incoming temporary pairing is detected
     */
     */
    if (is_incoming &&
    if (is_incoming && pairing_cb.bond_type == BOND_TYPE_TEMPORARY) {
        pairing_cb.bond_type == tBTM_SEC_DEV_REC::BOND_TYPE_TEMPORARY) {
      LOG_VERBOSE("%s: Auto-accept JustWorks pairing for temporary incoming",
      LOG_VERBOSE("%s: Auto-accept JustWorks pairing for temporary incoming",
                  __func__);
                  __func__);
      btif_dm_ssp_reply(bd_addr, BT_SSP_VARIANT_CONSENT, true);
      btif_dm_ssp_reply(bd_addr, BT_SSP_VARIANT_CONSENT, true);
@@ -1156,7 +1155,7 @@ static void btif_dm_auth_cmpl_evt(tBTA_DM_AUTH_CMPL* p_auth_cmpl) {
        (p_auth_cmpl->key_type == HCI_LKEY_TYPE_AUTH_COMB) ||
        (p_auth_cmpl->key_type == HCI_LKEY_TYPE_AUTH_COMB) ||
        (p_auth_cmpl->key_type == HCI_LKEY_TYPE_CHANGED_COMB) ||
        (p_auth_cmpl->key_type == HCI_LKEY_TYPE_CHANGED_COMB) ||
        (p_auth_cmpl->key_type == HCI_LKEY_TYPE_AUTH_COMB_P_256) ||
        (p_auth_cmpl->key_type == HCI_LKEY_TYPE_AUTH_COMB_P_256) ||
        pairing_cb.bond_type == tBTM_SEC_DEV_REC::BOND_TYPE_PERSISTENT) {
        pairing_cb.bond_type == BOND_TYPE_PERSISTENT) {
      bt_status_t ret;
      bt_status_t ret;
      LOG_VERBOSE("%s: Storing link key. key_type=0x%x, bond_type=%d", __func__,
      LOG_VERBOSE("%s: Storing link key. key_type=0x%x, bond_type=%d", __func__,
                  p_auth_cmpl->key_type, pairing_cb.bond_type);
                  p_auth_cmpl->key_type, pairing_cb.bond_type);
@@ -1172,7 +1171,7 @@ static void btif_dm_auth_cmpl_evt(tBTA_DM_AUTH_CMPL* p_auth_cmpl) {
    } else {
    } else {
      LOG_VERBOSE("%s: Temporary key. Not storing. key_type=0x%x, bond_type=%d",
      LOG_VERBOSE("%s: Temporary key. Not storing. key_type=0x%x, bond_type=%d",
                  __func__, p_auth_cmpl->key_type, pairing_cb.bond_type);
                  __func__, p_auth_cmpl->key_type, pairing_cb.bond_type);
      if (pairing_cb.bond_type == tBTM_SEC_DEV_REC::BOND_TYPE_TEMPORARY) {
      if (pairing_cb.bond_type == BOND_TYPE_TEMPORARY) {
        LOG_VERBOSE("%s: sending BT_BOND_STATE_NONE for Temp pairing",
        LOG_VERBOSE("%s: sending BT_BOND_STATE_NONE for Temp pairing",
                    __func__);
                    __func__);
        btif_storage_remove_bonded_device(&bd_addr);
        btif_storage_remove_bonded_device(&bd_addr);
@@ -2126,7 +2125,7 @@ void BTIF_dm_enable() {
  }
  }
  /* clear control blocks */
  /* clear control blocks */
  pairing_cb = {};
  pairing_cb = {};
  pairing_cb.bond_type = tBTM_SEC_DEV_REC::BOND_TYPE_PERSISTENT;
  pairing_cb.bond_type = BOND_TYPE_PERSISTENT;


  // Enable address consolidation.
  // Enable address consolidation.
  btif_storage_load_le_devices();
  btif_storage_load_le_devices();
@@ -2180,8 +2179,7 @@ void btif_dm_sec_evt(tBTA_DM_SEC_EVT event, tBTA_DM_SEC* p_data) {
    case BTA_DM_BOND_CANCEL_CMPL_EVT:
    case BTA_DM_BOND_CANCEL_CMPL_EVT:
      if (is_bonding_or_sdp()) {
      if (is_bonding_or_sdp()) {
        bd_addr = pairing_cb.bd_addr;
        bd_addr = pairing_cb.bd_addr;
        btm_set_bond_type_dev(pairing_cb.bd_addr,
        btm_set_bond_type_dev(pairing_cb.bd_addr, BOND_TYPE_UNKNOWN);
                              tBTM_SEC_DEV_REC::BOND_TYPE_UNKNOWN);
        bond_state_changed((bt_status_t)p_data->bond_cancel_cmpl.result,
        bond_state_changed((bt_status_t)p_data->bond_cancel_cmpl.result,
                           bd_addr, BT_BOND_STATE_NONE);
                           bd_addr, BT_BOND_STATE_NONE);
      }
      }
@@ -2196,8 +2194,7 @@ void btif_dm_sec_evt(tBTA_DM_SEC_EVT event, tBTA_DM_SEC* p_data) {


    case BTA_DM_DEV_UNPAIRED_EVT:
    case BTA_DM_DEV_UNPAIRED_EVT:
      bd_addr = p_data->dev_unpair.bd_addr;
      bd_addr = p_data->dev_unpair.bd_addr;
      btm_set_bond_type_dev(p_data->dev_unpair.bd_addr,
      btm_set_bond_type_dev(p_data->dev_unpair.bd_addr, BOND_TYPE_UNKNOWN);
                            tBTM_SEC_DEV_REC::BOND_TYPE_UNKNOWN);


      GetInterfaceToProfiles()->removeDeviceFromProfiles(bd_addr);
      GetInterfaceToProfiles()->removeDeviceFromProfiles(bd_addr);
      btif_storage_remove_bonded_device(&bd_addr);
      btif_storage_remove_bonded_device(&bd_addr);
@@ -2383,8 +2380,7 @@ void btif_dm_acl_evt(tBTA_DM_ACL_EVT event, tBTA_DM_ACL* p_data) {


    case BTA_DM_LINK_DOWN_EVT: {
    case BTA_DM_LINK_DOWN_EVT: {
      bd_addr = p_data->link_down.bd_addr;
      bd_addr = p_data->link_down.bd_addr;
      btm_set_bond_type_dev(p_data->link_down.bd_addr,
      btm_set_bond_type_dev(p_data->link_down.bd_addr, BOND_TYPE_UNKNOWN);
                            tBTM_SEC_DEV_REC::BOND_TYPE_UNKNOWN);
      GetInterfaceToProfiles()->onLinkDown(bd_addr);
      GetInterfaceToProfiles()->onLinkDown(bd_addr);


      bt_conn_direction_t direction;
      bt_conn_direction_t direction;
@@ -3490,8 +3486,7 @@ static void btif_dm_ble_auth_cmpl_evt(tBTA_DM_AUTH_CMPL* p_auth_cmpl) {
      btif_storage_set_remote_addr_type(&bd_addr, p_auth_cmpl->addr_type);
      btif_storage_set_remote_addr_type(&bd_addr, p_auth_cmpl->addr_type);


    /* Test for temporary bonding */
    /* Test for temporary bonding */
    if (btm_get_bond_type_dev(bd_addr) ==
    if (btm_get_bond_type_dev(bd_addr) == BOND_TYPE_TEMPORARY) {
        tBTM_SEC_DEV_REC::BOND_TYPE_TEMPORARY) {
      LOG_VERBOSE("%s: sending BT_BOND_STATE_NONE for Temp pairing", __func__);
      LOG_VERBOSE("%s: sending BT_BOND_STATE_NONE for Temp pairing", __func__);
      btif_storage_remove_bonded_device(&bd_addr);
      btif_storage_remove_bonded_device(&bd_addr);
      state = BT_BOND_STATE_NONE;
      state = BT_BOND_STATE_NONE;
@@ -3690,7 +3685,7 @@ static void btif_dm_ble_sec_req_evt(tBTA_DM_BLE_SEC_REQ* p_ble_req,


  bond_state_changed(BT_STATUS_SUCCESS, bd_addr, BT_BOND_STATE_BONDING);
  bond_state_changed(BT_STATUS_SUCCESS, bd_addr, BT_BOND_STATE_BONDING);


  pairing_cb.bond_type = tBTM_SEC_DEV_REC::BOND_TYPE_PERSISTENT;
  pairing_cb.bond_type = BOND_TYPE_PERSISTENT;
  pairing_cb.is_le_only = true;
  pairing_cb.is_le_only = true;
  pairing_cb.is_le_nc = false;
  pairing_cb.is_le_nc = false;
  pairing_cb.is_ssp = true;
  pairing_cb.is_ssp = true;
+1 −1
Original line number Original line Diff line number Diff line
@@ -1645,7 +1645,7 @@ tBTM_STATUS btm_proc_smp_cback(tSMP_EVT event, const RawAddress& bd_addr,
          if (res == BTM_SUCCESS) {
          if (res == BTM_SUCCESS) {
            p_dev_rec->sec_state = BTM_SEC_STATE_IDLE;
            p_dev_rec->sec_state = BTM_SEC_STATE_IDLE;


            if (p_dev_rec->bond_type != tBTM_SEC_DEV_REC::BOND_TYPE_TEMPORARY) {
            if (p_dev_rec->bond_type != BOND_TYPE_TEMPORARY) {
              // Add all bonded device into resolving list if IRK is available.
              // Add all bonded device into resolving list if IRK is available.
              btm_ble_resolving_list_load_dev(*p_dev_rec);
              btm_ble_resolving_list_load_dev(*p_dev_rec);
            } else if (p_dev_rec->ble_hci_handle == HCI_INVALID_HANDLE) {
            } else if (p_dev_rec->ble_hci_handle == HCI_INVALID_HANDLE) {
+5 −6
Original line number Original line Diff line number Diff line
@@ -104,7 +104,7 @@ bool BTM_SecAddDevice(const RawAddress& bd_addr, DEV_CLASS dev_class,
     * bond state for an existing device here? This logic should be verified
     * bond state for an existing device here? This logic should be verified
     * as part of a larger refactor.
     * as part of a larger refactor.
     */
     */
    p_dev_rec->bond_type = tBTM_SEC_DEV_REC::BOND_TYPE_UNKNOWN;
    p_dev_rec->bond_type = BOND_TYPE_UNKNOWN;
  }
  }


  if (dev_class) memcpy(p_dev_rec->dev_class, dev_class, DEV_CLASS_LEN);
  if (dev_class) memcpy(p_dev_rec->dev_class, dev_class, DEV_CLASS_LEN);
@@ -639,7 +639,7 @@ tBTM_SEC_DEV_REC* btm_sec_allocate_dev_rec(void) {


  // Initialize defaults
  // Initialize defaults
  p_dev_rec->sec_flags = BTM_SEC_IN_USE;
  p_dev_rec->sec_flags = BTM_SEC_IN_USE;
  p_dev_rec->bond_type = tBTM_SEC_DEV_REC::BOND_TYPE_UNKNOWN;
  p_dev_rec->bond_type = BOND_TYPE_UNKNOWN;
  p_dev_rec->timestamp = btm_sec_cb.dev_rec_count++;
  p_dev_rec->timestamp = btm_sec_cb.dev_rec_count++;
  p_dev_rec->rmt_io_caps = BTM_IO_CAP_UNKNOWN;
  p_dev_rec->rmt_io_caps = BTM_IO_CAP_UNKNOWN;
  p_dev_rec->suggested_tx_octets = 0;
  p_dev_rec->suggested_tx_octets = 0;
@@ -657,11 +657,10 @@ tBTM_SEC_DEV_REC* btm_sec_allocate_dev_rec(void) {
 * Returns          The device bond type if known, otherwise BOND_TYPE_UNKNOWN
 * Returns          The device bond type if known, otherwise BOND_TYPE_UNKNOWN
 *
 *
 ******************************************************************************/
 ******************************************************************************/
tBTM_SEC_DEV_REC::tBTM_BOND_TYPE btm_get_bond_type_dev(
tBTM_BOND_TYPE btm_get_bond_type_dev(const RawAddress& bd_addr) {
    const RawAddress& bd_addr) {
  tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev(bd_addr);
  tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev(bd_addr);


  if (p_dev_rec == NULL) return tBTM_SEC_DEV_REC::BOND_TYPE_UNKNOWN;
  if (p_dev_rec == NULL) return BOND_TYPE_UNKNOWN;


  return p_dev_rec->bond_type;
  return p_dev_rec->bond_type;
}
}
@@ -677,7 +676,7 @@ tBTM_SEC_DEV_REC::tBTM_BOND_TYPE btm_get_bond_type_dev(
 *
 *
 ******************************************************************************/
 ******************************************************************************/
bool btm_set_bond_type_dev(const RawAddress& bd_addr,
bool btm_set_bond_type_dev(const RawAddress& bd_addr,
                           tBTM_SEC_DEV_REC::tBTM_BOND_TYPE bond_type) {
                           tBTM_BOND_TYPE bond_type) {
  tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev(bd_addr);
  tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev(bd_addr);


  if (p_dev_rec == NULL) return false;
  if (p_dev_rec == NULL) return false;
+2 −4
Original line number Original line Diff line number Diff line
@@ -181,8 +181,7 @@ tBTM_SEC_DEV_REC* btm_sec_allocate_dev_rec(void);
 * Returns          The device bond type if known, otherwise BOND_TYPE_UNKNOWN
 * Returns          The device bond type if known, otherwise BOND_TYPE_UNKNOWN
 *
 *
 ******************************************************************************/
 ******************************************************************************/
tBTM_SEC_DEV_REC::tBTM_BOND_TYPE btm_get_bond_type_dev(
tBTM_BOND_TYPE btm_get_bond_type_dev(const RawAddress& bd_addr);
    const RawAddress& bd_addr);


/*******************************************************************************
/*******************************************************************************
 *
 *
@@ -194,8 +193,7 @@ tBTM_SEC_DEV_REC::tBTM_BOND_TYPE btm_get_bond_type_dev(
 * Returns          true on success, otherwise false
 * Returns          true on success, otherwise false
 *
 *
 ******************************************************************************/
 ******************************************************************************/
bool btm_set_bond_type_dev(const RawAddress& bd_addr,
bool btm_set_bond_type_dev(const RawAddress& bd_addr, tBTM_BOND_TYPE bond_type);
                           tBTM_SEC_DEV_REC::tBTM_BOND_TYPE bond_type);


/*******************************************************************************
/*******************************************************************************
 *
 *
+1 −1
Original line number Original line Diff line number Diff line
@@ -4032,7 +4032,7 @@ void btm_sec_disconnected(uint16_t handle, tHCI_REASON reason,
          BTM_SEC_16_DIGIT_PIN_AUTHED);
          BTM_SEC_16_DIGIT_PIN_AUTHED);


    // Remove temporary key.
    // Remove temporary key.
    if (p_dev_rec->bond_type == tBTM_SEC_DEV_REC::BOND_TYPE_TEMPORARY)
    if (p_dev_rec->bond_type == BOND_TYPE_TEMPORARY)
      p_dev_rec->sec_flags &= ~(BTM_SEC_LINK_KEY_KNOWN);
      p_dev_rec->sec_flags &= ~(BTM_SEC_LINK_KEY_KNOWN);
  }
  }


Loading