commit | 39a38d473fd5694c8439e93b8f1404bce47765a7 | [log] [tgz] |
---|---|---|
author | Sungtak Lee <taklee@google.com> | Thu Jun 08 21:43:19 2023 +0000 |
committer | Wonsik Kim <wonsik@google.com> | Thu Jun 08 15:16:22 2023 -0700 |
tree | f1257a8deb6aa6cdf7d76f047fc438359c944894 | |
parent | 38b89eaed9e89c16b7e17be15045fdb965a90f48 [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
diff --git a/libs/nativewindow/include/android/hardware_buffer_aidl.h b/libs/nativewindow/include/android/hardware_buffer_aidl.h index 9fea21e..551a1a1 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 @@ 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;