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

Commit 1095aa83 authored by Jakub Pawłowski's avatar Jakub Pawłowski Committed by Gerrit Code Review
Browse files

Merge "Fix state machine stuck after disconnection" into main

parents 3db6da76 72a8ae06
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -263,9 +263,21 @@ static void smp_br_connect_callback(uint16_t /* channel */, const RawAddress& bd
  log::info("BDA:{} pairing_bda:{}, connected:{}", bd_addr, p_cb->pairing_bda, connected);

  if (bd_addr != p_cb->pairing_bda) {
    if (!com::android::bluetooth::flags::smp_state_machine_stuck_after_disconnection_fix()) {
      log::info(
              "If your pairing failed, get a build with "
              "smp_state_machine_stuck_after_disconnection_fix and try again :)");
      return;
    }

    tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev(bd_addr);
    /* When pairing was initiated to RPA, and connection was on LE transport first using RPA, then
     * we must check record pseudo address, it might be same device */
    if (p_dev_rec == nullptr || p_dev_rec->RemoteAddress() != p_cb->pairing_bda) {
      return;
    }
  }

  /* Check if we already finished SMP pairing over LE, and are waiting to
   * check if other side returns some errors. Connection/disconnection on
   * Classic transport shouldn't impact that.