summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Tony Guo <tony.guo.peng@gmail.com> 2023-11-27 04:33:20 +0000
committer Tony Guo <tony.guo.peng@gmail.com> 2023-11-27 05:22:04 +0000
commit26a42112cbfcc026e1f6f5cbf1e9105d3cb1f68d (patch)
treebb909aab8895a49615848d2124431f22c8112e0f
parent04b22dd2210c6d108c4bff4e5708cd3099ba770e (diff)
Explicitly includes IGraphicBufferProducer.h in gui/view/Surface.h
When using android.view.Surface in an AIDL file as below: --- package my.package; import android.view.Surface; interface IFoo { Surface getInputSurface(); } --- and Cpp backend is enabled, the auto-generated Cpp files will not be compiled successfully. In file gui/view/Surface.h, it uses class forward declaration of IGraphicBufferProducer, but IGraphicBufferProducer.h is not included anywhere else, so the compiler does not know what IGraphicBufferProducer actually is, especially the inheritance relationship between IGraphicBufferProducer and RefBase, finally, it stops and prints out the following error: --- FAILED: out/soong/.intermediates/**/**/gen/aidl/my/package/IFoo.o In file included from out/soong/.intermediates/**/**/gen/aidl/my/package/IFoo.cpp:1: In file included from out/soong/.intermediates/**/**/gen/aidl/my/package/IFoo.h:3: In file included from frameworks/native/libs/binder/include/binder/IBinder.h:21: In file included from system/core/libutils/include/utils/RefBase.h:224: system/core/libutils/include/utils/StrongPointer.h:278:14: error: member access into incomplete type 'android::IGraphicBufferProducer' m_ptr->decStrong(this); ^ frameworks/native/libs/gui/include/gui/view/Surface.h:42:7: note: in instantiation of member function 'android::sp<android::IGraphicBufferProducer>::~sp' requested here class Surface : public Parcelable { ^ frameworks/native/libs/gui/include/gui/view/Surface.h:29:7: note: forward declaration of 'android::IGraphicBufferProducer' class IGraphicBufferProducer; ^ 1 error generated. --- Change-Id: Ifa53bac79d9775ee4fa54e7c1abc913822f93f38
-rw-r--r--libs/gui/include/gui/view/Surface.h4
-rw-r--r--libs/gui/view/Surface.cpp1
2 files changed, 2 insertions, 3 deletions
diff --git a/libs/gui/include/gui/view/Surface.h b/libs/gui/include/gui/view/Surface.h
index f7dcbc698d..b7aba2b9dc 100644
--- a/libs/gui/include/gui/view/Surface.h
+++ b/libs/gui/include/gui/view/Surface.h
@@ -24,9 +24,9 @@
#include <binder/IBinder.h>
#include <binder/Parcelable.h>
-namespace android {
+#include <gui/IGraphicBufferProducer.h>
-class IGraphicBufferProducer;
+namespace android {
namespace view {
diff --git a/libs/gui/view/Surface.cpp b/libs/gui/view/Surface.cpp
index 198908d334..7c15e7cf92 100644
--- a/libs/gui/view/Surface.cpp
+++ b/libs/gui/view/Surface.cpp
@@ -20,7 +20,6 @@
#include <android/binder_parcel.h>
#include <android/native_window.h>
#include <binder/Parcel.h>
-#include <gui/IGraphicBufferProducer.h>
#include <gui/Surface.h>
#include <gui/view/Surface.h>
#include <system/window.h>