Merge "healthd: Read battery manufacturing and first use dates as int64s." into main
diff --git a/healthd/BatteryMonitor.cpp b/healthd/BatteryMonitor.cpp
index 0e75033..64c85e2 100644
--- a/healthd/BatteryMonitor.cpp
+++ b/healthd/BatteryMonitor.cpp
@@ -342,9 +342,10 @@
return value;
}
-static int getIntField(const String8& path) {
+template <typename T = int>
+static T getIntField(const String8& path) {
std::string buf;
- int value = 0;
+ T value = 0;
if (readFromFile(path, &buf) > 0)
android::base::ParseInt(buf, &value);
@@ -416,11 +417,11 @@
if (!mHealthdConfig->batteryManufacturingDatePath.empty())
ensureBatteryHealthData(mHealthInfo.get())->batteryManufacturingDateSeconds =
- getIntField(mHealthdConfig->batteryManufacturingDatePath);
+ getIntField<int64_t>(mHealthdConfig->batteryManufacturingDatePath);
if (!mHealthdConfig->batteryFirstUsageDatePath.empty())
ensureBatteryHealthData(mHealthInfo.get())->batteryFirstUsageSeconds =
- getIntField(mHealthdConfig->batteryFirstUsageDatePath);
+ getIntField<int64_t>(mHealthdConfig->batteryFirstUsageDatePath);
mHealthInfo->batteryTemperatureTenthsCelsius =
mBatteryFixedTemperature ? mBatteryFixedTemperature