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_manager.h>
#include <android/binder_process.h> #include <android/binder_process.h>
#include <log/log.h> #include <log/log.h>
#include <sys/stat.h>
using aidl::android::hardware::power::stats::DisplayStateResidencyDataProvider; using aidl::android::hardware::power::stats::DisplayStateResidencyDataProvider;
using aidl::android::hardware::power::stats::EnergyConsumerType; using aidl::android::hardware::power::stats::EnergyConsumerType;
@ -33,6 +34,9 @@ using aidl::android::hardware::power::stats::PowerStatsEnergyConsumer;
void addDisplay(std::shared_ptr<PowerStats> p) { void addDisplay(std::shared_ptr<PowerStats> p) {
// Add display residency stats // Add display residency stats
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 = { std::vector<std::string> states = {
"Off", "Off",
"LP: 1008x2244@1", "LP: 1008x2244@1",
@ -64,6 +68,10 @@ void addDisplay(std::shared_ptr<PowerStats> p) {
"Display", "Display",
"/sys/class/backlight/panel0-backlight/state", "/sys/class/backlight/panel0-backlight/state",
states)); states));
} else {
// time_in_state exists
addDisplayMRR(p);
}
// Add display energy consumer // Add display energy consumer
p->addEnergyConsumer(PowerStatsEnergyConsumer::createMeterConsumer( p->addEnergyConsumer(PowerStatsEnergyConsumer::createMeterConsumer(

View file

@ -26,6 +26,7 @@
#include <android/binder_manager.h> #include <android/binder_manager.h>
#include <android/binder_process.h> #include <android/binder_process.h>
#include <log/log.h> #include <log/log.h>
#include <sys/stat.h>
using aidl::android::hardware::power::stats::DisplayStateResidencyDataProvider; using aidl::android::hardware::power::stats::DisplayStateResidencyDataProvider;
using aidl::android::hardware::power::stats::EnergyConsumerType; using aidl::android::hardware::power::stats::EnergyConsumerType;
@ -33,6 +34,9 @@ using aidl::android::hardware::power::stats::PowerStatsEnergyConsumer;
void addDisplay(std::shared_ptr<PowerStats> p) { void addDisplay(std::shared_ptr<PowerStats> p) {
// Add display residency stats // Add display residency stats
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 = { std::vector<std::string> states = {
"Off", "Off",
"LP: 1080x2400@30", "LP: 1080x2400@30",
@ -45,6 +49,10 @@ void addDisplay(std::shared_ptr<PowerStats> p) {
"Display", "Display",
"/sys/class/backlight/panel0-backlight/state", "/sys/class/backlight/panel0-backlight/state",
states)); states));
} else {
// time_in_state exists
addDisplayMRR(p);
}
// Add display energy consumer // Add display energy consumer
p->addEnergyConsumer(PowerStatsEnergyConsumer::createMeterConsumer( p->addEnergyConsumer(PowerStatsEnergyConsumer::createMeterConsumer(