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

Commit 5a7584b3 authored by Himanshu Rawat's avatar Himanshu Rawat
Browse files

Don't remove the HOGP device if remote device does not have LTK.

HOGP host removes the bonded device if encryption fails due to "Pin or Key Missing" error. This behavior was introduced for a remote control device which would frequently forget the LTK.

Bug: 264516467
Change-Id: If751f10b46aa5889629f64dc0199caefc831d5ed
Test: Remove bond information from the peripheral device before reconnection
parent 52e7d78e
Loading
Loading
Loading
Loading
+0 −11
Original line number Diff line number Diff line
@@ -4578,17 +4578,6 @@ static void bta_dm_ctrl_features_rd_cmpl_cback(tHCI_STATUS result) {
}
#endif /* BLE_VND_INCLUDED */

void bta_dm_process_delete_key_RC_to_unpair(const RawAddress& bd_addr)
{
    LOG_WARN("RC key missing");
    tBTA_DM_SEC param = {
        .delete_key_RC_to_unpair = {
            .bd_addr = bd_addr,
        },
    };
    bta_dm_cb.p_sec_cback(BTA_DM_REPORT_BONDING_EVT, &param);
}

/*******************************************************************************
 *
 * Function         bta_dm_ble_subrate_request
+1 −2
Original line number Diff line number Diff line
@@ -80,7 +80,6 @@ static void bta_hh_le_add_dev_bg_conn(tBTA_HH_DEV_CB* p_cb, bool check_bond);
static void bta_hh_process_cache_rpt(tBTA_HH_DEV_CB* p_cb,
                                     tBTA_HH_RPT_CACHE_ENTRY* p_rpt_cache,
                                     uint8_t num_rpt);
extern void bta_dm_process_delete_key_RC_to_unpair(const RawAddress& bd_addr);

static const char* bta_hh_le_rpt_name[4] = {"UNKNOWN", "INPUT", "OUTPUT",
                                            "FEATURE"};
@@ -1009,7 +1008,7 @@ void bta_hh_security_cmpl(tBTA_HH_DEV_CB* p_cb,
    LOG_ERROR("Received encryption failed status:%s btm_status:%s",
              bta_hh_status_text(p_cb->status).c_str(),
              btm_status_text(p_cb->btm_status).c_str());
    bta_dm_process_delete_key_RC_to_unpair(p_cb->addr);
    bta_hh_le_api_disc_act(p_cb);
  } else {
    LOG_ERROR("Encryption failed status:%s btm_status:%s",
              bta_hh_status_text(p_cb->status).c_str(),
+0 −9
Original line number Diff line number Diff line
@@ -2283,15 +2283,6 @@ static void btif_dm_upstreams_evt(uint16_t event, char* p_param) {
    case BTA_DM_LE_FEATURES_READ:
      btif_get_adapter_property(BT_PROPERTY_LOCAL_LE_FEATURES);
      break;
    /* add case for HANDLE_KEY_MISSING */
    case BTA_DM_REPORT_BONDING_EVT:
      LOG_WARN("Received encryption failed: Report bonding firstly.");
      bd_addr = p_data->delete_key_RC_to_unpair.bd_addr;
      GetInterfaceToProfiles()->events->invoke_bond_state_changed_cb(
          BT_STATUS_SUCCESS, bd_addr, BT_BOND_STATE_BONDING,
          pairing_cb.fail_reason);
      btif_dm_remove_bond(bd_addr);
      break;

    case BTA_DM_LE_ADDR_ASSOC_EVT:
      GetInterfaceToProfiles()->events->invoke_le_address_associate_cb(
+0 −1
Original line number Diff line number Diff line
@@ -160,7 +160,6 @@ const char* dump_dm_event(uint16_t event) {
    CASE_RETURN_STR(BTA_DM_BLE_AUTH_CMPL_EVT)
    CASE_RETURN_STR(BTA_DM_DEV_UNPAIRED_EVT)
    CASE_RETURN_STR(BTA_DM_ENER_INFO_READ)
    CASE_RETURN_STR(BTA_DM_REPORT_BONDING_EVT)

    default:
      return "UNKNOWN DM EVENT";
+0 −1
Original line number Diff line number Diff line
@@ -290,7 +290,6 @@ TEST_F(BtifCoreTest, dump_dm_event) {
      std::make_pair(BTA_DM_BLE_AUTH_CMPL_EVT, "BTA_DM_BLE_AUTH_CMPL_EVT"),
      std::make_pair(BTA_DM_DEV_UNPAIRED_EVT, "BTA_DM_DEV_UNPAIRED_EVT"),
      std::make_pair(BTA_DM_ENER_INFO_READ, "BTA_DM_ENER_INFO_READ"),
      std::make_pair(BTA_DM_REPORT_BONDING_EVT, "BTA_DM_REPORT_BONDING_EVT"),
  };
  for (const auto& event : events) {
    ASSERT_STREQ(event.second.c_str(), dump_dm_event(event.first));
Loading