summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2024-01-24 19:44:18 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2024-01-24 19:44:18 +0000
commit3936e1f99dc00e373c5a0cc5d23db7939aa9d6ac (patch)
treec9aa34f14201754fd6eb9866d5a1b3f26c2ad005
parent0449ac0b60b3dd4f02a9bd3b30d57d7fe1c2777a (diff)
parentc230a1f64652368410307ecb9046cd26965c2b4f (diff)
downloadpixel-android14-qpr2-s3-release.tar.gz
Change-Id: I47ac1dbe3891c22186398647b9eed46863d7ad80
-rw-r--r--power-libperfmgr/aidl/Power.cpp41
-rw-r--r--power-libperfmgr/aidl/Power.h1
2 files changed, 42 insertions, 0 deletions
diff --git a/power-libperfmgr/aidl/Power.cpp b/power-libperfmgr/aidl/Power.cpp
index e15d985d..4bbbb447 100644
--- a/power-libperfmgr/aidl/Power.cpp
+++ b/power-libperfmgr/aidl/Power.cpp
@@ -83,6 +83,9 @@ Power::Power(std::shared_ptr<DisplayLowPower> dlpw)
LOG(INFO) << "Initialize with EXPENSIVE_RENDERING on";
HintManager::GetInstance()->DoHint("EXPENSIVE_RENDERING");
}
+
+ auto status = this->getInterfaceVersion(&mServiceVersion);
+ LOG(INFO) << "PowerHAL InterfaceVersion:" << mServiceVersion << " isOK: " << status.isOk();
}
ndk::ScopedAStatus Power::setMode(Mode type, bool enabled) {
@@ -178,6 +181,27 @@ ndk::ScopedAStatus Power::setMode(Mode type, bool enabled) {
}
ndk::ScopedAStatus Power::isModeSupported(Mode type, bool *_aidl_return) {
+ switch (mServiceVersion) {
+ case 5:
+ if (static_cast<int32_t>(type) <= static_cast<int32_t>(Mode::AUTOMOTIVE_PROJECTION))
+ break;
+ [[fallthrough]];
+ case 4:
+ [[fallthrough]];
+ case 3:
+ if (static_cast<int32_t>(type) <= static_cast<int32_t>(Mode::GAME_LOADING))
+ break;
+ [[fallthrough]];
+ case 2:
+ [[fallthrough]];
+ case 1:
+ if (static_cast<int32_t>(type) <= static_cast<int32_t>(Mode::CAMERA_STREAMING_HIGH))
+ break;
+ [[fallthrough]];
+ default:
+ *_aidl_return = false;
+ return ndk::ScopedAStatus::ok();
+ }
bool supported = HintManager::GetInstance()->IsHintSupported(toString(type));
// LOW_POWER handled insides PowerHAL specifically
if (type == Mode::LOW_POWER) {
@@ -233,6 +257,23 @@ ndk::ScopedAStatus Power::setBoost(Boost type, int32_t durationMs) {
}
ndk::ScopedAStatus Power::isBoostSupported(Boost type, bool *_aidl_return) {
+ switch (mServiceVersion) {
+ case 5:
+ [[fallthrough]];
+ case 4:
+ [[fallthrough]];
+ case 3:
+ [[fallthrough]];
+ case 2:
+ [[fallthrough]];
+ case 1:
+ if (static_cast<int32_t>(type) <= static_cast<int32_t>(Boost::CAMERA_SHOT))
+ break;
+ [[fallthrough]];
+ default:
+ *_aidl_return = false;
+ return ndk::ScopedAStatus::ok();
+ }
bool supported = HintManager::GetInstance()->IsHintSupported(toString(type));
if (!supported && HintManager::GetInstance()->IsAdpfProfileSupported(toString(type))) {
supported = true;
diff --git a/power-libperfmgr/aidl/Power.h b/power-libperfmgr/aidl/Power.h
index b7fd8f26..e256e34a 100644
--- a/power-libperfmgr/aidl/Power.h
+++ b/power-libperfmgr/aidl/Power.h
@@ -55,6 +55,7 @@ class Power : public ::aidl::android::hardware::power::BnPower {
std::unique_ptr<InteractionHandler> mInteractionHandler;
std::atomic<bool> mVRModeOn;
std::atomic<bool> mSustainedPerfModeOn;
+ int32_t mServiceVersion;
};
} // namespace pixel