diff --git a/aidl/power-libperfmgr/PowerHintSession.cpp b/aidl/power-libperfmgr/PowerHintSession.cpp
index ea709fb..9fb070c 100644
--- a/aidl/power-libperfmgr/PowerHintSession.cpp
+++ b/aidl/power-libperfmgr/PowerHintSession.cpp
@@ -366,33 +366,6 @@
     }
 }
 
-void PowerHintSession::wakeup() {
-    std::lock_guard<std::mutex> guard(mSessionLock);
-
-    // 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)", mIdString.c_str(), isActive(), isTimeout());
-        ATRACE_NAME(tag.c_str());
-    }
-    std::shared_ptr<AdpfConfig> adpfConfig = HintManager::GetInstance()->GetAdpfProfile();
-    mDescriptor->current_min =
-            std::max(mDescriptor->current_min, static_cast<int>(adpfConfig->mUclampMinInit));
-
-    if (ATRACE_ENABLED()) {
-        traceSessionVal("min", mDescriptor->current_min);
-    }
-}
-
 void PowerHintSession::StaleTimerHandler::updateTimer() {
     auto now = std::chrono::steady_clock::now();
     nanoseconds staleDuration = std::chrono::nanoseconds(
diff --git a/aidl/power-libperfmgr/PowerHintSession.h b/aidl/power-libperfmgr/PowerHintSession.h
index a12426a..c14d626 100644
--- a/aidl/power-libperfmgr/PowerHintSession.h
+++ b/aidl/power-libperfmgr/PowerHintSession.h
@@ -69,7 +69,6 @@
             const std::vector<WorkDuration> &actualDurations) override;
     bool isActive();
     bool isTimeout();
-    void wakeup();
     void setStale();
     // Is this hint session for a user application
     bool isAppSession();
diff --git a/aidl/power-libperfmgr/PowerSessionManager.cpp b/aidl/power-libperfmgr/PowerSessionManager.cpp
index ddd9f75..80bce68 100644
--- a/aidl/power-libperfmgr/PowerSessionManager.cpp
+++ b/aidl/power-libperfmgr/PowerSessionManager.cpp
@@ -87,37 +87,6 @@
     ATRACE_CALL();
     ALOGV("PowerSessionManager::updateHintBoost: boost: %s, durationMs: %d", boost.c_str(),
           durationMs);
-    if (boost.compare("DISPLAY_UPDATE_IMMINENT") == 0) {
-        PowerHintMonitor::getInstance()->getLooper()->sendMessage(mWakeupHandler, NULL);
-    }
-}
-
-void PowerSessionManager::wakeSessions() {
-    std::lock_guard<std::mutex> guard(mLock);
-    std::shared_ptr<AdpfConfig> adpfConfig = HintManager::GetInstance()->GetAdpfProfile();
-    std::unordered_set<PowerHintSession *> wakeupList;
-    const int wakeupBoostValue = static_cast<int>(adpfConfig->mUclampMinInit);
-    for (auto &it : mTidSessionListMap) {
-        int tid = it.first;
-        int maxboost = -1;
-        // Find the max boost value among all the sessions that include the same TID.
-        for (PowerHintSession *s : it.second) {
-            if (!s->isActive())
-                continue;
-            // all active sessions need to be awakened.
-            wakeupList.insert(s);
-            if (s->isTimeout()) {
-                maxboost = std::max(maxboost, s->getUclampMin());
-            }
-        }
-        // Found the max boost and actally set to the task.
-        if (maxboost != -1) {
-            set_uclamp_min(tid, std::max(maxboost, wakeupBoostValue));
-        }
-    }
-    for (PowerHintSession *s : wakeupList) {
-        s->wakeup();
-    }
 }
 
 int PowerSessionManager::getDisplayRefreshRate() {
@@ -213,10 +182,6 @@
     }
 }
 
-void PowerSessionManager::WakeupHandler::handleMessage(const Message &) {
-    PowerSessionManager::getInstance()->wakeSessions();
-}
-
 void PowerSessionManager::dumpToFd(int fd) {
     std::ostringstream dump_buf;
     std::lock_guard<std::mutex> guard(mLock);
diff --git a/aidl/power-libperfmgr/PowerSessionManager.h b/aidl/power-libperfmgr/PowerSessionManager.h
index 54ea0da..972407c 100644
--- a/aidl/power-libperfmgr/PowerSessionManager.h
+++ b/aidl/power-libperfmgr/PowerSessionManager.h
@@ -52,14 +52,6 @@
     }
 
   private:
-    class WakeupHandler : public MessageHandler {
-      public:
-        WakeupHandler() {}
-        void handleMessage(const Message &message) override;
-    };
-
-  private:
-    void wakeSessions();
     std::optional<bool> isAnyAppSessionActive();
     void disableSystemTopAppBoost();
     void enableSystemTopAppBoost();
@@ -68,7 +60,6 @@
     std::unordered_set<PowerHintSession *> mSessions;  // protected by mLock
     std::unordered_map<int, int> mTidRefCountMap;      // protected by mLock
     std::unordered_map<int, std::unordered_set<PowerHintSession *>> mTidSessionListMap;
-    sp<WakeupHandler> mWakeupHandler;
     bool mActive;  // protected by mLock
     /**
      * mLock to pretect the above data objects opertions.
@@ -80,9 +71,7 @@
         : kDisableBoostHintName(::android::base::GetProperty(kPowerHalAdpfDisableTopAppBoost,
                                                              "ADPF_DISABLE_TA_BOOST")),
           mActive(false),
-          mDisplayRefreshRate(60) {
-        mWakeupHandler = sp<WakeupHandler>(new WakeupHandler());
-    }
+          mDisplayRefreshRate(60) {}
     PowerSessionManager(PowerSessionManager const &) = delete;
     void operator=(PowerSessionManager const &) = delete;
 };
