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

Commit 0f964b22 authored by Huirong Liao's avatar Huirong Liao
Browse files

Fix reset other bonding device's state

[Root Cause]
If device is unpairing while another device is bonding,
the bonding device's pairing state will be cleared.

[Solution]
Do error check for this case.

Bug: 254389281
Test: bond successfully

Change-Id: I6f7e29e6c675c1b4d350863d3ad10c921f5c7aa9
parent 4e11382b
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -607,6 +607,13 @@ static void bond_state_changed(bt_status_t status, const RawAddress& bd_addr,
    dev_type = BT_DEVICE_TYPE_BREDR;
  }

  if ((state == BT_BOND_STATE_NONE) && (pairing_cb.bd_addr != bd_addr)
      && is_bonding_or_sdp()) {
    LOG_WARN("Ignoring bond state changed for unexpected device: %s pairing: %s",
        ADDRESS_TO_LOGGABLE_CSTR(bd_addr), ADDRESS_TO_LOGGABLE_CSTR(pairing_cb.bd_addr));
    return;
  }

  if (state == BT_BOND_STATE_BONDING ||
      (state == BT_BOND_STATE_BONDED &&
       (pairing_cb.sdp_attempts > 0 ||