sdm660-common; 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

[1] https://android.googlesource.com/platform/cts/+/refs/heads/master/hostsidetests/sustainedperf

Change-Id: I672195fc6f7aba91928e2ab6147a6a7cac51f459
Signed-off-by: chiru2000 <chiranth@m.ms.evolution-x.org>
Signed-off-by: clarencelol <clarencekuiek@icloud.com>
Signed-off-by: pix106 <sbordenave@gmail.com>
This commit is contained in:
Adithya 2022-02-13 22:56:13 +08:00 committed by pix106
parent 3f57e8df24
commit c99c3228cf

View file

@ -119,14 +119,14 @@ ndk::ScopedAStatus Power::setMode(Mode type, bool enabled) {
break;
case Mode::SUSTAINED_PERFORMANCE:
if (enabled) {
endAllHints(mHintManager);
mHintManager->DoHint("SUSTAINED_PERFORMANCE");
} else {
mHintManager->EndHint("SUSTAINED_PERFORMANCE");
}
mSustainedPerfModeOn = true;
mSustainedPerfModeOn = enabled;
break;
case Mode::LAUNCH:
if (mSustainedPerfModeOn) {
break;
}
[[fallthrough]];
case Mode::FIXED_PERFORMANCE:
[[fallthrough]];
@ -141,7 +141,9 @@ ndk::ScopedAStatus Power::setMode(Mode type, bool enabled) {
case Mode::AUDIO_STREAMING_LOW_LATENCY:
[[fallthrough]];
default:
if (mBatterySaverOn) break;
if (mBatterySaverOn || mSustainedPerfModeOn) {
break;
}
if (enabled) {
mHintManager->DoHint(toString(type));
} else {