libaudiohal: Modify logging in DeviceHalAidl/Hal2AidlMapper/StreamHalAidl
DeviceHalAidl API can be used for different modules. Modify the logging pattern to include the module names in DeviceHalAidl/Hal2AidlMapper for better information.
Use function name, instance name information embedded in a macro to maintain consistency in the logs.
Similarly, for Stream classes use ioHandle to identify the stream in use.
Test: run CoreAudioHalAidlTest
Bug: 356310696
Change-Id: I4d96408fb984d37f4ac609a9ee3a6adf8411bd89
diff --git a/media/libaudiohal/impl/StreamHalAidl.h b/media/libaudiohal/impl/StreamHalAidl.h
index baf4ac0..a1cdac4 100644
--- a/media/libaudiohal/impl/StreamHalAidl.h
+++ b/media/libaudiohal/impl/StreamHalAidl.h
@@ -53,7 +53,7 @@
StreamContextAidl(
::aidl::android::hardware::audio::core::StreamDescriptor& descriptor,
- bool isAsynchronous)
+ bool isAsynchronous, int ioHandle)
: mFrameSizeBytes(descriptor.frameSizeBytes),
mCommandMQ(new CommandMQ(descriptor.command)),
mReplyMQ(new ReplyMQ(descriptor.reply)),
@@ -61,7 +61,8 @@
mDataMQ(maybeCreateDataMQ(descriptor)),
mIsAsynchronous(isAsynchronous),
mIsMmapped(isMmapped(descriptor)),
- mMmapBufferDescriptor(maybeGetMmapBuffer(descriptor)) {}
+ mMmapBufferDescriptor(maybeGetMmapBuffer(descriptor)),
+ mIoHandle(ioHandle) {}
StreamContextAidl(StreamContextAidl&& other) :
mFrameSizeBytes(other.mFrameSizeBytes),
mCommandMQ(std::move(other.mCommandMQ)),
@@ -70,7 +71,8 @@
mDataMQ(std::move(other.mDataMQ)),
mIsAsynchronous(other.mIsAsynchronous),
mIsMmapped(other.mIsMmapped),
- mMmapBufferDescriptor(std::move(other.mMmapBufferDescriptor)) {}
+ mMmapBufferDescriptor(std::move(other.mMmapBufferDescriptor)),
+ mIoHandle(other.mIoHandle) {}
StreamContextAidl& operator=(StreamContextAidl&& other) {
mFrameSizeBytes = other.mFrameSizeBytes;
mCommandMQ = std::move(other.mCommandMQ);
@@ -80,6 +82,7 @@
mIsAsynchronous = other.mIsAsynchronous;
mIsMmapped = other.mIsMmapped;
mMmapBufferDescriptor = std::move(other.mMmapBufferDescriptor);
+ mIoHandle = other.mIoHandle;
return *this;
}
bool isValid() const {
@@ -105,7 +108,9 @@
bool isAsynchronous() const { return mIsAsynchronous; }
bool isMmapped() const { return mIsMmapped; }
const MmapBufferDescriptor& getMmapBufferDescriptor() const { return mMmapBufferDescriptor; }
- size_t getMmapBurstSize() const { return mMmapBufferDescriptor.burstSizeFrames;}
+ size_t getMmapBurstSize() const { return mMmapBufferDescriptor.burstSizeFrames; }
+ int getIoHandle() const { return mIoHandle; }
+
private:
static std::unique_ptr<DataMQ> maybeCreateDataMQ(
const ::aidl::android::hardware::audio::core::StreamDescriptor& descriptor) {
@@ -137,6 +142,7 @@
bool mIsAsynchronous;
bool mIsMmapped;
MmapBufferDescriptor mMmapBufferDescriptor;
+ int mIoHandle;
};
class StreamHalAidl : public virtual StreamHalInterface, public ConversionHelperAidl {