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

Commit 086ca7da authored by Eric Shih's avatar Eric Shih
Browse files

Power Telemetry Stage 2

1. SCO on (off already has logs)
2. HCI cmd/evt
3. BLE Scan

Bug: 237393639
Test: atest net_test_osi
Change-Id: If05bd9028a17cbe1f530de3384e6abf6c514f008
parent e0d87113
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -491,6 +491,7 @@ cc_test {
        "libbt_shim_bridge",
        "libbt_shim_ffi",
        "libchrome",
        "libcutils",
        "libgmock",
        "libosi",
    ],
+5 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@
#include "main/shim/shim.h"
#include "osi/include/osi.h"
#include "osi/include/properties.h"
#include "osi/include/stack_power_telemetry.h"
#include "stack/btm/btm_dev.h"
#include "stack/btm/btm_sec.h"
#include "stack/crypto_toolbox/crypto_toolbox.h"
@@ -1370,6 +1371,8 @@ class CsisClientImpl : public CsisClient {
          if (instance == nullptr) return;

          if (event == BTA_DM_INQ_CMPL_EVT) {
            power_telemetry::GetInstance().LogBleScan(
                static_cast<int>(p_data->inq_cmpl.num_resps));
            LOG(INFO) << "BLE observe complete. Num Resp: "
                      << static_cast<int>(p_data->inq_cmpl.num_resps);
            csis_ad_type_filter_set(false);
@@ -1482,6 +1485,8 @@ class CsisClientImpl : public CsisClient {
          if (instance == nullptr) return;

          if (event == BTA_DM_INQ_CMPL_EVT) {
            power_telemetry::GetInstance().LogBleScan(
                static_cast<int>(p_data->inq_cmpl.num_resps));
            DLOG(INFO) << "BLE observe complete. Num Resp: "
                       << static_cast<int>(p_data->inq_cmpl.num_resps);
            return;
+25 −1
Original line number Diff line number Diff line
@@ -170,10 +170,12 @@ cc_defaults {
    static_libs: [
        "libbluetooth-dumpsys",
        "libbluetooth-protos",
        "libbluetooth-types",
        "libbluetooth_rust_interop",
        "libbt-platform-protos-lite",
        "libbt_shim_bridge",
        "libbt_shim_ffi",
        "libosi",
    ],
    include_dirs: [
        "packages/modules/Bluetooth/system/include",
@@ -187,6 +189,9 @@ cc_library {
    defaults: [
        "libbluetooth_gd_defaults",
    ],
    include_dirs: [
        "packages/modules/Bluetooth/system",
    ],
    apex_available: [
        "com.android.btservices",
    ],
@@ -200,6 +205,9 @@ cc_library {
    defaults: [
        "libbluetooth_gd_defaults",
    ],
    include_dirs: [
        "packages/modules/Bluetooth/system",
    ],
    srcs: [
        ":BluetoothOsSources_fake_timer",
    ],
@@ -208,7 +216,11 @@ cc_library {
        "-DUSE_FAKE_TIMERS",
        "-Wno-unused-parameter",
    ],
    static_libs: ["libchrome"],
    static_libs: [
        "libbluetooth-types",
        "libchrome",
        "libosi",
    ],
}

cc_library {
@@ -216,6 +228,9 @@ cc_library {
    defaults: [
        "libbluetooth_gd_defaults",
    ],
    include_dirs: [
        "packages/modules/Bluetooth/system",
    ],
    srcs: [
        ":BluetoothOsSources_fake_timer",
    ],
@@ -224,7 +239,9 @@ cc_library {
        "-Wno-unused-parameter",
    ],
    static_libs: [
        "libbluetooth-types",
        "libchrome",
        "libosi",
    ],
}

@@ -234,6 +251,7 @@ cc_binary {
        "gd_defaults",
    ],
    include_dirs: [
        "packages/modules/Bluetooth/system",
        "packages/modules/Bluetooth/system/include",
        "packages/modules/Bluetooth/system/types",
    ],
@@ -266,6 +284,7 @@ cc_binary {
        "breakpad_client",
        "libbluetooth-dumpsys",
        "libbluetooth-protos",
        "libbluetooth-types",
        "libbluetooth_gd",
        "libbluetooth_hci_pdl",
        "libbluetooth_l2cap_pdl",
@@ -275,6 +294,7 @@ cc_binary {
        "libbt_shim_ffi",
        "libchrome",
        "libflatbuffers-cpp",
        "libosi",
    ],
    shared_libs: [
        "libcrypto",
@@ -392,6 +412,7 @@ cc_test {
        "libbluetooth-dumpsys-test",
        "libbluetooth-dumpsys-unittest",
        "libbluetooth-protos",
        "libbluetooth-types",
        "libbluetooth_gd_unit_tests",
        "libbluetooth_hci_pdl",
        "libbluetooth_l2cap_pdl",
@@ -405,6 +426,7 @@ cc_test {
        "libchrome",
        "libflatbuffers-cpp",
        "libgmock",
        "libosi",
    ],
    shared_libs: [
        "libcrypto",
@@ -474,6 +496,7 @@ cc_defaults {
    ],
    static_libs: [
        "libbluetooth-protos",
        "libbluetooth-types",
        "libbluetooth_gd_fuzzing",
        "libbluetooth_rust_interop",
        "libbt_shim_bridge",
@@ -481,6 +504,7 @@ cc_defaults {
        "libchrome",
        "libgmock",
        "libgtest",
        "libosi",
    ],
    host_supported: true,
    generated_headers: [
+3 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@
#include "os/alarm.h"
#include "os/metrics.h"
#include "os/queue.h"
#include "osi/include/stack_power_telemetry.h"
#include "packet/packet_builder.h"
#include "storage/storage_module.h"

@@ -274,6 +275,7 @@ struct HciLayer::impl {
    auto cmd_view = CommandView::Create(PacketView<kLittleEndian>(bytes));
    ASSERT(cmd_view.IsValid());
    OpCode op_code = cmd_view.GetOpCode();
    power_telemetry::GetInstance().LogHciCmdDetail();
    command_queue_.front().command_view = std::make_unique<CommandView>(std::move(cmd_view));
    log_link_layer_connection_command(command_queue_.front().command_view);
    log_classic_pairing_command_status(command_queue_.front().command_view, ErrorCode::STATUS_UNKNOWN);
@@ -374,6 +376,7 @@ struct HciLayer::impl {
    } else {
      log_hci_event(command_queue_.front().command_view, event, module_.GetDependency<storage::StorageModule>());
    }
    power_telemetry::GetInstance().LogHciEvtDetail();
    EventCode event_code = event.GetEventCode();
    // Root Inflamation is a special case, since it aborts here
    if (event_code == EventCode::VENDOR_SPECIFIC) {
+1 −0
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ class PowerTelemetry {
  void LogAclTxPowerLevel(uint16_t handle, uint8_t txPower);
  void LogInqScanStarted();
  void LogInqScanStopped();
  void LogBleScan(uint16_t num_resps);
  void LogBleAdvStarted();
  void LogBleAdvStopped();

Loading