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

Commit 31c671c7 authored by Michael Sun's avatar Michael Sun
Browse files

btif: fix bond state callback state mismatch

When bonding is not finished successfully with authentication, btif_dm
should report a state update to the Java layer if: 1. the device is
still bonding or 2. the device has been removed. However, the existing
code always reports the BT_BOND_STATE_NONE state; fix it by separating
the handles for the two situations.

Bug: 232098267
Test: ./build.py
Change-Id: I8a7e73f3fc3f447d84f45b97493d0556c493d74c
parent a39a347f
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -1176,8 +1176,10 @@ static void btif_dm_auth_cmpl_evt(tBTA_DM_AUTH_CMPL* p_auth_cmpl) {
    }
    // Report bond state change to java only if we are bonding to a device or
    // a device is removed from the pairing list.
    if (pairing_cb.state == BT_BOND_STATE_BONDING || is_bonded_device_removed) {
      bond_state_changed(status, bd_addr, state);
    if (pairing_cb.state == BT_BOND_STATE_BONDING) {
      bond_state_changed(status, bd_addr, BT_BOND_STATE_BONDING);
    } else if (is_bonded_device_removed) {
      bond_state_changed(status, bd_addr, BT_BOND_STATE_NONE);
    }
  }
}