mirror of
https://github.com/Evolution-X-Devices/device_google_redbull
synced 2026-01-28 16:29:11 +00:00
Enable PowerStatsHAL to read NFC power state stats am: ac23c7b959 am: 461e243d13
Original change: https://android-review.googlesource.com/c/device/google/redbull/+/1971422 Change-Id: I55dfc20367e095a07b40f9f3ffc2c41e2b4c7ab3
This commit is contained in:
@@ -137,6 +137,30 @@ int main(int /* argc */, char ** /* argv */) {
|
||||
std::vector<std::string>{"Off", "LP", "1080x2340@60", "1080x2340@90"});
|
||||
service->addStateResidencyDataProvider(displaySdp);
|
||||
|
||||
// Add NFC power entity
|
||||
StateResidencyConfig nfcStateConfig = {
|
||||
.entryCountSupported = true,
|
||||
.entryCountPrefix = "Cumulative count:",
|
||||
.totalTimeSupported = true,
|
||||
.totalTimePrefix = "Cumulative duration msec:",
|
||||
.lastEntrySupported = true,
|
||||
.lastEntryPrefix = "Last entry timestamp msec:"
|
||||
};
|
||||
std::vector<std::pair<std::string, std::string>> nfcStateHeaders = {
|
||||
std::make_pair("Idle", "Idle mode:"),
|
||||
std::make_pair("Active", "Active mode:"),
|
||||
std::make_pair("Active-RW", "Active Reader/Writer mode:"),
|
||||
};
|
||||
|
||||
sp<GenericStateResidencyDataProvider> nfcSdp =
|
||||
new GenericStateResidencyDataProvider("/sys/class/misc/st21nfc/device/power_stats");
|
||||
|
||||
uint32_t nfcId = service->addPowerEntity("NFC", PowerEntityType::SUBSYSTEM);
|
||||
nfcSdp->addEntity(nfcId,
|
||||
PowerEntityConfig(generateGenericStateResidencyConfigs(nfcStateConfig, nfcStateHeaders)));
|
||||
|
||||
service->addStateResidencyDataProvider(nfcSdp);
|
||||
|
||||
// Add Power Entities that require the Aidl data provider
|
||||
auto aidlSdp = sp<AidlStateResidencyDataProvider>::make();
|
||||
uint32_t citadelId = service->addPowerEntity("Citadel", PowerEntityType::SUBSYSTEM);
|
||||
|
||||
Reference in New Issue
Block a user