sm6375-common: power-libperfmgr: Make HintManager a singleton class

HintManager is unique and widely used in many different components.
This is for making it easiler to be reloaded for debugging.

Bug: 172285365
Test: adb push \
      out/target/product/raven/data/nativetest64/libperfmgr_test/libperfmgr_test \
      /data/nativetest64/libperfmgr_test/libperfmgr_test && \
      adb shell /data/nativetest64/libperfmgr_test/libperfmgr_test
Change-Id: I3affdfe780073ebbc50fac7bfbdd1530ee9dc8c2
This commit is contained in:
Jimmy Shiu 2024-07-18 20:16:00 +05:30 committed by Anand S
commit 53f1fc4eee
No known key found for this signature in database
GPG key ID: 3B2983FA448B3D61
9 changed files with 68 additions and 96 deletions

View file

@ -51,7 +51,6 @@ class PowerSessionManager : public MessageHandler {
void removePowerSession(PowerHintSession *session);
void handleMessage(const Message &message) override;
void setHintManager(std::shared_ptr<HintManager> const &hint_manager);
// Singleton
static sp<PowerSessionManager> getInstance() {
@ -64,7 +63,6 @@ class PowerSessionManager : public MessageHandler {
void disableSystemTopAppBoost();
void enableSystemTopAppBoost();
const std::string kDisableBoostHintName;
std::shared_ptr<HintManager> mHintManager;
std::unordered_set<PowerHintSession *> mSessions; // protected by mLock
std::unordered_map<int, int> mTidRefCountMap; // protected by mLock
std::mutex mLock;
@ -74,7 +72,6 @@ class PowerSessionManager : public MessageHandler {
PowerSessionManager()
: kDisableBoostHintName(::android::base::GetProperty(kPowerHalAdpfDisableTopAppBoost,
"ADPF_DISABLE_TA_BOOST")),
mHintManager(nullptr),
mDisplayRefreshRate(60),
mActive(false) {}
PowerSessionManager(PowerSessionManager const &) = delete;