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

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

Prefer connected transport for service discovery on dual mode devices

If an application requests service discovery on a dual mode device with a public address without explicit preference for the transport, BT stack always prefers BR/EDR transport.
If the device is already connected over the LE transport, but not on the BR/EDR transport, then service discovery should be performed over LE transport.

Test: m com.android.btservices
Bug: 306435924

Change-Id: I43cbec21798be0fea2e23e6ecc550b75e9561f8f
parent 13fe7bce
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -1276,6 +1276,14 @@ static tBT_TRANSPORT bta_dm_determine_discovery_transport(
    BTM_ReadDevInfo(remote_bd_addr, &dev_type, &addr_type);
    if (dev_type == BT_DEVICE_TYPE_BLE || addr_type == BLE_ADDR_RANDOM) {
      transport = BT_TRANSPORT_LE;
    } else if (dev_type == BT_DEVICE_TYPE_DUMO) {
      if (get_btm_client_interface().peer.BTM_IsAclConnectionUp(
              remote_bd_addr, BT_TRANSPORT_BR_EDR)) {
        transport = BT_TRANSPORT_BR_EDR;
      } else if (get_btm_client_interface().peer.BTM_IsAclConnectionUp(
                     remote_bd_addr, BT_TRANSPORT_LE)) {
        transport = BT_TRANSPORT_LE;
      }
    }
  } else {
    transport = bta_dm_search_cb.transport;
+6 −0
Original line number Diff line number Diff line
@@ -54,9 +54,15 @@ uint16_t BTM_GetMaxPacketSize(const RawAddress& addr) {
  return RFCOMM_DEFAULT_MTU;
}

bool BTM_IsAclConnectionUp(const RawAddress& remote_bda,
                           tBT_TRANSPORT transport) {
  return true;
}

struct btm_client_interface_t btm_client_interface = {
    .peer =
        {
            .BTM_IsAclConnectionUp = BTM_IsAclConnectionUp,
            .BTM_GetMaxPacketSize = BTM_GetMaxPacketSize,
        },
};