power-libperfmgr: Properly handle sustained performance mode
* when tested with [1], even after exiting the app, spm was
still active in powerhal thereby keeping max freqs limited
and blocking boosts
* enable/disable it properly and end all other hints before
enabling, to fix this issue
* while we're at it, don't handle max freq for anything other
than spm in powerhint
[1] https://android.googlesource.com/platform/cts/+/refs/heads/master/hostsidetests/sustainedperf
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
Change-Id: I8962b86a3bb2509021daf7ed00507bccc4f532e0
diff --git a/aidl/power-libperfmgr/Power.cpp b/aidl/power-libperfmgr/Power.cpp
index f2a5b3b..7722a8e 100644
--- a/aidl/power-libperfmgr/Power.cpp
+++ b/aidl/power-libperfmgr/Power.cpp
@@ -105,9 +105,12 @@
#endif
case Mode::SUSTAINED_PERFORMANCE:
if (enabled) {
+ endAllHints();
HintManager::GetInstance()->DoHint("SUSTAINED_PERFORMANCE");
+ } else {
+ HintManager::GetInstance()->EndHint("SUSTAINED_PERFORMANCE");
}
- mSustainedPerfModeOn = true;
+ mSustainedPerfModeOn = enabled;
break;
case Mode::LOW_POWER:
if (enabled) {
@@ -119,9 +122,6 @@
mBatterySaverOn = enabled;
break;
case Mode::LAUNCH:
- if (mSustainedPerfModeOn) {
- break;
- }
[[fallthrough]];
#ifndef TAP_TO_WAKE_NODE
case Mode::DOUBLE_TAP_TO_WAKE:
@@ -140,7 +140,9 @@
case Mode::AUDIO_STREAMING_LOW_LATENCY:
[[fallthrough]];
default:
- if (mBatterySaverOn) break;
+ if (mBatterySaverOn || mSustainedPerfModeOn) {
+ break;
+ }
if (enabled) {
HintManager::GetInstance()->DoHint(toString(type));
} else {