power-libpergmgr: ADPF: extend non-stale session timer in wakeup

For DISPLAY_UPDATE_IMMINENT wakeup signal, non-stale
session's timer should be also extended. This resolves
the performance issue caused those sessions to go stale    
prematurely.

Bug: 241621485
Test: Build
Signed-off-by: Wei Wang <wvw@google.com>
Change-Id: I06330e064060248bb556ae35e0cb8fd302cef231
diff --git a/aidl/power-libperfmgr/PowerHintSession.cpp b/aidl/power-libperfmgr/PowerHintSession.cpp
index 2eea100..0ac0b4a 100644
--- a/aidl/power-libperfmgr/PowerHintSession.cpp
+++ b/aidl/power-libperfmgr/PowerHintSession.cpp
@@ -410,9 +410,16 @@
 void PowerHintSession::wakeup() {
     std::lock_guard<std::mutex> guard(mSessionLock);
 
-    // We only wake up non-paused and stale sessions
-    if (mSessionClosed || !isActive() || !isTimeout())
+    // We only wake up non-paused session
+    if (mSessionClosed || !isActive()) {
         return;
+    }
+    // Update session's timer
+    mStaleTimerHandler->updateTimer();
+    // Skip uclamp update for stale session
+    if (!isTimeout()) {
+        return;
+    }
     if (ATRACE_ENABLED()) {
         std::string tag = StringPrintf("wakeup.%s(a:%d,s:%d)", getIdString().c_str(), isActive(),
                                        isTimeout());
@@ -422,7 +429,6 @@
     int min = std::max(mDescriptor->current_min, static_cast<int>(adpfConfig->mUclampMinInit));
     mDescriptor->current_min = min;
     PowerSessionManager::getInstance()->setUclampMinLocked(this, min);
-    mStaleTimerHandler->updateTimer();
 
     if (ATRACE_ENABLED()) {
         const std::string idstr = getIdString();