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

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

Merge "Add expresslog metrics for a2dp codec usage" into main am: 6e3749f8

parents 6d8c17a9 6e3749f8
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -134,6 +134,7 @@ cc_library_shared {
        "libchrome",
        "libcutils",
        "libevent",
        "libexpresslog",
        "libflatbuffers-cpp",
        "libfmq",
        "libg722codec",
@@ -144,6 +145,8 @@ cc_library_shared {
        "libosi",
        "libprotobuf-cpp-lite",
        "libstatslog_bt",
        "libstatslog_express",
        "libtextclassifier_hash_static",
        "libudrv-uipc",
        "libutils",
        "server_configurable_flags",
+3 −0
Original line number Diff line number Diff line
@@ -91,6 +91,7 @@ cc_defaults {
        "libchrome",
        "libcutils",
        "libevent",
        "libexpresslog",
        "libg722codec",
        "libhidlbase",
        "libjsoncpp",
@@ -100,6 +101,8 @@ cc_defaults {
        "libosi",
        "libprotobuf-cpp-lite",
        "libstatslog_bt",
        "libstatslog_express",
        "libtextclassifier_hash_static",
        "libudrv-uipc",
        "libutils",
        "libvndksupport",
+6 −0
Original line number Diff line number Diff line
@@ -125,8 +125,14 @@ cc_defaults {
                "libcutils",
                "libhidlbase",
                "libstatslog_bt",
                "libstatssocket",
                "libutils",
            ],
            static_libs: [
                "libexpresslog",
                "libstatslog_express",
                "libtextclassifier_hash_static",
            ],
            whole_static_libs: [
                "android.hardware.bluetooth-V1-ndk",
                "android.hardware.bluetooth.ranging-V1-ndk",
+30 −2
Original line number Diff line number Diff line
@@ -20,12 +20,14 @@

#include "os/metrics.h"

#include <Counter.h>
#include <bluetooth/log.h>
#include <statslog_bt.h>

#include "common/audit_log.h"
#include "common/metric_id_manager.h"
#include "common/strings.h"
#include "hardware/bt_av.h"
#include "hci/hci_packets.h"
#include "metrics/metrics_state.h"
#include "os/log.h"
@@ -206,8 +208,34 @@ void LogMetricA2dpSessionMetricsEvent(
    int /* buffer_overruns_total */,
    float /* buffer_underruns_average */,
    int /* buffer_underruns_count */,
    int64_t /* codec_index */,
    bool /* is_a2dp_offload */) {}
    int64_t codec_index,
    bool /* is_a2dp_offload */) {
  char const* metric_id = nullptr;
  switch (codec_index) {
    case BTAV_A2DP_CODEC_INDEX_SOURCE_SBC:
      metric_id = "bluetooth.value_sbc_codec_usage_over_a2dp";
      break;
    case BTAV_A2DP_CODEC_INDEX_SOURCE_AAC:
      metric_id = "bluetooth.value_aac_codec_usage_over_a2dp";
      break;
    case BTAV_A2DP_CODEC_INDEX_SOURCE_APTX:
      metric_id = "bluetooth.value_aptx_codec_usage_over_a2dp";
      break;
    case BTAV_A2DP_CODEC_INDEX_SOURCE_APTX_HD:
      metric_id = "bluetooth.value_aptx_hd_codec_usage_over_a2dp";
      break;
    case BTAV_A2DP_CODEC_INDEX_SOURCE_LDAC:
      metric_id = "bluetooth.value_ldac_codec_usage_over_a2dp";
      break;
    case BTAV_A2DP_CODEC_INDEX_SOURCE_OPUS:
      metric_id = "bluetooth.value_opus_codec_usage_over_a2dp";
      break;
    default:
      return;
  }

  android::expresslog::Counter::logIncrement(metric_id);
}

void LogMetricHfpPacketLossStats(
    const Address& /* address */,
+3 −0
Original line number Diff line number Diff line
@@ -837,6 +837,9 @@ cc_test {
            static_libs: [
                "android.hardware.bluetooth@1.0",
                "android.hardware.bluetooth@1.1",
                "libexpresslog",
                "libstatslog_express",
                "libtextclassifier_hash_static",
            ],
        },
        host: {
Loading