diff options
author | Qiwen Zhao <zhao@google.com> | 2015-11-19 16:30:32 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2015-11-19 16:30:32 +0000 |
commit | 7ac8cacdfeb9f6b4cb0086616c3168178488f324 (patch) | |
tree | 5b2ccc249dd99d1e4ba469c877dd35afce7534cb /healthd | |
parent | 64b8f7dbeda2ea921744aae9ddd4b2928684935f (diff) | |
parent | 09aa2f9b2c34339878dfd218d1c6e09644a108b0 (diff) | |
download | system_core-7ac8cacdfeb9f6b4cb0086616c3168178488f324.tar.gz system_core-7ac8cacdfeb9f6b4cb0086616c3168178488f324.tar.bz2 system_core-7ac8cacdfeb9f6b4cb0086616c3168178488f324.zip |
Merge remote-tracking branch \'origin/mnc-dr2-dev\' into mnc-dr2-dev-plus-aosp
am: 09aa2f9b2c
* commit '09aa2f9b2c34339878dfd218d1c6e09644a108b0':
Fix build break with uninitialized boost_fd.
Improve cpuset support for surfaceflinger.
liblog: printable do not escape tabs
libutils: Add UNEXPECTED_NULL status_t
Diffstat (limited to 'healthd')
-rw-r--r-- | healthd/BatteryMonitor.cpp | 31 |
1 files changed, 7 insertions, 24 deletions
diff --git a/healthd/BatteryMonitor.cpp b/healthd/BatteryMonitor.cpp index 582821d21..3e618c0b1 100644 --- a/healthd/BatteryMonitor.cpp +++ b/healthd/BatteryMonitor.cpp @@ -40,8 +40,6 @@ #define FAKE_BATTERY_CAPACITY 42 #define FAKE_BATTERY_TEMPERATURE 424 #define ALWAYS_PLUGGED_CAPACITY 100 -#define MILLION 10000000.0 -#define DEFAULT_VBUS_VOLTAGE 5000000 namespace android { @@ -190,7 +188,6 @@ bool BatteryMonitor::update(void) { props.batteryStatus = BATTERY_STATUS_UNKNOWN; props.batteryHealth = BATTERY_HEALTH_UNKNOWN; props.maxChargingCurrent = 0; - props.maxChargingVoltage = 0; if (!mHealthdConfig->batteryPresentPath.isEmpty()) props.batteryPresent = getBooleanField(mHealthdConfig->batteryPresentPath); @@ -238,7 +235,6 @@ bool BatteryMonitor::update(void) { props.batteryTechnology = String8(buf); unsigned int i; - double MaxPower = 0; for (i = 0; i < mChargerNames.size(); i++) { String8 path; @@ -267,23 +263,11 @@ bool BatteryMonitor::update(void) { path.clear(); path.appendFormat("%s/%s/current_max", POWER_SUPPLY_SYSFS_PATH, mChargerNames[i].string()); - int ChargingCurrent = - (access(path.string(), R_OK) == 0) ? getIntField(path) : 0; - - path.clear(); - path.appendFormat("%s/%s/voltage_max", POWER_SUPPLY_SYSFS_PATH, - mChargerNames[i].string()); - - int ChargingVoltage = - (access(path.string(), R_OK) == 0) ? getIntField(path) : - DEFAULT_VBUS_VOLTAGE; - - double power = ((double)ChargingCurrent / MILLION) * - ((double)ChargingVoltage / MILLION); - if (MaxPower < power) { - props.maxChargingCurrent = ChargingCurrent; - props.maxChargingVoltage = ChargingVoltage; - MaxPower = power; + if (access(path.string(), R_OK) == 0) { + int maxChargingCurrent = getIntField(path); + if (props.maxChargingCurrent < maxChargingCurrent) { + props.maxChargingCurrent = maxChargingCurrent; + } } } } @@ -421,10 +405,9 @@ void BatteryMonitor::dumpState(int fd) { int v; char vs[128]; - snprintf(vs, sizeof(vs), "ac: %d usb: %d wireless: %d current_max: %d voltage_max: %d\n", + snprintf(vs, sizeof(vs), "ac: %d usb: %d wireless: %d current_max: %d\n", props.chargerAcOnline, props.chargerUsbOnline, - props.chargerWirelessOnline, props.maxChargingCurrent, - props.maxChargingVoltage); + 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); |