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

Commit 76173a0d authored by Eric Shih's avatar Eric Shih Committed by Gerrit Code Review
Browse files

Merge changes from topic "power_telemetry" into main

* changes:
  Power Telemetry Stage 2
  Add logs for Battery Historian and feature flag and unittest
  Adding Power Telemetry data into Dumpsys
parents ca935287 086ca7da
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;
+2 −0
Original line number Diff line number Diff line
@@ -96,6 +96,7 @@
#include "osi/include/allocator.h"
#include "osi/include/log.h"
#include "osi/include/osi.h"
#include "osi/include/stack_power_telemetry.h"
#include "osi/include/wakelock.h"
#include "profile_log_levels.h"
#include "stack/btm/btm_sco_hfp_hal.h"
@@ -830,6 +831,7 @@ static void dump(int fd, const char** arguments) {
  DumpsysHid(fd);
  DumpsysBtaDm(fd);
  bluetooth::shim::Dump(fd, arguments);
  power_telemetry::GetInstance().Dumpsys(fd);
}

static void dumpMetrics(std::string* output) {
+2 −0
Original line number Diff line number Diff line
@@ -86,6 +86,7 @@
#include "osi/include/log.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/include/bt_octets.h"
@@ -2494,6 +2495,7 @@ void btif_dm_start_discovery(void) {
  btif_dm_inquiry_in_progress = false;
  /* find nearby devices */
  BTA_DmSearch(btif_dm_search_devices_evt);
  power_telemetry::GetInstance().LogScanStarted();
}

/*******************************************************************************
+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: [
Loading