Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ebdd01e2 authored by David Anderson's avatar David Anderson
Browse files

healthd: Read battery manufacturing and first use dates as int64s.

Bug: 403653167
Test: builds
Change-Id: Ib3fb506059425824d866901b2c1ebe9f970bdf3a
parent ddaa6e2b
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -342,9 +342,10 @@ static bool getBooleanField(const String8& path) {
    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 @@ void BatteryMonitor::updateValues(void) {

    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