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

Commit 6c62ad30 authored by Rahul Sabnis's avatar Rahul Sabnis Committed by Android (Google) Code Review
Browse files

Merge "Revert "Revert "Reconfigure Address policy on last bond removed"""

parents be3a31b1 66bfae6d
Loading
Loading
Loading
Loading
+14 −7
Original line number Diff line number Diff line
@@ -659,13 +659,6 @@ void bta_dm_remove_device(const RawAddress& bd_addr) {
  if (!other_address_connected && !other_address.IsEmpty()) {
    bta_dm_process_remove_device(other_address);
  }

  /* Check the length of the paired devices, and if 0 then reset IRK */
  auto paired_devices = btif_config_get_paired_devices();
  if (paired_devices.empty()) {
    LOG_INFO("Last paired device removed, resetting IRK");
    btm_ble_reset_id();
  }
}

/*******************************************************************************
@@ -4137,6 +4130,20 @@ void bta_dm_set_event_filter_inquiry_result_all_devices() {
  bluetooth::shim::BTM_SetEventFilterInquiryResultAllDevices();
}

/*******************************************************************************
 *
 * Function         bta_dm_ble_reset_id
 *
 * Description      Reset the local adapter BLE keys.
 *
 * Parameters:
 *
 ******************************************************************************/
void bta_dm_ble_reset_id(void) {
  VLOG(1) << "bta_dm_ble_reset_id in bta_dm_act";
  bluetooth::shim::BTM_BleResetId();
}

/*******************************************************************************
 *
 * Function         bta_dm_gattc_callback
+14 −0
Original line number Diff line number Diff line
@@ -706,3 +706,17 @@ void BTA_DmSetEventFilterInquiryResultAllDevices() {
      FROM_HERE,
      base::Bind(bta_dm_set_event_filter_inquiry_result_all_devices));
}

/*******************************************************************************
 *
 * Function         BTA_DmBleResetId
 *
 * Description      This function resets the ble keys such as IRK
 *
 * Returns          void
 *
 ******************************************************************************/
void BTA_DmBleResetId(void) {
  APPL_TRACE_API("BTA_DmBleResetId");
  do_in_main_thread(FROM_HERE, base::Bind(bta_dm_ble_reset_id));
}
+2 −0
Original line number Diff line number Diff line
@@ -550,6 +550,8 @@ extern void bta_dm_restore_filter_accept_list();
extern void bta_dm_set_default_event_mask();
extern void bta_dm_set_event_filter_inquiry_result_all_devices();

extern void bta_dm_ble_reset_id(void);

uint8_t bta_dm_search_get_state();
void bta_dm_search_set_state(uint8_t state);

+11 −0
Original line number Diff line number Diff line
@@ -1256,4 +1256,15 @@ extern void BTA_DmSetDefaultEventMask();
 *******************************************************************************/
extern void BTA_DmSetEventFilterInquiryResultAllDevices();

/*******************************************************************************
 *
 * Function         BTA_DmBleResetId
 *
 * Description      This function resets the ble keys such as IRK
 *
 * Returns          void
 *
 ******************************************************************************/
extern void BTA_DmBleResetId(void);

#endif /* BTA_API_H */
+11 −1
Original line number Diff line number Diff line
@@ -897,6 +897,13 @@ bt_status_t btif_storage_remove_bonded_device(

  /* write bonded info immediately */
  btif_config_flush();

  /* Check the length of the paired devices, and if 0 then reset IRK */
  auto paired_devices = btif_config_get_paired_devices();
  if (paired_devices.empty()) {
    LOG_INFO("Last paired device removed, resetting IRK");
    BTA_DmBleResetId();
  }
  return ret ? BT_STATUS_SUCCESS : BT_STATUS_FAIL;
}

@@ -1286,7 +1293,10 @@ bt_status_t btif_storage_add_ble_local_key(const Octet16& key,
      return BT_STATUS_FAIL;
  }
  int ret = btif_config_set_bin("Adapter", name, key.data(), key.size());
  btif_config_save();
  // Had to change this to flush to get it to work on test.
  // Seems to work in the real world on a phone... but not sure why there's a
  // race in test. Investigate b/239828132
  btif_config_flush();
  return ret ? BT_STATUS_SUCCESS : BT_STATUS_FAIL;
}

Loading