summaryrefslogtreecommitdiffstats
path: root/healthd
diff options
context:
space:
mode:
authorThierry Strudel <tstrudel@google.com>2019-01-11 17:09:20 -0800
committerThierry Strudel <tstrudel@google.com>2019-01-11 18:08:23 -0800
commitf73de6f0377e9d1b0a7a293ad01cc39743610955 (patch)
tree65aaabc1560dace8f04e888c1a1683c161a6a682 /healthd
parent1c4ad71dffa5862a0a9649bee7dbf1d7991d4652 (diff)
downloadsystem_core-f73de6f0377e9d1b0a7a293ad01cc39743610955.tar.gz
system_core-f73de6f0377e9d1b0a7a293ad01cc39743610955.tar.bz2
system_core-f73de6f0377e9d1b0a7a293ad01cc39743610955.zip
healthd.h: add ignorePowerSupplyNames to healthd_config
In case some power supply paths should not be considered, add a black list to the healthd_config to instruct BatteryMonitor of the power supply paths to ignore on init. Bug: 117903348 Change-Id: I6f9ddeff9351ad01772b43728ddc2627da81df2a Signed-off-by: Thierry Strudel <tstrudel@google.com>
Diffstat (limited to 'healthd')
-rw-r--r--healthd/BatteryMonitor.cpp8
-rw-r--r--healthd/include/healthd/healthd.h3
2 files changed, 11 insertions, 0 deletions
diff --git a/healthd/BatteryMonitor.cpp b/healthd/BatteryMonitor.cpp
index a1519da3b..06c8176e9 100644
--- a/healthd/BatteryMonitor.cpp
+++ b/healthd/BatteryMonitor.cpp
@@ -26,6 +26,8 @@
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
+
+#include <algorithm>
#include <memory>
#include <android-base/file.h>
@@ -476,10 +478,16 @@ void BatteryMonitor::init(struct healthd_config *hc) {
while ((entry = readdir(dir.get()))) {
const char* name = entry->d_name;
+ std::vector<String8>::iterator itIgnoreName;
if (!strcmp(name, ".") || !strcmp(name, ".."))
continue;
+ itIgnoreName = find(hc->ignorePowerSupplyNames.begin(),
+ hc->ignorePowerSupplyNames.end(), String8(name));
+ if (itIgnoreName != hc->ignorePowerSupplyNames.end())
+ continue;
+
// Look for "type" file in each subdirectory
path.clear();
path.appendFormat("%s/%s/type", POWER_SUPPLY_SYSFS_PATH, name);
diff --git a/healthd/include/healthd/healthd.h b/healthd/include/healthd/healthd.h
index c01e8d747..a90007199 100644
--- a/healthd/include/healthd/healthd.h
+++ b/healthd/include/healthd/healthd.h
@@ -22,6 +22,8 @@
#include <utils/Errors.h>
#include <utils/String8.h>
+#include <vector>
+
// periodic_chores_interval_fast, periodic_chores_interval_slow: intervals at
// which healthd wakes up to poll health state and perform periodic chores,
// in units of seconds:
@@ -71,6 +73,7 @@ struct healthd_config {
int (*energyCounter)(int64_t *);
int boot_min_cap;
bool (*screen_on)(android::BatteryProperties *props);
+ std::vector<android::String8> ignorePowerSupplyNames;
};
enum EventWakeup {