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

Commit 770cd232 authored by Chen Chen's avatar Chen Chen Committed by Gerrit Code Review
Browse files

Merge "BluetoothMetrics: Upload Android device HCI and LMP versions"

parents d441cb82 d7334f35
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@
#include "common/init_flags.h"
#include "hci/hci_layer.h"
#include "hci_controller_generated.h"
#include "os/metrics.h"

namespace bluetooth {
namespace hci {
@@ -247,6 +248,12 @@ struct Controller::impl {
    ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str());

    local_version_information_ = complete_view.GetLocalVersionInformation();
    bluetooth::os::LogMetricBluetoothLocalVersions(
        local_version_information_.manufacturer_name_,
        static_cast<uint8_t>(local_version_information_.lmp_version_),
        local_version_information_.lmp_subversion_,
        static_cast<uint8_t>(local_version_information_.hci_version_),
        local_version_information_.hci_revision_);
  }

  void read_local_supported_commands_complete_handler(CommandCompleteView view) {
+21 −0
Original line number Diff line number Diff line
@@ -424,6 +424,27 @@ void LogMetricBluetoothHalCrashReason(
  }
}

void LogMetricBluetoothLocalVersions(
    uint32_t lmp_manufacturer_name,
    uint8_t lmp_version,
    uint32_t lmp_subversion,
    uint8_t hci_version,
    uint32_t hci_revision) {
  int ret = stats_write(
      BLUETOOTH_LOCAL_VERSIONS_REPORTED, lmp_manufacturer_name, lmp_version, lmp_subversion, hci_version, hci_revision);
  if (ret < 0) {
    LOG_WARN(
        "Failed for LogMetricBluetoothLocalVersions, "
        "lmp_manufacturer_name %d, lmp_version %hhu, lmp_subversion %d, hci_version %hhu, hci_revision %d, error %d",
        lmp_manufacturer_name,
        lmp_version,
        lmp_subversion,
        hci_version,
        hci_revision,
        ret);
  }
}

void LogMetricBluetoothCodePathCounterMetrics(int32_t key, int64_t count) {
  int ret = stats_write(BLUETOOTH_CODE_PATH_COUNTER, key, count);
  if (ret < 0) {
+7 −0
Original line number Diff line number Diff line
@@ -103,6 +103,13 @@ void LogMetricA2dpPlaybackEvent(const Address& address, int playback_state, int
void LogMetricBluetoothHalCrashReason(
    const Address& address, uint32_t error_code, uint32_t vendor_error_code) {}

void LogMetricBluetoothLocalVersions(
    uint32_t lmp_manufacturer_name,
    uint8_t lmp_version,
    uint32_t lmp_subversion,
    uint8_t hci_version,
    uint32_t hci_reversion) {}

void LogMetricBluetoothCodePathCounterMetrics(int32_t key, int64_t count) {}
}  // namespace os
}  // namespace bluetooth
+7 −0
Original line number Diff line number Diff line
@@ -103,6 +103,13 @@ void LogMetricA2dpPlaybackEvent(const Address& address, int playback_state, int
void LogMetricBluetoothHalCrashReason(
    const Address& address, uint32_t error_code, uint32_t vendor_error_code) {}

void LogMetricBluetoothLocalVersions(
    uint32_t lmp_manufacturer_name,
    uint8_t lmp_version,
    uint32_t lmp_subversion,
    uint8_t hci_version,
    uint32_t hci_revision) {}

void LogMetricBluetoothCodePathCounterMetrics(int32_t key, int64_t count) {}

}  // namespace os
+7 −0
Original line number Diff line number Diff line
@@ -268,6 +268,13 @@ void LogMetricBluetoothHalCrashReason(
    uint32_t error_code,
    uint32_t vendor_error_code);

void LogMetricBluetoothLocalVersions(
    uint32_t lmp_manufacturer_name,
    uint8_t lmp_version,
    uint32_t lmp_subversion,
    uint8_t hci_version,
    uint32_t hci_revision);

void LogMetricBluetoothCodePathCounterMetrics(int32_t key, int64_t count);
}  // namespace os