sm6375-common: power-libperfmgr: ADPF: Fix updateHintBoost blocks the binder thread

post the task into a looper thread.

Bug: 232992641
Test: Manually playing UIBench -> Transitions -> ActivityTransition
Change-Id: Ibd241834f904b4c87a51363e766e110d2818d496
This commit is contained in:
jimmyshiu 2024-07-18 20:16:00 +05:30 committed by Anand S
commit fbcc05b19b
No known key found for this signature in database
GPG key ID: 3B2983FA448B3D61
6 changed files with 43 additions and 16 deletions

View file

@ -61,6 +61,13 @@ class PowerSessionManager : public MessageHandler {
return instance;
}
private:
class WakeupHandler : public MessageHandler {
public:
WakeupHandler() {}
void handleMessage(const Message &message) override;
};
private:
void wakeSessions();
std::optional<bool> isAnyAppSessionActive();
@ -71,6 +78,7 @@ class PowerSessionManager : public MessageHandler {
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.
@ -82,7 +90,9 @@ class PowerSessionManager : public MessageHandler {
: kDisableBoostHintName(::android::base::GetProperty(kPowerHalAdpfDisableTopAppBoost,
"ADPF_DISABLE_TA_BOOST")),
mActive(false),
mDisplayRefreshRate(60) {}
mDisplayRefreshRate(60) {
mWakeupHandler = sp<WakeupHandler>(new WakeupHandler());
}
PowerSessionManager(PowerSessionManager const &) = delete;
void operator=(PowerSessionManager const &) = delete;
};