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

Commit 5fd19dd2 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Skip flag process if no data in ADV packet" into main am: 5c2534b7 am: 51b6f0fc

parents ec762998 51b6f0fc
Loading
Loading
Loading
Loading
+39 −14
Original line number Diff line number Diff line
@@ -2355,11 +2355,13 @@ static void btm_ble_update_inq_result(tINQ_DB_ENT* p_i, uint8_t addr_type,

  bool has_advertising_flags = false;
  if (!data.empty()) {
    uint8_t local_flag = 0;
    const uint8_t* p_flag =
        AdvertiseDataParser::GetFieldByType(data, BTM_BLE_AD_TYPE_FLAG, &len);
    if (p_flag != NULL && len != 0) {
      has_advertising_flags = true;
      p_cur->flag = *p_flag;
      local_flag = *p_flag;
    }

    p_cur->dev_class = btm_ble_get_appearance_as_cod(data);
@@ -2392,8 +2394,30 @@ static void btm_ble_update_inq_result(tINQ_DB_ENT* p_i, uint8_t addr_type,
        break;
      }
    }
    if (IS_FLAG_ENABLED(ensure_valid_adv_flag)) {
      // Non-connectable packets may omit flags entirely, in which case nothing
      // should be assumed about their values (CSSv10, 1.3.1). Thus, do not
      // interpret the device type unless this packet has the flags set or is
      // connectable.
      if (ble_evt_type_is_connectable(evt_type) && !has_advertising_flags) {
        // Assume that all-zero flags were received
        has_advertising_flags = true;
        local_flag = 0;
      }
      if (has_advertising_flags && (local_flag & BTM_BLE_BREDR_NOT_SPT) == 0) {
        if (p_cur->ble_addr_type != BLE_ADDR_RANDOM) {
          LOG_VERBOSE("NOT_BR_EDR support bit not set, treat device as DUMO");
          p_cur->device_type |= BT_DEVICE_TYPE_DUMO;
        } else {
          LOG_VERBOSE("Random address, treat device as LE only");
        }
      } else {
        LOG_VERBOSE("NOT_BR/EDR support bit set, treat device as LE only");
      }
    }
  }

  if (!IS_FLAG_ENABLED(ensure_valid_adv_flag)) {
    // Non-connectable packets may omit flags entirely, in which case nothing
    // should be assumed about their values (CSSv10, 1.3.1). Thus, do not
    // interpret the device type unless this packet has the flags set or is
@@ -2412,6 +2436,7 @@ static void btm_ble_update_inq_result(tINQ_DB_ENT* p_i, uint8_t addr_type,
      log::verbose("NOT_BR/EDR support bit set, treat device as LE only");
    }
  }
}

void btm_ble_process_adv_addr(RawAddress& bda, tBLE_ADDR_TYPE* addr_type) {
  /* map address to security record */