Snap for 11251507 from e06316882e to 24Q2-release

Change-Id: I77425096248e04656b63ea1d0778515680560c51
This commit is contained in:
Android Build Coastguard Worker 2023-12-23 02:03:14 +00:00
commit 5226988f25
2 changed files with 57 additions and 41 deletions

View file

@ -26,6 +26,7 @@
#include <android/binder_manager.h>
#include <android/binder_process.h>
#include <log/log.h>
#include <sys/stat.h>
using aidl::android::hardware::power::stats::DisplayStateResidencyDataProvider;
using aidl::android::hardware::power::stats::EnergyConsumerType;
@ -33,37 +34,44 @@ using aidl::android::hardware::power::stats::PowerStatsEnergyConsumer;
void addDisplay(std::shared_ptr<PowerStats> p) {
// Add display residency stats
std::vector<std::string> states = {
"Off",
"LP: 1008x2244@1",
"LP: 1008x2244@30",
"On: 1008x2244@1",
"On: 1008x2244@10",
"On: 1008x2244@30",
"On: 1008x2244@60",
"On: 1008x2244@120",
"HBM: 1008x2244@1",
"HBM: 1008x2244@10",
"HBM: 1008x2244@30",
"HBM: 1008x2244@60",
"HBM: 1008x2244@120",
"LP: 1344x2992@1",
"LP: 1344x2992@30",
"On: 1344x2992@1",
"On: 1344x2992@10",
"On: 1344x2992@30",
"On: 1344x2992@60",
"On: 1344x2992@120",
"HBM: 1344x2992@1",
"HBM: 1344x2992@10",
"HBM: 1344x2992@30",
"HBM: 1344x2992@60",
"HBM: 1344x2992@120"};
struct stat buffer;
if (stat("/sys/class/backlight/panel0-backlight/time_in_state", &buffer)) {
// time_in_state doesn't exist
std::vector<std::string> states = {
"Off",
"LP: 1008x2244@1",
"LP: 1008x2244@30",
"On: 1008x2244@1",
"On: 1008x2244@10",
"On: 1008x2244@30",
"On: 1008x2244@60",
"On: 1008x2244@120",
"HBM: 1008x2244@1",
"HBM: 1008x2244@10",
"HBM: 1008x2244@30",
"HBM: 1008x2244@60",
"HBM: 1008x2244@120",
"LP: 1344x2992@1",
"LP: 1344x2992@30",
"On: 1344x2992@1",
"On: 1344x2992@10",
"On: 1344x2992@30",
"On: 1344x2992@60",
"On: 1344x2992@120",
"HBM: 1344x2992@1",
"HBM: 1344x2992@10",
"HBM: 1344x2992@30",
"HBM: 1344x2992@60",
"HBM: 1344x2992@120"};
p->addStateResidencyDataProvider(std::make_unique<DisplayStateResidencyDataProvider>(
"Display",
"/sys/class/backlight/panel0-backlight/state",
states));
p->addStateResidencyDataProvider(std::make_unique<DisplayStateResidencyDataProvider>(
"Display",
"/sys/class/backlight/panel0-backlight/state",
states));
} else {
// time_in_state exists
addDisplayMRR(p);
}
// Add display energy consumer
p->addEnergyConsumer(PowerStatsEnergyConsumer::createMeterConsumer(

View file

@ -26,6 +26,7 @@
#include <android/binder_manager.h>
#include <android/binder_process.h>
#include <log/log.h>
#include <sys/stat.h>
using aidl::android::hardware::power::stats::DisplayStateResidencyDataProvider;
using aidl::android::hardware::power::stats::EnergyConsumerType;
@ -33,18 +34,25 @@ using aidl::android::hardware::power::stats::PowerStatsEnergyConsumer;
void addDisplay(std::shared_ptr<PowerStats> p) {
// Add display residency stats
std::vector<std::string> states = {
"Off",
"LP: 1080x2400@30",
"On: 1080x2400@60",
"On: 1080x2400@120",
"HBM: 1080x2400@60",
"HBM: 1080x2400@120"};
struct stat buffer;
if (stat("/sys/class/backlight/panel0-backlight/time_in_state", &buffer)) {
// time_in_state doesn't exist
std::vector<std::string> states = {
"Off",
"LP: 1080x2400@30",
"On: 1080x2400@60",
"On: 1080x2400@120",
"HBM: 1080x2400@60",
"HBM: 1080x2400@120"};
p->addStateResidencyDataProvider(std::make_unique<DisplayStateResidencyDataProvider>(
"Display",
"/sys/class/backlight/panel0-backlight/state",
states));
p->addStateResidencyDataProvider(std::make_unique<DisplayStateResidencyDataProvider>(
"Display",
"/sys/class/backlight/panel0-backlight/state",
states));
} else {
// time_in_state exists
addDisplayMRR(p);
}
// Add display energy consumer
p->addEnergyConsumer(PowerStatsEnergyConsumer::createMeterConsumer(