summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Sungtak Lee <taklee@google.com> 2023-06-08 21:43:19 +0000
committer Wonsik Kim <wonsik@google.com> 2023-06-08 15:16:22 -0700
commit39a38d473fd5694c8439e93b8f1404bce47765a7 (patch)
treef1257a8deb6aa6cdf7d76f047fc438359c944894
parent38b89eaed9e89c16b7e17be15045fdb965a90f48 (diff)
Add toString() to HardwareBuffer
Bug: N/A Test: m (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:2ed5cf9a07889c97d9fc28471934f1115c72736f) Merged-In: I7452fd53876eacb0a062d5a5c601594de2190ee1 Change-Id: I7452fd53876eacb0a062d5a5c601594de2190ee1
-rw-r--r--libs/nativewindow/include/android/hardware_buffer_aidl.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/libs/nativewindow/include/android/hardware_buffer_aidl.h b/libs/nativewindow/include/android/hardware_buffer_aidl.h
index 9fea21e34e..551a1a14dd 100644
--- a/libs/nativewindow/include/android/hardware_buffer_aidl.h
+++ b/libs/nativewindow/include/android/hardware_buffer_aidl.h
@@ -34,6 +34,10 @@
#include <android/hardware_buffer.h>
#include <sys/cdefs.h>
+#ifdef __cplusplus
+#include <string>
+#endif
+
__BEGIN_DECLS
/**
@@ -135,6 +139,15 @@ public:
return ret;
}
+ inline std::string toString() const {
+ if (!mBuffer) {
+ return "<HardwareBuffer: Invalid>";
+ }
+ uint64_t id = 0;
+ AHardwareBuffer_getId(mBuffer, &id);
+ return "<HardwareBuffer " + std::to_string(id) + ">";
+ }
+
private:
HardwareBuffer(const HardwareBuffer& other) = delete;
HardwareBuffer& operator=(const HardwareBuffer& other) = delete;