diff options
author | Todd Poynor <toddpoynor@google.com> | 2014-05-20 13:54:40 -0700 |
---|---|---|
committer | Todd Poynor <toddpoynor@google.com> | 2014-05-20 16:26:48 -0700 |
commit | e14b37eb07b394fef05da5ee09dc6d33e3a25711 (patch) | |
tree | 43d8cc8e73f7d04f566b766fe88461edb7672c87 /healthd | |
parent | b65208d1a98c4cc6b4fbae302f7718f056e2fadd (diff) | |
download | system_core-e14b37eb07b394fef05da5ee09dc6d33e3a25711.tar.gz system_core-e14b37eb07b394fef05da5ee09dc6d33e3a25711.tar.bz2 system_core-e14b37eb07b394fef05da5ee09dc6d33e3a25711.zip |
healthd: Add hooks for ENERGY_COUNTER property
Bug: 10118565
Change-Id: Ibabae2a78a600ae37ce9b91da0f5980ee94b05c2
Diffstat (limited to 'healthd')
-rw-r--r-- | healthd/BatteryMonitor.cpp | 7 | ||||
-rw-r--r-- | healthd/healthd.cpp | 1 | ||||
-rw-r--r-- | healthd/healthd.h | 3 |
3 files changed, 10 insertions, 1 deletions
diff --git a/healthd/BatteryMonitor.cpp b/healthd/BatteryMonitor.cpp index ac649ce78..4ee6249b9 100644 --- a/healthd/BatteryMonitor.cpp +++ b/healthd/BatteryMonitor.cpp @@ -27,6 +27,7 @@ #include <unistd.h> #include <batteryservice/BatteryService.h> #include <cutils/klog.h> +#include <sys/types.h> #include <utils/Errors.h> #include <utils/String8.h> #include <utils/Vector.h> @@ -315,7 +316,11 @@ status_t BatteryMonitor::getProperty(int id, struct BatteryProperty *val) { break; case BATTERY_PROP_ENERGY_COUNTER: - ret = NAME_NOT_FOUND; + if (mHealthdConfig->energyCounter) { + ret = mHealthdConfig->energyCounter(&val->valueInt64); + } else { + ret = NAME_NOT_FOUND; + } break; default: diff --git a/healthd/healthd.cpp b/healthd/healthd.cpp index 5fe2965cb..a1912f174 100644 --- a/healthd/healthd.cpp +++ b/healthd/healthd.cpp @@ -52,6 +52,7 @@ static struct healthd_config healthd_config = { .batteryCurrentNowPath = String8(String8::kEmptyString), .batteryCurrentAvgPath = String8(String8::kEmptyString), .batteryChargeCounterPath = String8(String8::kEmptyString), + .energyCounter = NULL, }; static int eventct; diff --git a/healthd/healthd.h b/healthd/healthd.h index 23a54bf33..972e728d2 100644 --- a/healthd/healthd.h +++ b/healthd/healthd.h @@ -18,6 +18,7 @@ #define _HEALTHD_H_ #include <batteryservice/BatteryService.h> +#include <sys/types.h> #include <utils/Errors.h> #include <utils/String8.h> @@ -64,6 +65,8 @@ struct healthd_config { android::String8 batteryCurrentNowPath; android::String8 batteryCurrentAvgPath; android::String8 batteryChargeCounterPath; + + int (*energyCounter)(int64_t *); }; // Global helper functions |