powerstats: add GNSS power stats for ZP devices

Bug: 309876364
Test: dumpsys android.hardware.power.stats.IPowerStats/default
Change-Id: I22cefaf0762e0c125ad4a1b6c0f0b11847df44a3
Signed-off-by: Darren Hsu <darrenhsu@google.com>
This commit is contained in:
Darren Hsu 2024-02-19 16:29:19 +08:00
parent 7ca84dbfea
commit f5f7a90578

View file

@ -427,9 +427,12 @@ void addGNSS(std::shared_ptr<PowerStats> p)
.lastEntryTransform = gnssUsToMs, .lastEntryTransform = gnssUsToMs,
}; };
// External GNSS power stats are controlled by GPS chip side. The power stats
// would not update while GPS chip is down. This means that GPS OFF state
// residency won't reflect the elapsed off time. So only GPS ON state
// residency is present.
const std::vector<std::pair<std::string, std::string>> gnssStateHeaders = { const std::vector<std::pair<std::string, std::string>> gnssStateHeaders = {
std::make_pair("ON", "GPS_ON:"), std::make_pair("ON", "GPS_ON:"),
std::make_pair("OFF", "GPS_OFF:"),
}; };
std::vector<GenericStateResidencyDataProvider::PowerEntityConfig> cfgs; std::vector<GenericStateResidencyDataProvider::PowerEntityConfig> cfgs;
@ -437,10 +440,7 @@ void addGNSS(std::shared_ptr<PowerStats> p)
"GPS", ""); "GPS", "");
p->addStateResidencyDataProvider(std::make_unique<GenericStateResidencyDataProvider>( p->addStateResidencyDataProvider(std::make_unique<GenericStateResidencyDataProvider>(
"/dev/bbd_pwrstat", cfgs)); "/data/vendor/gps/power_stats", cfgs));
p->addEnergyConsumer(PowerStatsEnergyConsumer::createMeterConsumer(p,
EnergyConsumerType::GNSS, "GPS", {"L9S_GNSS_CORE"}));
} }
void addPCIe(std::shared_ptr<PowerStats> p) { void addPCIe(std::shared_ptr<PowerStats> p) {