From c99c3228cf782199614600ac1a69f2b692613549 Mon Sep 17 00:00:00 2001 From: Adithya Date: Sun, 13 Feb 2022 22:56:13 +0800 Subject: [PATCH] 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 Signed-off-by: clarencelol Signed-off-by: pix106 --- power-libperfmgr/aidl/Power.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/power-libperfmgr/aidl/Power.cpp b/power-libperfmgr/aidl/Power.cpp index a1691d90..8c6ff109 100644 --- a/power-libperfmgr/aidl/Power.cpp +++ b/power-libperfmgr/aidl/Power.cpp @@ -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 {