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
gugelfrei
Mikhail Naganov 5 years ago
parent 16be62ccbf
commit 4d54767b7d

@ -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 @@ status_t EffectHalHidl::close() {
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) {

@ -61,6 +61,8 @@ class EffectHalHidl : public EffectHalInterface
// Whether it's a local implementation.
virtual bool isLocal() const { return false; }
virtual status_t dump(int fd);
uint64_t effectId() const { return mEffectId; }
static void effectDescriptorToHal(

@ -55,6 +55,8 @@ class EffectHalInterface : public RefBase
// Whether it's a local implementation.
virtual bool isLocal() const = 0;
virtual status_t dump(int fd) = 0;
protected:
// Subclasses can not be constructed directly by clients.
EffectHalInterface() {}

@ -1500,6 +1500,11 @@ void AudioFlinger::EffectModule::dump(int fd, const Vector<String16>& args __unu
write(fd, result.string(), result.length());
if (mEffectInterface != 0) {
dprintf(fd, "\tEffect ID %d HAL dump:\n", mId);
(void)mEffectInterface->dump(fd);
}
if (locked) {
mLock.unlock();
}

Loading…
Cancel
Save