diff options
author | Adrian Roos <roosa@google.com> | 2015-07-10 13:11:01 -0700 |
---|---|---|
committer | Adrian Roos <roosa@google.com> | 2015-07-13 17:33:07 -0700 |
commit | d5fe6675a73c3a831d0c4e41343ee86772633db8 (patch) | |
tree | 640695fb75de5d492743a58aa7fc25f60418a854 /healthd/BatteryMonitor.cpp | |
parent | 2407ec386514e40c5b4f2489c598b15af2a67c97 (diff) | |
download | system_core-d5fe6675a73c3a831d0c4e41343ee86772633db8.zip system_core-d5fe6675a73c3a831d0c4e41343ee86772633db8.tar.gz system_core-d5fe6675a73c3a831d0c4e41343ee86772633db8.tar.bz2 |
Show charging speed on Keyguard
Bug: 8099739
Change-Id: I2e5c21dd7ec028ce47fb03ab71e74f7fccaa9e36
Diffstat (limited to 'healthd/BatteryMonitor.cpp')
-rw-r--r-- | healthd/BatteryMonitor.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/healthd/BatteryMonitor.cpp b/healthd/BatteryMonitor.cpp index 7ea8250..c75ed13 100644 --- a/healthd/BatteryMonitor.cpp +++ b/healthd/BatteryMonitor.cpp @@ -181,6 +181,7 @@ bool BatteryMonitor::update(void) { props.chargerWirelessOnline = false; props.batteryStatus = BATTERY_STATUS_UNKNOWN; props.batteryHealth = BATTERY_HEALTH_UNKNOWN; + props.maxChargingCurrent = 0; if (!mHealthdConfig->batteryPresentPath.isEmpty()) props.batteryPresent = getBooleanField(mHealthdConfig->batteryPresentPath); @@ -235,6 +236,15 @@ bool BatteryMonitor::update(void) { KLOG_WARNING(LOG_TAG, "%s: Unknown power supply type\n", mChargerNames[i].string()); } + path.clear(); + path.appendFormat("%s/%s/current_max", POWER_SUPPLY_SYSFS_PATH, + mChargerNames[i].string()); + if (access(path.string(), R_OK) == 0) { + int maxChargingCurrent = getIntField(path); + if (props.maxChargingCurrent < maxChargingCurrent) { + props.maxChargingCurrent = maxChargingCurrent; + } + } } } } @@ -341,9 +351,9 @@ void BatteryMonitor::dumpState(int fd) { int v; char vs[128]; - snprintf(vs, sizeof(vs), "ac: %d usb: %d wireless: %d\n", + snprintf(vs, sizeof(vs), "ac: %d usb: %d wireless: %d current_max: %d\n", props.chargerAcOnline, props.chargerUsbOnline, - props.chargerWirelessOnline); + props.chargerWirelessOnline, props.maxChargingCurrent); write(fd, vs, strlen(vs)); snprintf(vs, sizeof(vs), "status: %d health: %d present: %d\n", props.batteryStatus, props.batteryHealth, props.batteryPresent); |