Loading cmds/statsd/src/atoms.proto +11 −0 Original line number Diff line number Diff line Loading @@ -168,6 +168,7 @@ message Atom { AppSize app_size = 10027; CategorySize category_size = 10028; android.service.procstats.ProcessStatsSectionProto proc_stats = 10029; BatteryVoltage battery_voltage = 10030; } // DO NOT USE field numbers above 100,000 in AOSP. Field numbers above Loading Loading @@ -2175,6 +2176,16 @@ message FullBatteryCapacity { optional int32 capacity_uAh = 1; } /** * Pulls battery voltage. * Pulled from: * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp */ message BatteryVoltage { // The voltage of the battery, in millivolts. optional int32 voltage_mV = 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. Loading cmds/statsd/src/external/ResourceHealthManagerPuller.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,7 @@ bool ResourceHealthManagerPuller::PullInternal(vector<shared_ptr<LogEvent>>* dat data->clear(); bool result_success = true; // Get the data from the Health HAL (hardware/interfaces/health/1.0/types.hal). Return<void> ret = gHealthHal->getHealthInfo([&](Result r, HealthInfo v) { if (r != Result::SUCCESS) { result_success = false; Loading @@ -84,6 +85,12 @@ bool ResourceHealthManagerPuller::PullInternal(vector<shared_ptr<LogEvent>>* dat ptr->write(v.legacy.batteryFullCharge); ptr->init(); data->push_back(ptr); } else if (mTagId == android::util::BATTERY_VOLTAGE) { auto ptr = make_shared<LogEvent>(android::util::BATTERY_VOLTAGE, wallClockTimestampNs, elapsedTimestampNs); ptr->write(v.legacy.batteryVoltage); ptr->init(); data->push_back(ptr); } else { ALOGE("Unsupported tag in ResourceHealthManagerPuller: %d", mTagId); } Loading cmds/statsd/src/external/StatsPullerManager.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -161,6 +161,12 @@ const std::map<int, PullAtomInfo> StatsPullerManager::kAllPullAtomInfo = { {}, 1 * NS_PER_SEC, new ResourceHealthManagerPuller(android::util::FULL_BATTERY_CAPACITY)}}, // battery_voltage {android::util::BATTERY_VOLTAGE, {{}, {}, 1 * NS_PER_SEC, new ResourceHealthManagerPuller(android::util::BATTERY_VOLTAGE)}}, // process_memory_state {android::util::PROCESS_MEMORY_STATE, {{4, 5, 6, 7, 8}, Loading Loading
cmds/statsd/src/atoms.proto +11 −0 Original line number Diff line number Diff line Loading @@ -168,6 +168,7 @@ message Atom { AppSize app_size = 10027; CategorySize category_size = 10028; android.service.procstats.ProcessStatsSectionProto proc_stats = 10029; BatteryVoltage battery_voltage = 10030; } // DO NOT USE field numbers above 100,000 in AOSP. Field numbers above Loading Loading @@ -2175,6 +2176,16 @@ message FullBatteryCapacity { optional int32 capacity_uAh = 1; } /** * Pulls battery voltage. * Pulled from: * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp */ message BatteryVoltage { // The voltage of the battery, in millivolts. optional int32 voltage_mV = 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. Loading
cmds/statsd/src/external/ResourceHealthManagerPuller.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,7 @@ bool ResourceHealthManagerPuller::PullInternal(vector<shared_ptr<LogEvent>>* dat data->clear(); bool result_success = true; // Get the data from the Health HAL (hardware/interfaces/health/1.0/types.hal). Return<void> ret = gHealthHal->getHealthInfo([&](Result r, HealthInfo v) { if (r != Result::SUCCESS) { result_success = false; Loading @@ -84,6 +85,12 @@ bool ResourceHealthManagerPuller::PullInternal(vector<shared_ptr<LogEvent>>* dat ptr->write(v.legacy.batteryFullCharge); ptr->init(); data->push_back(ptr); } else if (mTagId == android::util::BATTERY_VOLTAGE) { auto ptr = make_shared<LogEvent>(android::util::BATTERY_VOLTAGE, wallClockTimestampNs, elapsedTimestampNs); ptr->write(v.legacy.batteryVoltage); ptr->init(); data->push_back(ptr); } else { ALOGE("Unsupported tag in ResourceHealthManagerPuller: %d", mTagId); } Loading
cmds/statsd/src/external/StatsPullerManager.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -161,6 +161,12 @@ const std::map<int, PullAtomInfo> StatsPullerManager::kAllPullAtomInfo = { {}, 1 * NS_PER_SEC, new ResourceHealthManagerPuller(android::util::FULL_BATTERY_CAPACITY)}}, // battery_voltage {android::util::BATTERY_VOLTAGE, {{}, {}, 1 * NS_PER_SEC, new ResourceHealthManagerPuller(android::util::BATTERY_VOLTAGE)}}, // process_memory_state {android::util::PROCESS_MEMORY_STATE, {{4, 5, 6, 7, 8}, Loading