audio: Add support for dumping info from effect HAL modules
The implementation uses IBase::debug() method which can write
debugging info into the provided file descriptor (same model
as used for devices and streams).
Bug: 69939533
Test: adb shell dumpsys media.audio_flinger
Change-Id: I02a74b51977d105edf6f7e624ea26f866c965708
diff --git a/media/libaudiohal/impl/EffectHalHidl.cpp b/media/libaudiohal/impl/EffectHalHidl.cpp
index b0597b3..caf575c 100644
--- a/media/libaudiohal/impl/EffectHalHidl.cpp
+++ b/media/libaudiohal/impl/EffectHalHidl.cpp
@@ -18,6 +18,7 @@
//#define LOG_NDEBUG 0
#include <common/all-versions/VersionUtils.h>
+#include <cutils/native_handle.h>
#include <hwbinder/IPCThreadState.h>
#include <media/EffectsFactoryApi.h>
#include <utils/Log.h>
@@ -280,6 +281,15 @@
return ret.isOk() ? analyzeResult(ret) : FAILED_TRANSACTION;
}
+status_t EffectHalHidl::dump(int fd) {
+ if (mEffect == 0) return NO_INIT;
+ native_handle_t* hidlHandle = native_handle_create(1, 0);
+ hidlHandle->data[0] = fd;
+ Return<void> ret = mEffect->debug(hidlHandle, {} /* options */);
+ native_handle_delete(hidlHandle);
+ return ret.isOk() ? OK : FAILED_TRANSACTION;
+}
+
status_t EffectHalHidl::getConfigImpl(
uint32_t cmdCode, uint32_t *replySize, void *pReplyData) {
if (replySize == NULL || *replySize != sizeof(effect_config_t) || pReplyData == NULL) {