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

Commit 014e7fa2 authored by Narayan Kamath's avatar Narayan Kamath
Browse files

Make Audio wakelock names less unique.

These wakelocks now show up in the client process, where they
might cause wakelock overflows if AudioFlinger threads die often.

The client process should be agnostic of audio flinger threading,
so don't make the wakelock names rely on audioflinger thread names.

Wakelock names now depend only on the audio flinger thread type, and
not the ID itself.

bug: 11200551

Change-Id: Ia1f71b569cb7502d617b77596abc245f461a6ec0
parent b3cb72a1
Loading
Loading
Loading
Loading
+21 −2
Original line number Diff line number Diff line
@@ -482,6 +482,25 @@ void AudioFlinger::ThreadBase::acquireWakeLock(int uid)
    acquireWakeLock_l(uid);
}

String16 AudioFlinger::ThreadBase::getWakeLockTag()
{
    switch (mType) {
        case MIXER:
            return String16("AudioMix");
        case DIRECT:
            return String16("AudioDirectOut");
        case DUPLICATING:
            return String16("AudioDup");
        case RECORD:
            return String16("AudioIn");
        case OFFLOAD:
            return String16("AudioOffload");
        default:
            ALOG_ASSERT(false);
            return String16("AudioUnknown");
    }
}

void AudioFlinger::ThreadBase::acquireWakeLock_l(int uid)
{
    if (mPowerManager == 0) {
@@ -501,13 +520,13 @@ void AudioFlinger::ThreadBase::acquireWakeLock_l(int uid)
        if (uid >= 0) {
            status = mPowerManager->acquireWakeLockWithUid(POWERMANAGER_PARTIAL_WAKE_LOCK,
                    binder,
                    String16(mName),
                    getWakeLockTag(),
                    String16("media"),
                    uid);
        } else {
            status = mPowerManager->acquireWakeLock(POWERMANAGER_PARTIAL_WAKE_LOCK,
                    binder,
                    String16(mName),
                    getWakeLockTag(),
                    String16("media"));
        }
        if (status == NO_ERROR) {
+2 −0
Original line number Diff line number Diff line
@@ -251,6 +251,8 @@ protected:
                // check if some effects must be suspended when an effect chain is added
                void checkSuspendOnAddEffectChain_l(const sp<EffectChain>& chain);

                String16 getWakeLockTag();

    virtual     void        preExit() { }

    friend class AudioFlinger;      // for mEffectChains