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

Commit acc0b45c authored by David Anderson's avatar David Anderson Committed by Android (Google) Code Review
Browse files

Merge "healthd: Read battery manufacturing and first use dates as int64s." into main

parents 8aa1774b ebdd01e2
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