diff --git a/powerstats/Gs201CommonDataProviders.cpp b/powerstats/Gs201CommonDataProviders.cpp index 6232a6e0..4ce104fb 100644 --- a/powerstats/Gs201CommonDataProviders.cpp +++ b/powerstats/Gs201CommonDataProviders.cpp @@ -16,7 +16,7 @@ #include #include -#include +#include #include #include #include @@ -32,7 +32,7 @@ #include #include -using aidl::android::hardware::power::stats::AocStateResidencyDataProvider; +using aidl::android::hardware::power::stats::AocTimedStateResidencyDataProvider; using aidl::android::hardware::power::stats::DevfreqStateResidencyDataProvider; using aidl::android::hardware::power::stats::DvfsStateResidencyDataProvider; using aidl::android::hardware::power::stats::UfsStateResidencyDataProvider; @@ -102,6 +102,8 @@ void addPlaceholderEnergyConsumers(std::shared_ptr p) { } void addAoC(std::shared_ptr p) { + // When the given timeout is 0, the timeout will be replaced with "120ms * statesCount". + static const uint64_t TIMEOUT_MILLIS = 0; std::string prefix = "/sys/devices/platform/19000000.aoc/control/"; // Add AoC cores (a32, ff1, hf0, and hf1) @@ -113,8 +115,8 @@ void addAoC(std::shared_ptr p) { }; std::vector> coreStates = { {"DWN", "off"}, {"RET", "retention"}, {"WFI", "wfi"}}; - p->addStateResidencyDataProvider(std::make_unique(coreIds, - coreStates)); + p->addStateResidencyDataProvider(std::make_unique(coreIds, + coreStates, TIMEOUT_MILLIS)); // Add AoC voltage stats std::vector> voltageIds = { @@ -125,7 +127,8 @@ void addAoC(std::shared_ptr p) { {"UUD", "ultra_underdrive"}, {"UD", "underdrive"}}; p->addStateResidencyDataProvider( - std::make_unique(voltageIds, voltageStates)); + std::make_unique(voltageIds, voltageStates, + TIMEOUT_MILLIS)); // Add AoC monitor mode std::vector> monitorIds = { @@ -135,7 +138,8 @@ void addAoC(std::shared_ptr p) { {"MON", "mode"}, }; p->addStateResidencyDataProvider( - std::make_unique(monitorIds, monitorStates)); + std::make_unique(monitorIds, monitorStates, + TIMEOUT_MILLIS)); // Add AoC restart count const GenericStateResidencyDataProvider::StateResidencyConfig restartCountConfig = { @@ -642,9 +646,7 @@ void addGs201CommonDataProviders(std::shared_ptr p) { setEnergyMeter(p); addPixelStateResidencyDataProvider(p); - // TODO(b/220032540): Re-enable AoC reporting when AoC long latency issue is fixed or - // the timeout mechanism is merged. - //addAoC(p); + addAoC(p); addDvfsStats(p); addSoC(p); addCPUclusters(p);