Audioflinger dumpsys cleanup
Re-order audioflinger dumpsys and add argument parsing for various sections.
Additionally, to clean up:
- Pull out dumpsys conditional locking logic into utilities, which
return guards
- Add utility to write strings to fd
Test: adb shell dumpsys media.audio_flinger with all combos
Test: Compiles/boots
Flag: EXEMPT logging only
Bug: 372070273
Change-Id: I8bcf467ee2792d90b298998267591a354e0661c3
diff --git a/services/audioflinger/DeviceEffectManager.cpp b/services/audioflinger/DeviceEffectManager.cpp
index 7cb9329..42c6401 100644
--- a/services/audioflinger/DeviceEffectManager.cpp
+++ b/services/audioflinger/DeviceEffectManager.cpp
@@ -22,7 +22,7 @@
#include "EffectConfiguration.h"
-#include <afutils/DumpTryLock.h>
+#include <afutils/FallibleLockGuard.h>
#include <audio_utils/primitives.h>
#include <media/audiohal/EffectsFactoryHalInterface.h>
#include <utils/Log.h>
@@ -208,10 +208,9 @@
}
void DeviceEffectManager::dump(int fd)
-NO_THREAD_SAFETY_ANALYSIS // conditional try lock
{
- const bool locked = afutils::dumpTryLock(mutex());
- if (!locked) {
+ afutils::FallibleLockGuard l{mutex()};
+ if (!l) {
String8 result("DeviceEffectManager may be deadlocked\n");
write(fd, result.c_str(), result.size());
}
@@ -227,10 +226,6 @@
effect->dump2(fd, 4);
}
}
-
- if (locked) {
- mutex().unlock();
- }
}
size_t DeviceEffectManager::removeEffect(const sp<IAfDeviceEffectProxy>& effect)