Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 26a42112 authored by Tony Guo's avatar Tony Guo
Browse files

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
parent 04b22dd2
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment