libgui: add aidl header lib
This allows vendors to include the AIDL headers into their builds, since
otherwise if they try to link against a libgui stub file they run into
linker errors as the AIDL headers are not included in libgui_headers.
Furthermore, because AIDL definitions are generated at compile-time,
they cannot be placed into libgui_headers directly because APEX modules
depend on libgui_headers, but because the AIDL definitions are unstable
this is inherentrly problematic.
Bug: 181034286
Test: builds
Change-Id: I3d5c14b6b9cec697d06c109375f902ebc83fe726
diff --git a/libs/gui/Android.bp b/libs/gui/Android.bp
index ff059d7..64203f7 100644
--- a/libs/gui/Android.bp
+++ b/libs/gui/Android.bp
@@ -39,12 +39,50 @@
min_sdk_version: "29",
}
+cc_library_headers {
+ name: "libgui_aidl_headers",
+ vendor_available: true,
+ static_libs: [
+ "libgui_aidl_static",
+ ],
+
+ export_static_lib_headers: [
+ "libgui_aidl_static",
+ ],
+}
+
filegroup {
name: "libgui_aidl",
srcs: ["aidl/**/*.aidl"],
path: "aidl/",
}
+cc_library_static {
+ name: "libgui_aidl_static",
+ vendor_available: true,
+ srcs: [
+ ":libgui_aidl",
+ ],
+
+ shared_libs: [
+ "libbinder",
+ "libui",
+ ],
+
+ local_include_dirs: [
+ "include",
+ ],
+
+ export_shared_lib_headers: [
+ "libbinder",
+ ],
+
+ aidl: {
+ export_aidl_headers: true
+ }
+}
+
+
cc_library_shared {
name: "libgui",
vendor_available: true,
@@ -56,10 +94,16 @@
defaults: ["libgui_bufferqueue-defaults"],
+ static_libs: [
+ "libgui_aidl_static",
+ ],
+ export_static_lib_headers: [
+ "libgui_aidl_static",
+ ],
+
srcs: [
":framework_native_aidl",
":inputconstants_aidl",
- ":libgui_aidl",
":libgui_bufferqueue_sources",
"BitTube.cpp",
@@ -115,6 +159,10 @@
"libinput",
],
+ export_header_lib_headers: [
+ "libgui_aidl_headers",
+ ],
+
// bufferhub is not used when building libgui for vendors
target: {
vendor: {
@@ -136,15 +184,16 @@
},
},
- header_libs: [
- "libdvr_headers",
- "libpdx_headers",
- ],
-
aidl: {
export_aidl_headers: true,
},
+ header_libs: [
+ "libdvr_headers",
+ "libgui_aidl_headers",
+ "libpdx_headers",
+ ],
+
pgo: {
sampling: true,
profile_file: "libgui/libgui.profdata",
@@ -175,8 +224,8 @@
srcs: [
":inputconstants_aidl",
- ":libgui_aidl",
":libgui_bufferqueue_sources",
+ ":libgui_aidl",
],
}
diff --git a/libs/gui/include/gui/FrameTimelineInfo.h b/libs/gui/include/gui/FrameTimelineInfo.h
index 3b4c009..a23c202 100644
--- a/libs/gui/include/gui/FrameTimelineInfo.h
+++ b/libs/gui/include/gui/FrameTimelineInfo.h
@@ -18,7 +18,6 @@
#include <stdint.h>
-#include <android/os/IInputConstants.h>
#include <binder/Parcel.h>
namespace android {
@@ -31,7 +30,11 @@
int64_t vsyncId = INVALID_VSYNC_ID;
// The id of the input event that caused this buffer
- int32_t inputEventId = android::os::IInputConstants::INVALID_INPUT_EVENT_ID;
+ // Default is android::os::IInputConstants::INVALID_INPUT_EVENT_ID = 0
+ // We copy the value of the input event ID instead of including the header, because libgui
+ // header libraries containing FrameTimelineInfo must be available to vendors, but libinput is
+ // not directly vendor available.
+ int32_t inputEventId = 0;
status_t write(Parcel& output) const;
status_t read(const Parcel& input);