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

Commit d0467d12 authored by Himanshu Rawat's avatar Himanshu Rawat
Browse files

Ignore empty pseudo and identity address

Identity or pseudo address may be empty in the record for the device
being removed. Stack must not try to remove or disconnect these empty
addresses.
Also, use identity address instead of target address in pending remove
queue.

Test: mmm packages/modules/Bluetooth
Test: Manual | Pair and remove dual mode devices
Flag: com.android.bluetooth.flags.wait_for_disconnect_before_unbond
Bug: 356585051
Bug: 345299969
Change-Id: I91d6519e4773174043c8137ee36c109527f63fe1
parent d36d6505
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -592,6 +592,12 @@ void bta_dm_remove_device(const RawAddress& target) {
    bredr_connected = get_btm_client_interface().peer.BTM_ReadConnectedTransportAddress(
            &identity_addr, BT_TRANSPORT_BR_EDR);
  }
  if (pseudo_addr.IsEmpty()) {
    pseudo_addr = target;
  }
  if (identity_addr.IsEmpty()) {
    identity_addr = target;
  }

  // Remove from LE allowlist
  if (!GATT_CancelConnect(0, pseudo_addr, false)) {
@@ -628,7 +634,7 @@ void bta_dm_remove_device(const RawAddress& target) {

  if (le_connected || bredr_connected) {
    // Wait for all transports to be disconnected
    tBTA_DM_REMOVE_PENDNIG node = {pseudo_addr, target, le_connected, bredr_connected};
    tBTA_DM_REMOVE_PENDNIG node = {pseudo_addr, identity_addr, le_connected, bredr_connected};
    bta_dm_cb.pending_removals.push_back(node);
    log::info(
            "Waiting for disconnection over LE:{}, BR/EDR:{} for pseudo address: {}, identity "