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

Commit 2b81305b authored by Qasim Javed's avatar Qasim Javed Committed by Jack He
Browse files

Ignore empty as well as base UUIDs.

We ignore empty (all zeroes) UUIDs but we do not yet ignore base UUIDs
which are then reported to Java. Base UUIDs should be ignored by the
stack instead of passing them upwards.

Bug: 242595392
Tag: #refactor
Test: Manually by looking at the SDP results reported to Java

Change-Id: Ic06962161143693be21df25f4c35fef65637ee1e
parent b65cd581
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -1365,6 +1365,10 @@ static void btif_get_existing_uuids(RawAddress* bd_addr, Uuid* existing_uuids) {
  btif_storage_get_remote_device_property(bd_addr, &tmp_prop);
}

static bool btif_should_ignore_uuid(const Uuid& uuid) {
  return uuid.IsEmpty() || uuid.IsBase();
}

/*******************************************************************************
 *
 * Function         btif_dm_search_services_evt
@@ -1407,7 +1411,7 @@ static void btif_dm_search_services_evt(tBTA_DM_SEARCH_EVT event,
        LOG_INFO("New UUIDs for %s:", bd_addr.ToString().c_str());
        for (i = 0; i < p_data->disc_res.num_uuids; i++) {
          auto uuid = p_data->disc_res.p_uuid_list + i;
          if (uuid->IsEmpty()) {
          if (btif_should_ignore_uuid(*uuid)) {
            continue;
          }
          LOG_INFO("index:%d uuid:%s", i, uuid->ToString().c_str());
@@ -1419,7 +1423,7 @@ static void btif_dm_search_services_evt(tBTA_DM_SEARCH_EVT event,

        for (int i = 0; i < BT_MAX_NUM_UUIDS; i++) {
          Uuid uuid = existing_uuids[i];
          if (uuid.IsEmpty()) {
          if (btif_should_ignore_uuid(uuid)) {
            continue;
          }
          if (btif_is_interesting_le_service(uuid)) {
@@ -1507,7 +1511,7 @@ static void btif_dm_search_services_evt(tBTA_DM_SEARCH_EVT event,
      LOG_INFO("New BLE UUIDs for %s:", bd_addr.ToString().c_str());
      for (Uuid uuid : *p_data->disc_ble_res.services) {
        if (btif_is_interesting_le_service(uuid)) {
          if (uuid.IsEmpty()) {
          if (btif_should_ignore_uuid(uuid)) {
            continue;
          }
          LOG_INFO("index:%d uuid:%s", static_cast<int>(uuids.size()),
+2 −0
Original line number Diff line number Diff line
@@ -155,6 +155,8 @@ Uuid Uuid::GetRandom() {

bool Uuid::IsEmpty() const { return *this == kEmpty; }

bool Uuid::IsBase() const { return *this == kBase; }

void Uuid::UpdateUuid(const Uuid& uuid) {
  uu = uuid.uu;
}
+3 −0
Original line number Diff line number Diff line
@@ -106,6 +106,9 @@ class Uuid final {
  // Returns true if this UUID is equal to kEmpty
  bool IsEmpty() const;

  // Returns true if this UUID is equal to kBase
  bool IsBase() const;

  // Update UUID with new value
  void UpdateUuid(const Uuid& uuid);