Loading healthd/BatteryMonitor.cpp +10 −18 Original line number Diff line number Diff line Loading @@ -170,7 +170,6 @@ int BatteryMonitor::getIntField(const String8& path) { } bool BatteryMonitor::update(void) { struct BatteryExtraProperties extraProps; bool logthis; props.chargerAcOnline = false; Loading @@ -178,8 +177,6 @@ bool BatteryMonitor::update(void) { props.chargerWirelessOnline = false; props.batteryStatus = BATTERY_STATUS_UNKNOWN; props.batteryHealth = BATTERY_HEALTH_UNKNOWN; extraProps.batteryCurrentNow = INT_MIN; extraProps.batteryChargeCounter = INT_MIN; if (!mHealthdConfig->batteryPresentPath.isEmpty()) props.batteryPresent = getBooleanField(mHealthdConfig->batteryPresentPath); Loading @@ -189,13 +186,6 @@ bool BatteryMonitor::update(void) { props.batteryLevel = getIntField(mHealthdConfig->batteryCapacityPath); props.batteryVoltage = getIntField(mHealthdConfig->batteryVoltagePath) / 1000; if (!mHealthdConfig->batteryCurrentNowPath.isEmpty()) extraProps.batteryCurrentNow = getIntField(mHealthdConfig->batteryCurrentNowPath); /* temporary while dumpsys being reworked */ if (!mHealthdConfig->batteryChargeCounterPath.isEmpty()) extraProps.batteryChargeCounter = getIntField(mHealthdConfig->batteryChargeCounterPath); props.batteryTemperature = getIntField(mHealthdConfig->batteryTemperaturePath); const int SIZE = 128; Loading Loading @@ -246,7 +236,7 @@ bool BatteryMonitor::update(void) { if (logthis) { char dmesgline[256]; if (props.batteryPresent) if (props.batteryPresent) { snprintf(dmesgline, sizeof(dmesgline), "battery l=%d v=%d t=%s%d.%d h=%d st=%d", props.batteryLevel, props.batteryVoltage, Loading @@ -254,16 +244,18 @@ bool BatteryMonitor::update(void) { abs(props.batteryTemperature / 10), abs(props.batteryTemperature % 10), props.batteryHealth, props.batteryStatus); else snprintf(dmesgline, sizeof(dmesgline), "battery none"); if (!mHealthdConfig->batteryCurrentNowPath.isEmpty()) { int c = getIntField(mHealthdConfig->batteryCurrentNowPath); char b[20]; snprintf(b, sizeof(b), " c=%d", extraProps.batteryCurrentNow / 1000); snprintf(b, sizeof(b), " c=%d", c / 1000); strlcat(dmesgline, b, sizeof(dmesgline)); } } else { snprintf(dmesgline, sizeof(dmesgline), "battery none"); } KLOG_INFO(LOG_TAG, "%s chg=%s%s%s\n", dmesgline, props.chargerAcOnline ? "a" : "", Loading Loading
healthd/BatteryMonitor.cpp +10 −18 Original line number Diff line number Diff line Loading @@ -170,7 +170,6 @@ int BatteryMonitor::getIntField(const String8& path) { } bool BatteryMonitor::update(void) { struct BatteryExtraProperties extraProps; bool logthis; props.chargerAcOnline = false; Loading @@ -178,8 +177,6 @@ bool BatteryMonitor::update(void) { props.chargerWirelessOnline = false; props.batteryStatus = BATTERY_STATUS_UNKNOWN; props.batteryHealth = BATTERY_HEALTH_UNKNOWN; extraProps.batteryCurrentNow = INT_MIN; extraProps.batteryChargeCounter = INT_MIN; if (!mHealthdConfig->batteryPresentPath.isEmpty()) props.batteryPresent = getBooleanField(mHealthdConfig->batteryPresentPath); Loading @@ -189,13 +186,6 @@ bool BatteryMonitor::update(void) { props.batteryLevel = getIntField(mHealthdConfig->batteryCapacityPath); props.batteryVoltage = getIntField(mHealthdConfig->batteryVoltagePath) / 1000; if (!mHealthdConfig->batteryCurrentNowPath.isEmpty()) extraProps.batteryCurrentNow = getIntField(mHealthdConfig->batteryCurrentNowPath); /* temporary while dumpsys being reworked */ if (!mHealthdConfig->batteryChargeCounterPath.isEmpty()) extraProps.batteryChargeCounter = getIntField(mHealthdConfig->batteryChargeCounterPath); props.batteryTemperature = getIntField(mHealthdConfig->batteryTemperaturePath); const int SIZE = 128; Loading Loading @@ -246,7 +236,7 @@ bool BatteryMonitor::update(void) { if (logthis) { char dmesgline[256]; if (props.batteryPresent) if (props.batteryPresent) { snprintf(dmesgline, sizeof(dmesgline), "battery l=%d v=%d t=%s%d.%d h=%d st=%d", props.batteryLevel, props.batteryVoltage, Loading @@ -254,16 +244,18 @@ bool BatteryMonitor::update(void) { abs(props.batteryTemperature / 10), abs(props.batteryTemperature % 10), props.batteryHealth, props.batteryStatus); else snprintf(dmesgline, sizeof(dmesgline), "battery none"); if (!mHealthdConfig->batteryCurrentNowPath.isEmpty()) { int c = getIntField(mHealthdConfig->batteryCurrentNowPath); char b[20]; snprintf(b, sizeof(b), " c=%d", extraProps.batteryCurrentNow / 1000); snprintf(b, sizeof(b), " c=%d", c / 1000); strlcat(dmesgline, b, sizeof(dmesgline)); } } else { snprintf(dmesgline, sizeof(dmesgline), "battery none"); } KLOG_INFO(LOG_TAG, "%s chg=%s%s%s\n", dmesgline, props.chargerAcOnline ? "a" : "", Loading