Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ae6d1602 authored by Kunal Malhotra's avatar Kunal Malhotra
Browse files

FGS Metrics Hooks for Microphone

Adding in hooks for microphone subsystem

Test: manual testing on device
Bug: b/263304156
Change-Id: I9e7b6bdc2095bf36aa13a91a90c42e589d15803b
parent b7c5ddba
Loading
Loading
Loading
Loading
+19 −6
Original line number Diff line number Diff line
@@ -72,9 +72,15 @@ public:
        ++mIntervalCount;
        const auto& mActivityManager = getActivityManager();
        if (mActivityManager) {
            if (mIsOut) {
                mActivityManager->logFgsApiBegin(AUDIO_API,
                    mUid,
                    IPCThreadState::self() -> getCallingPid());
            } else {
                mActivityManager->logFgsApiBegin(MICROPHONE_API,
                    mUid,
                    IPCThreadState::self() -> getCallingPid());
            }
        }
    }

@@ -107,9 +113,15 @@ public:
        }
        const auto& mActivityManager = getActivityManager();
        if (mActivityManager) {
            if (mIsOut) {
                mActivityManager->logFgsApiEnd(AUDIO_API,
                    mUid,
                    IPCThreadState::self() -> getCallingPid());
            } else {
                mActivityManager->logFgsApiEnd(MICROPHONE_API,
                    mUid,
                    IPCThreadState::self() -> getCallingPid());
            }
        }
    }

@@ -255,6 +267,7 @@ private:
    const bool        mIsOut;  // if true, than a playback track, otherwise used for record.

    static constexpr int AUDIO_API = 5;
    static constexpr int MICROPHONE_API = 6;
    const int         mUid;

    mutable           std::mutex mLock;