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

Commit d10db3ff authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by Jakub Pawłowski
Browse files

Read name of LE devices after connecting

LE devices can advertise name that is different from the actual name of
the device. Read name after pairing to make sure we use correct one.

This is needed for LE audio, where speaker would append location (i.e.
Left or Center) to the name in advertisement. We should then read the
exact device name to ensure it's properly displayed in settings without
the appended location.

Bug: 150670922
Test:  pair with LE device
Change-Id: I70727bd0711235929279abd1080d70deba74f502
parent 6480052c
Loading
Loading
Loading
Loading
+0 −7
Original line number Original line Diff line number Diff line
@@ -162,8 +162,6 @@ void bta_scan_results_cb_impl(RawAddress bd_addr, tBT_DEVICE_TYPE device_type,
}
}


void bta_scan_results_cb(tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH* p_data) {
void bta_scan_results_cb(tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH* p_data) {
  uint8_t len;

  if (event == BTA_DM_INQ_CMPL_EVT) {
  if (event == BTA_DM_INQ_CMPL_EVT) {
    BTIF_TRACE_DEBUG("%s  BLE observe complete. Num Resp %d", __func__,
    BTIF_TRACE_DEBUG("%s  BLE observe complete. Num Resp %d", __func__,
                     p_data->inq_cmpl.num_resps);
                     p_data->inq_cmpl.num_resps);
@@ -179,11 +177,6 @@ void bta_scan_results_cb(tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH* p_data) {
  if (p_data->inq_res.p_eir) {
  if (p_data->inq_res.p_eir) {
    value.insert(value.begin(), p_data->inq_res.p_eir,
    value.insert(value.begin(), p_data->inq_res.p_eir,
                 p_data->inq_res.p_eir + p_data->inq_res.eir_len);
                 p_data->inq_res.p_eir + p_data->inq_res.eir_len);

    if (AdvertiseDataParser::GetFieldByType(
            value, HCI_EIR_COMPLETE_LOCAL_NAME_TYPE, &len)) {
      p_data->inq_res.remt_name_not_required = true;
    }
  }
  }


  tBTA_DM_INQ_RES* r = &p_data->inq_res;
  tBTA_DM_INQ_RES* r = &p_data->inq_res;
+4 −2
Original line number Original line Diff line number Diff line
@@ -1223,8 +1223,10 @@ static void btif_dm_search_devices_evt(tBTA_DM_SEARCH_EVT event,
      uint8_t num_uuids = 0, max_num_uuid = 32;
      uint8_t num_uuids = 0, max_num_uuid = 32;
      uint8_t uuid_list[32 * Uuid::kNumBytes16];
      uint8_t uuid_list[32 * Uuid::kNumBytes16];


      if (p_search_data->inq_res.inq_result_type != BTM_INQ_RESULT_BLE) {
        p_search_data->inq_res.remt_name_not_required =
        p_search_data->inq_res.remt_name_not_required =
            check_eir_remote_name(p_search_data, NULL, NULL);
            check_eir_remote_name(p_search_data, NULL, NULL);
      }
      RawAddress& bdaddr = p_search_data->inq_res.bd_addr;
      RawAddress& bdaddr = p_search_data->inq_res.bd_addr;


      BTIF_TRACE_DEBUG("%s() %s device_type = 0x%x\n", __func__,
      BTIF_TRACE_DEBUG("%s() %s device_type = 0x%x\n", __func__,