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

Commit ecff95ce authored by Rahul Sabnis's avatar Rahul Sabnis Committed by Automerger Merge Worker
Browse files

Reconfigure Address policy on last bond removed am: f4aa35ad am: 3a590a91

parents 3d7417fa 3a590a91
Loading
Loading
Loading
Loading
+14 −7
Original line number Diff line number Diff line
@@ -652,13 +652,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();
  }
}

/*******************************************************************************
@@ -4037,6 +4030,20 @@ void bta_dm_clear_event_filter(void) {
  bluetooth::shim::BTM_ClearEventFilter();
}

/*******************************************************************************
 *
 * 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
@@ -675,3 +675,17 @@ void BTA_DmClearEventFilter(void) {
  APPL_TRACE_API("BTA_DmClearEventFilter");
  do_in_main_thread(FROM_HERE, base::Bind(bta_dm_clear_event_filter));
}

/*******************************************************************************
 *
 * 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
@@ -543,6 +543,8 @@ extern tBTA_DM_PEER_DEVICE* bta_dm_find_peer_device(

extern void bta_dm_clear_event_filter(void);

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
@@ -1210,4 +1210,15 @@ extern void BTA_VendorInit(void);
 ******************************************************************************/
extern void BTA_DmClearEventFilter(void);

/*******************************************************************************
 *
 * 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
@@ -896,6 +896,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;
}

@@ -1285,7 +1292,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