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

Commit b2269773 authored by Jakub Pawlowski's avatar Jakub Pawlowski
Browse files

Rather than immediately removing classic device bond, send a broadcast

Settings can then notify user, to act upon it.

Bug: 333634398
Bug: 322352082
Test: Reconnect to device that was factory reset.
Flag: com.android.bluetooth.flags.key_missing_classic_device
Change-Id: I0e0b4622fa3da986c0ba4cbcc3793c59eda8178f
parent 7a70f98f
Loading
Loading
Loading
Loading
+14 −0
Original line number Original line Diff line number Diff line
@@ -2427,6 +2427,20 @@ void btm_sec_rmt_host_support_feat_evt(const RawAddress bd_addr,
 ******************************************************************************/
 ******************************************************************************/
void btm_io_capabilities_req(RawAddress p) {
void btm_io_capabilities_req(RawAddress p) {
  if (btm_sec_is_a_bonded_dev(p)) {
  if (btm_sec_is_a_bonded_dev(p)) {
    if (com::android::bluetooth::flags::key_missing_classic_device()) {
      log::warn(
          "Incoming bond request, but {} is already bonded (notifying user)",
          p);
      bta_dm_remote_key_missing(p);

      auto p_dev_rec = btm_find_dev(p);
      if (p_dev_rec != NULL) {
        btm_sec_disconnect(p_dev_rec->hci_handle, HCI_ERR_AUTH_FAILURE,
                           "btm_io_capabilities_req Security failure");
      }
      return;
    }

    log::warn("Incoming bond request, but {} is already bonded (removing)", p);
    log::warn("Incoming bond request, but {} is already bonded (removing)", p);
    bta_dm_process_remove_device(p);
    bta_dm_process_remove_device(p);
  }
  }