Loading healthd/BatteryMonitor.cpp +21 −16 Original line number Diff line number Diff line Loading @@ -715,6 +715,8 @@ void BatteryMonitor::dumpState(int fd) { char vs[128]; const HealthInfo& props = *mHealthInfo; snprintf(vs, sizeof(vs), "Cached HealthInfo:\n"); write(fd, vs, strlen(vs)); snprintf(vs, sizeof(vs), " ac: %d usb: %d wireless: %d dock: %d current_max: %d voltage_max: %d\n", props.chargerAcOnline, props.chargerUsbOnline, props.chargerWirelessOnline, Loading @@ -729,35 +731,38 @@ void BatteryMonitor::dumpState(int fd) { write(fd, vs, strlen(vs)); if (!mHealthdConfig->batteryCurrentNowPath.empty()) { v = getIntField(mHealthdConfig->batteryCurrentNowPath); snprintf(vs, sizeof(vs), "current now: %d\n", v); snprintf(vs, sizeof(vs), " current now: %d\n", props.batteryCurrentMicroamps); write(fd, vs, strlen(vs)); } if (!mHealthdConfig->batteryCurrentAvgPath.empty()) { v = getIntField(mHealthdConfig->batteryCurrentAvgPath); snprintf(vs, sizeof(vs), "current avg: %d\n", v); if (!mHealthdConfig->batteryCycleCountPath.empty()) { snprintf(vs, sizeof(vs), " cycle count: %d\n", props.batteryCycleCount); write(fd, vs, strlen(vs)); } if (!mHealthdConfig->batteryChargeCounterPath.empty()) { v = getIntField(mHealthdConfig->batteryChargeCounterPath); snprintf(vs, sizeof(vs), "charge counter: %d\n", v); if (!mHealthdConfig->batteryFullChargePath.empty()) { snprintf(vs, sizeof(vs), " Full charge: %d\n", props.batteryFullChargeUah); write(fd, vs, strlen(vs)); } snprintf(vs, sizeof(vs), "Real-time Values:\n"); write(fd, vs, strlen(vs)); if (!mHealthdConfig->batteryCurrentNowPath.empty()) { snprintf(vs, sizeof(vs), "current now: %d\n", props.batteryCurrentMicroamps); v = getIntField(mHealthdConfig->batteryCurrentNowPath); snprintf(vs, sizeof(vs), " current now: %d\n", v); write(fd, vs, strlen(vs)); } if (!mHealthdConfig->batteryCycleCountPath.empty()) { snprintf(vs, sizeof(vs), "cycle count: %d\n", props.batteryCycleCount); if (!mHealthdConfig->batteryCurrentAvgPath.empty()) { v = getIntField(mHealthdConfig->batteryCurrentAvgPath); snprintf(vs, sizeof(vs), " current avg: %d\n", v); write(fd, vs, strlen(vs)); } if (!mHealthdConfig->batteryFullChargePath.empty()) { snprintf(vs, sizeof(vs), "Full charge: %d\n", props.batteryFullChargeUah); if (!mHealthdConfig->batteryChargeCounterPath.empty()) { v = getIntField(mHealthdConfig->batteryChargeCounterPath); snprintf(vs, sizeof(vs), " charge counter: %d\n", v); write(fd, vs, strlen(vs)); } } Loading Loading
healthd/BatteryMonitor.cpp +21 −16 Original line number Diff line number Diff line Loading @@ -715,6 +715,8 @@ void BatteryMonitor::dumpState(int fd) { char vs[128]; const HealthInfo& props = *mHealthInfo; snprintf(vs, sizeof(vs), "Cached HealthInfo:\n"); write(fd, vs, strlen(vs)); snprintf(vs, sizeof(vs), " ac: %d usb: %d wireless: %d dock: %d current_max: %d voltage_max: %d\n", props.chargerAcOnline, props.chargerUsbOnline, props.chargerWirelessOnline, Loading @@ -729,35 +731,38 @@ void BatteryMonitor::dumpState(int fd) { write(fd, vs, strlen(vs)); if (!mHealthdConfig->batteryCurrentNowPath.empty()) { v = getIntField(mHealthdConfig->batteryCurrentNowPath); snprintf(vs, sizeof(vs), "current now: %d\n", v); snprintf(vs, sizeof(vs), " current now: %d\n", props.batteryCurrentMicroamps); write(fd, vs, strlen(vs)); } if (!mHealthdConfig->batteryCurrentAvgPath.empty()) { v = getIntField(mHealthdConfig->batteryCurrentAvgPath); snprintf(vs, sizeof(vs), "current avg: %d\n", v); if (!mHealthdConfig->batteryCycleCountPath.empty()) { snprintf(vs, sizeof(vs), " cycle count: %d\n", props.batteryCycleCount); write(fd, vs, strlen(vs)); } if (!mHealthdConfig->batteryChargeCounterPath.empty()) { v = getIntField(mHealthdConfig->batteryChargeCounterPath); snprintf(vs, sizeof(vs), "charge counter: %d\n", v); if (!mHealthdConfig->batteryFullChargePath.empty()) { snprintf(vs, sizeof(vs), " Full charge: %d\n", props.batteryFullChargeUah); write(fd, vs, strlen(vs)); } snprintf(vs, sizeof(vs), "Real-time Values:\n"); write(fd, vs, strlen(vs)); if (!mHealthdConfig->batteryCurrentNowPath.empty()) { snprintf(vs, sizeof(vs), "current now: %d\n", props.batteryCurrentMicroamps); v = getIntField(mHealthdConfig->batteryCurrentNowPath); snprintf(vs, sizeof(vs), " current now: %d\n", v); write(fd, vs, strlen(vs)); } if (!mHealthdConfig->batteryCycleCountPath.empty()) { snprintf(vs, sizeof(vs), "cycle count: %d\n", props.batteryCycleCount); if (!mHealthdConfig->batteryCurrentAvgPath.empty()) { v = getIntField(mHealthdConfig->batteryCurrentAvgPath); snprintf(vs, sizeof(vs), " current avg: %d\n", v); write(fd, vs, strlen(vs)); } if (!mHealthdConfig->batteryFullChargePath.empty()) { snprintf(vs, sizeof(vs), "Full charge: %d\n", props.batteryFullChargeUah); if (!mHealthdConfig->batteryChargeCounterPath.empty()) { v = getIntField(mHealthdConfig->batteryChargeCounterPath); snprintf(vs, sizeof(vs), " charge counter: %d\n", v); write(fd, vs, strlen(vs)); } } Loading