Add SurfaceListener::onBufferAttached
Add callbacks to SurfaceListener.
The callbacks are newly added to IProdcuerListener and currently
missing.
Bug: 353202582
Flag: com.android.graphics.libgui.flags.bq_consumer_attach_callback
Change-Id: Ib7d71a8032c8b6fda057aeac50474b6dfde460c9
diff --git a/libs/gui/include/gui/Surface.h b/libs/gui/include/gui/Surface.h
index d07e121..3e2aa47 100644
--- a/libs/gui/include/gui/Surface.h
+++ b/libs/gui/include/gui/Surface.h
@@ -34,6 +34,8 @@
#include <shared_mutex>
#include <unordered_set>
+#include <com_android_graphics_libgui_flags.h>
+
namespace android {
class GraphicBuffer;
@@ -60,6 +62,10 @@
virtual void onBuffersDiscarded(const std::vector<sp<GraphicBuffer>>& buffers) = 0;
virtual void onBufferDetached(int slot) = 0;
+#if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(BQ_CONSUMER_ATTACH_CALLBACK)
+ virtual void onBufferAttached() {}
+ virtual bool needsAttachNotify() { return false; }
+#endif
};
class StubSurfaceListener : public SurfaceListener {
@@ -455,6 +461,15 @@
virtual void onBufferDetached(int slot) { mSurfaceListener->onBufferDetached(slot); }
virtual void onBuffersDiscarded(const std::vector<int32_t>& slots);
+#if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(BQ_CONSUMER_ATTACH_CALLBACK)
+ virtual void onBufferAttached() {
+ mSurfaceListener->onBufferAttached();
+ }
+
+ virtual bool needsAttachNotify() {
+ return mSurfaceListener->needsAttachNotify();
+ }
+#endif
private:
wp<Surface> mParent;
sp<SurfaceListener> mSurfaceListener;