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

Commit e1a15205 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 8717000 from ffc7b2bb to tm-release

Change-Id: I99668793df2e1100b6660a5ec9912bc79296db88
parents a50eb626 ffc7b2bb
Loading
Loading
Loading
Loading
+26 −20
Original line number Diff line number Diff line
@@ -164,6 +164,8 @@ typedef struct {
  bool is_le_nc; /* LE Numeric comparison */
  btif_dm_ble_cb_t ble;
  uint8_t fail_reason;
  Uuid::UUID128Bit eir_uuids[32];
  uint8_t num_eir_uuids;
} btif_dm_pairing_cb_t;

// TODO(jpawlowski): unify ?
@@ -1296,19 +1298,17 @@ static void btif_dm_search_devices_evt(tBTA_DM_SEARCH_EVT event,
                                   &(p_search_data->inq_res.include_rsi));
        num_properties++;

        /* EIR queried services */
        std::vector<Uuid> uuid128_list;
        /* Cache EIR queried services */
        if (num_uuids > 0) {
          uint16_t* p_uuid16 = (uint16_t*)uuid_list;
          pairing_cb.num_eir_uuids = 0;
          LOG_INFO("EIR UUIDS:");
          for (int i = 0; i < num_uuids; ++i) {
            Uuid uuid = Uuid::From16Bit(p_uuid16[i]);
            uuid128_list.push_back(uuid);
            LOG_INFO("        %s", uuid.ToString().c_str());
            pairing_cb.eir_uuids[i] = uuid.To128BitBE();
            pairing_cb.num_eir_uuids++;
          }

          BTIF_STORAGE_FILL_PROPERTY(
              &properties[num_properties], BT_PROPERTY_UUIDS,
              num_uuids * Uuid::kNumBytes128, uuid128_list.data());
          num_properties++;
        }

        status =
@@ -1408,28 +1408,34 @@ static void btif_dm_search_services_evt(tBTA_DM_SEARCH_EVT event,
        LOG_INFO("SDP search done for %s", bd_addr.ToString().c_str());
        pairing_cb.sdp_attempts = 0;

        // Both SDP and bonding are done, clear pairing control block in case
        // it is not already cleared
        pairing_cb = {};

        // Send one empty UUID to Java to unblock pairing intent when SDP failed
        // or no UUID is discovered
        // Send UUIDs discovered through EIR to Java to unblock pairing intent
        // when SDP failed or no UUID is discovered
        if (p_data->disc_res.result != BTA_SUCCESS ||
            p_data->disc_res.num_uuids == 0) {
          LOG_INFO("SDP failed, send empty UUID to unblock bonding %s",
                   bd_addr.ToString().c_str());
          LOG_INFO("SDP failed, send %d EIR UUIDs to unblock bonding %s",
                   pairing_cb.num_eir_uuids, bd_addr.ToString().c_str());
          bt_property_t prop_uuids;
          Uuid uuid = {};

          prop_uuids.type = BT_PROPERTY_UUIDS;
          if (pairing_cb.num_eir_uuids > 0) {
            prop_uuids.val = pairing_cb.eir_uuids;
            prop_uuids.len = pairing_cb.num_eir_uuids * Uuid::kNumBytes128;
          } else {
            prop_uuids.val = &uuid;
            prop_uuids.len = Uuid::kNumBytes128;
          }

          /* Send the event to the BTIF */
          /* Send the event to the BTIF
           * prop_uuids will be deep copied by this call
           */
          invoke_remote_device_properties_cb(BT_STATUS_SUCCESS, bd_addr, 1,
                                             &prop_uuids);
          pairing_cb = {};
          break;
        }
        // Both SDP and bonding are done, clear pairing control block in case
        // it is not already cleared
        pairing_cb = {};
      }

      if (p_data->disc_res.num_uuids != 0) {