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

Commit 7f66bef2 authored by Himanshu Rawat's avatar Himanshu Rawat
Browse files

Allow pairing over unseen transport

BTM_SecBond locally rejected pairing over a transport which was not seen
to be supported by the remote device.
Priviledged applications can select the transport to used for pairing.
Some priviledged applications may choose to pair without performing the
device discovery or without performing device discovery long enough for
the BT stack to see the target device over the selected transport.

Test: mmm packages/modules/Bluetooth
Flag: com.android.bluetooth.flags.pairing_on_unknown_transport
Bug: 334805274
Bug: 335239971
Change-Id: Ifc71295668a6af1e003b41818ffd1f23c6b553c9
parent 04864c39
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@

#include "stack/btm/btm_sec.h"

#include <android_bluetooth_flags.h>
#include <base/functional/bind.h>
#include <base/strings/stringprintf.h>
#include <bluetooth/log.h>
@@ -773,11 +774,11 @@ tBTM_STATUS BTM_SecBond(const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
  if ((transport == BT_TRANSPORT_LE && (dev_type & BT_DEVICE_TYPE_BLE) == 0) ||
      (transport == BT_TRANSPORT_BR_EDR &&
       (dev_type & BT_DEVICE_TYPE_BREDR) == 0)) {
    log::warn(
        "Can't start bonding - requested transport and transport we've seen "
        "device on don't match");
    log::warn("Requested transport and supported transport don't match");
    if (!IS_FLAG_ENABLED(pairing_on_unknown_transport)) {
      return BTM_ILLEGAL_ACTION;
    }
  }
  return btm_sec_bond_by_transport(bd_addr, addr_type, transport);
}