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

Commit 17c11326 authored by Tej Singh's avatar Tej Singh Committed by Android (Google) Code Review
Browse files

Merge "Atom: Pulled battery level"

parents 84b031fe b1dbc8b4
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -204,6 +204,7 @@ message Atom {
        DeviceCalculatedPowerBlameUid device_calculated_power_blame_uid = 10040;
        DeviceCalculatedPowerBlameOther device_calculated_power_blame_other = 10041;
        ProcessMemoryHighWaterMark process_memory_high_water_mark = 10042;
        BatteryLevel battery_level = 10043;
    }

    // DO NOT USE field numbers above 100,000 in AOSP.
@@ -2678,6 +2679,17 @@ message BatteryVoltage {
    optional int32 voltage_millivolt = 1;
}

/**
 * Pulls battery level (percent full, from 0 to 100).
 *
 * Pulled from:
 *   frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
 */
message BatteryLevel {
    // Battery level. Should be in [0, 100].
    optional int32 battery_level = 1;
}

/**
 * Pulls the temperature of various parts of the device.
 * The units are tenths of a degree Celsius. Eg: 30.3C is reported as 303.
+6 −0
Original line number Diff line number Diff line
@@ -91,6 +91,12 @@ bool ResourceHealthManagerPuller::PullInternal(vector<shared_ptr<LogEvent>>* dat
            ptr->write(v.legacy.batteryVoltage);
            ptr->init();
            data->push_back(ptr);
        } else if (mTagId == android::util::BATTERY_LEVEL) {
                     auto ptr = make_shared<LogEvent>(android::util::BATTERY_LEVEL,
                         wallClockTimestampNs, elapsedTimestampNs);
                     ptr->write(v.legacy.batteryLevel);
                     ptr->init();
                     data->push_back(ptr);
        } else {
            ALOGE("Unsupported tag in ResourceHealthManagerPuller: %d", mTagId);
        }
+3 −0
Original line number Diff line number Diff line
@@ -168,6 +168,9 @@ const std::map<int, PullAtomInfo> StatsPullerManager::kAllPullAtomInfo = {
        // battery_voltage
        {android::util::BATTERY_VOLTAGE,
         {{}, {}, 1 * NS_PER_SEC, new ResourceHealthManagerPuller(android::util::BATTERY_VOLTAGE)}},
         // battery_voltage
        {android::util::BATTERY_LEVEL,
         {{}, {}, 1 * NS_PER_SEC, new ResourceHealthManagerPuller(android::util::BATTERY_LEVEL)}},
        // process_memory_state
        {android::util::PROCESS_MEMORY_STATE,
         {{4, 5, 6, 7, 8, 9},