AAudioService: add dumpsys capability
Test: adb shell dumpsys media.aaudio
Bug: 38396780
Change-Id: I8b5c421bdd1b3228d8140816a68740709aa9757b
diff --git a/media/libaaudio/src/utility/HandleTracker.h b/media/libaaudio/src/utility/HandleTracker.h
index 23a73ed..a4c51c0 100644
--- a/media/libaaudio/src/utility/HandleTracker.h
+++ b/media/libaaudio/src/utility/HandleTracker.h
@@ -18,6 +18,7 @@
#define UTILITY_HANDLE_TRACKER_H
#include <stdint.h>
+#include <string>
#include <utils/Mutex.h>
typedef int32_t aaudio_handle_t;
@@ -53,6 +54,18 @@
bool isInitialized() const;
/**
+ * Returns HandleTracker information.
+ *
+ * Will attempt to get the object lock, but will proceed
+ * even if it cannot.
+ *
+ * Each line of information ends with a newline.
+ *
+ * @return a string representing the HandleTracker info.
+ */
+ std::string dump() const;
+
+ /**
* Store a pointer and return a handle that can be used to retrieve the pointer.
*
* It is safe to call put() or remove() from multiple threads.
@@ -99,7 +112,7 @@
// This Mutex protects the linked list of free nodes.
// The list is managed using mHandleAddresses and mNextFreeAddress.
// The data in mHandleHeaders is only changed by put() and remove().
- android::Mutex mLock;
+ mutable android::Mutex mLock;
/**
* Pull slot off of a list of empty slots.