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

Commit f5bde72d authored by Jakub Pawlowski's avatar Jakub Pawlowski
Browse files

Fix service discovery on dual mode device, when pairing on LE transport

Currently, if we find services associated with pseudo address, we would
not check if there are any services associated with static address.
This causes us to skip Classic services - they are not returned to Java,
and profiles don't get connected.

Test: manual. This issue occurs when dual mode device is bonded on LE
transport first, if it used RPA address for initial connection.
Bug: 300569218

Change-Id: Iaa08a56a4ca958820a0e5bea841866dc7148856a
parent abe3ac92
Loading
Loading
Loading
Loading
+25 −9
Original line number Diff line number Diff line
@@ -1933,17 +1933,31 @@ static void btif_dm_search_services_evt(tBTA_DM_SEARCH_EVT event,
      }

      Uuid existing_uuids[BT_MAX_NUM_UUIDS] = {};

      // Look up UUIDs using pseudo address (either RPA or static address)
      bt_status_t existing_lookup_result =
          btif_get_existing_uuids(&bd_addr, existing_uuids);
      if (existing_lookup_result == BT_STATUS_FAIL &&
          bd_addr != static_addr_copy) {

      if (existing_lookup_result != BT_STATUS_FAIL) {
        LOG_INFO("Got some existing UUIDs by address %s",
                 ADDRESS_TO_LOGGABLE_CSTR(bd_addr));

        for (int i = 0; i < BT_MAX_NUM_UUIDS; i++) {
          Uuid uuid = existing_uuids[i];
          if (uuid.IsEmpty()) {
            continue;
          }
          uuids.insert(uuid);
        }
      }

      if (bd_addr != static_addr_copy) {
        // Look up UUID using static address, if different than sudo address
        existing_lookup_result =
            btif_get_existing_uuids(&static_addr_copy, existing_uuids);
        if (existing_lookup_result != BT_STATUS_FAIL) {
          LOG_INFO("Got some existing UUIDs by static address %s",
                   ADDRESS_TO_LOGGABLE_CSTR(static_addr_copy));
        }
      }
          for (int i = 0; i < BT_MAX_NUM_UUIDS; i++) {
            Uuid uuid = existing_uuids[i];
            if (uuid.IsEmpty()) {
@@ -1951,6 +1965,8 @@ static void btif_dm_search_services_evt(tBTA_DM_SEARCH_EVT event,
            }
            uuids.insert(uuid);
          }
        }
      }

      for (auto& uuid : uuids) {
        auto uuid_128bit = uuid.To128BitBE();