audio: add dump on Streams, StreamWrapper and Module.
Add dump on Streams and StreamWrapper, so that dump of stream can be
requested via service of IModule.
Add default dump implementation for Module which dumps all streams.
Bug: 399383436
Test: adb shell dumpsys media.audio_flinger
adb shell dumpsys android.hardware.audio.core.IModule/default
Change-Id: I478c750b1b102b1ced0c0523e5b6df700938e573
diff --git a/audio/aidl/default/Module.cpp b/audio/aidl/default/Module.cpp
index 077d80b..6a92481 100644
--- a/audio/aidl/default/Module.cpp
+++ b/audio/aidl/default/Module.cpp
@@ -612,6 +612,15 @@
return ndk::ScopedAStatus::ok();
}
+binder_status_t Module::dump(int fd, const char** args, uint32_t numArgs) {
+ for (const auto& portConfig : getConfig().portConfigs) {
+ if (portConfig.ext.getTag() == AudioPortExt::Tag::mix) {
+ getStreams().dump(portConfig.id, fd, args, numArgs);
+ }
+ }
+ return STATUS_OK;
+}
+
ndk::ScopedAStatus Module::setModuleDebug(
const ::aidl::android::hardware::audio::core::ModuleDebug& in_debug) {
LOG(DEBUG) << __func__ << ": " << mType << ": old flags:" << mDebug.toString()
diff --git a/audio/aidl/default/include/core-impl/Module.h b/audio/aidl/default/include/core-impl/Module.h
index 6a43102..6d59028 100644
--- a/audio/aidl/default/include/core-impl/Module.h
+++ b/audio/aidl/default/include/core-impl/Module.h
@@ -61,6 +61,8 @@
// The vendor extension done via inheritance can override interface methods and augment
// a call to the base implementation.
+ binder_status_t dump(int fd, const char** args, uint32_t numArgs) override;
+
ndk::ScopedAStatus setModuleDebug(
const ::aidl::android::hardware::audio::core::ModuleDebug& in_debug) override;
ndk::ScopedAStatus getTelephony(std::shared_ptr<ITelephony>* _aidl_return) override;
diff --git a/audio/aidl/default/include/core-impl/Stream.h b/audio/aidl/default/include/core-impl/Stream.h
index f0139b4..dc7420b 100644
--- a/audio/aidl/default/include/core-impl/Stream.h
+++ b/audio/aidl/default/include/core-impl/Stream.h
@@ -651,6 +651,12 @@
return ndk::ScopedAStatus::ok();
}
+ void dump(int fd, const char** args, uint32_t numArgs) const {
+ auto s = ::ndk::ICInterface::asInterface(mStreamBinder.get());
+ if (s) s->dump(fd, args, numArgs);
+ return;
+ }
+
private:
std::weak_ptr<StreamCommonInterface> mStream;
ndk::SpAIBinder mStreamBinder;
@@ -692,6 +698,12 @@
}
return ndk::ScopedAStatus::ok();
}
+ void dump(int32_t portConfigId, int fd, const char** args, uint32_t numArgs) const {
+ if (auto it = mStreams.find(portConfigId); it != mStreams.end()) {
+ it->second.dump(fd, args, numArgs);
+ }
+ return;
+ }
private:
// Maps port ids and port config ids to streams. Multimap because a port