summaryrefslogtreecommitdiff
path: root/health
diff options
context:
space:
mode:
authorJack Wu <wjack@google.com>2020-03-05 17:17:06 +0800
committerVincent Wang <vincentwang@google.com>2020-03-05 10:35:52 +0000
commit9ac1a03c1843dcf3cc60f63afecbfe13122a6d64 (patch)
tree909badbab3172293b899f96463471a5155ea2999 /health
parent6ec6b5bae5376a6f5de2a3d2bf462e52aa0c1176 (diff)
downloadbonito-9ac1a03c1843dcf3cc60f63afecbfe13122a6d64.tar.gz
Enable the battery defender
Battery defender aims to extend the life of the battery when a device is plugged in for too long (2 weeks). Test: Set BatteryDefender.h constructor thresholds to 1 minute. Ensure that the SOC charge thresholds change to 60/70 when connected to power for 1 minute. Bug: 146318912 Signed-off-by: Jack Wu <wjack@google.com> Change-Id: I47d21c5c557a1f478b6d5fa26c02b81f32432d3b
Diffstat (limited to 'health')
-rw-r--r--health/HealthService.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/health/HealthService.cpp b/health/HealthService.cpp
index cfbe339f..ffe96bb5 100644
--- a/health/HealthService.cpp
+++ b/health/HealthService.cpp
@@ -22,6 +22,7 @@
#include <health2/service.h>
#include <healthd/healthd.h>
#include <hidl/HidlTransportSupport.h>
+#include <pixelhealth/BatteryDefender.h>
#include <pixelhealth/BatteryMetricsLogger.h>
#include <pixelhealth/BatteryThermalControl.h>
#include <pixelhealth/CycleCountBackupRestore.h>
@@ -45,6 +46,7 @@ using android::hardware::health::V2_0::StorageInfo;
using ::device::google::bonito::health::BatteryRechargingControl;
using ::device::google::bonito::health::BatteryInfoUpdate;
using ::device::google::bonito::health::LearnedCapacityBackupRestore;
+using hardware::google::pixel::health::BatteryDefender;
using hardware::google::pixel::health::BatteryMetricsLogger;
using hardware::google::pixel::health::BatteryThermalControl;
using hardware::google::pixel::health::CycleCountBackupRestore;
@@ -57,6 +59,7 @@ constexpr char kBatteryOCV[] {FG_DIR "/bms/voltage_ocv"};
constexpr char kVoltageAvg[] {FG_DIR "/battery/voltage_now"};
constexpr char kCycleCountsBins[] {FG_DIR "/bms/device/cycle_counts_bins"};
+static BatteryDefender battDefender;
static BatteryRechargingControl battRechargingControl;
static BatteryInfoUpdate battInfoUpdate;
static BatteryThermalControl battThermalControl("sys/devices/virtual/thermal/tz-by-name/soc/mode");
@@ -109,6 +112,7 @@ void fill_emmc_storage_attribute(StorageAttribute* attr) {
void healthd_board_init(struct healthd_config*) {
ccBackupRestoreBMS.Restore();
lcBackupRestore.Restore();
+ battDefender.update();
}
int healthd_board_battery_update(struct android::BatteryProperties *props) {
@@ -120,6 +124,7 @@ int healthd_board_battery_update(struct android::BatteryProperties *props) {
shutdownMetrics.logShutdownVoltage(props);
ccBackupRestoreBMS.Backup(props->batteryLevel);
lcBackupRestore.Backup();
+ battDefender.update();
return 0;
}