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

Commit cca225eb authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "BluetoothMetrics: Log SDP Complete Event" into main

parents a678f9ef d9032ea6
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -74,6 +74,7 @@
#include "main/shim/helpers.h"
#include "main/shim/le_advertising_manager.h"
#include "main_thread.h"
#include "metrics/bluetooth_event.h"
#include "os/logging/log_adapter.h"
#include "osi/include/properties.h"
#include "osi/include/stack_power_telemetry.h"
@@ -1590,6 +1591,7 @@ static void btif_on_service_discovery_results(RawAddress bd_addr,
    if (pairing_cb.sdp_attempts) {
      log::warn("SDP failed after bonding re-attempting for {}", bd_addr);
      pairing_cb.sdp_attempts++;
      bluetooth::metrics::LogSDPComplete(bd_addr, result);
      btif_dm_get_remote_services(bd_addr, BT_TRANSPORT_BR_EDR);
    } else {
      log::warn("SDP triggered by someone failed when bonding");
@@ -1598,6 +1600,8 @@ static void btif_on_service_discovery_results(RawAddress bd_addr,
  }

  if (results_for_bonding_device) {
    // success for SDP
    bluetooth::metrics::LogSDPComplete(bd_addr, tBTA_STATUS::BTA_SUCCESS);
    log::info("SDP finished for {}:", bd_addr);
    pairing_cb.sdp_over_classic = btif_dm_pairing_cb_t::ServiceDiscoveryState::FINISHED;
  }
+7 −0
Original line number Diff line number Diff line
@@ -154,5 +154,12 @@ void LogAuthenticationComplete(const RawAddress& raw_address, tHCI_STATUS hci_st
                                         MapHCIStatusToState(hci_status));
}

void LogSDPComplete(const RawAddress& raw_address, tBTA_STATUS status) {
  hci::Address address = bluetooth::ToGdAddress(raw_address);
  bluetooth::os::LogMetricBluetoothEvent(
          address, EventType::SERVICE_DISCOVERY,
          status == tBTA_STATUS::BTA_SUCCESS ? State::SUCCESS : State::FAIL);
}

}  // namespace metrics
}  // namespace bluetooth
+3 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

#pragma once

#include "bta/include/bta_sec_api.h"
#include "hci/address.h"
#include "hci/hci_packets.h"
#include "stack/include/btm_status.h"
@@ -41,5 +42,7 @@ void LogUserConfirmationRequestResponse(const hci::Address& address, bool positi

void LogAuthenticationComplete(const RawAddress& raw_address, tHCI_STATUS hci_status);

void LogSDPComplete(const RawAddress& raw_address, tBTA_STATUS status);

}  // namespace metrics
}  // namespace bluetooth