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
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index c46242d..47dcca6 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -482,6 +482,25 @@
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 @@
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) {