1// Copyright 2010 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14package {
15    // See: http://go/android-license-faq
16    // A large-scale-change added 'default_applicable_licenses' to import
17    // all of the 'license_kinds' from "frameworks_native_license"
18    // to get the below license kinds:
19    //   SPDX-license-identifier-Apache-2.0
20    default_applicable_licenses: ["frameworks_native_license"],
21}
22
23cc_library_headers {
24    name: "libgui_headers",
25    vendor_available: true,
26    export_include_dirs: ["include"],
27
28    // we must build this module to get the required header as that is generated
29    export_shared_lib_headers: [
30        "android.hidl.token@1.0-utils",
31        "android.hardware.graphics.bufferqueue@1.0",
32        "android.hardware.graphics.bufferqueue@2.0",
33    ],
34    shared_libs: [
35        "android.hidl.token@1.0-utils",
36        "android.hardware.graphics.bufferqueue@1.0",
37        "android.hardware.graphics.bufferqueue@2.0",
38    ],
39    min_sdk_version: "29",
40}
41
42cc_library_headers {
43    name: "libgui_aidl_headers",
44    vendor_available: true,
45    static_libs: [
46        "libgui_aidl_static",
47    ],
48
49    export_static_lib_headers: [
50        "libgui_aidl_static",
51    ],
52}
53
54// AIDL files that should be exposed to java
55filegroup {
56    name: "guiconstants_aidl",
57    srcs: [
58        "android/**/DropInputMode.aidl",
59        "android/**/TouchOcclusionMode.aidl",
60    ],
61}
62
63cc_library_static {
64    name: "libgui_window_info_static",
65    vendor_available: true,
66    host_supported: true,
67    srcs: [
68        ":guiconstants_aidl",
69        "android/gui/FocusRequest.aidl",
70        "android/gui/InputApplicationInfo.aidl",
71        "android/gui/IWindowInfosListener.aidl",
72        "android/gui/IWindowInfosReportedListener.aidl",
73        "android/gui/WindowInfo.aidl",
74        "WindowInfo.cpp",
75    ],
76
77    shared_libs: [
78        "libbinder",
79    ],
80
81    local_include_dirs: [
82        "include",
83    ],
84
85    export_shared_lib_headers: [
86        "libbinder",
87    ],
88
89    static_libs: [
90        "libui-types",
91    ],
92
93    aidl: {
94        export_aidl_headers: true
95    },
96
97    include_dirs: [
98        "frameworks/native/include",
99    ],
100
101    target: {
102        darwin: {
103            enabled: false,
104        },
105    },
106}
107
108filegroup {
109    name: "libgui_aidl",
110    srcs: ["aidl/**/*.aidl"],
111    path: "aidl/",
112}
113
114cc_library_static {
115    name: "libgui_aidl_static",
116    vendor_available: true,
117    srcs: [
118        ":libgui_aidl",
119    ],
120
121    shared_libs: [
122        "libbinder",
123        "libui",
124    ],
125
126    local_include_dirs: [
127        "include",
128    ],
129
130    export_shared_lib_headers: [
131        "libbinder",
132    ],
133
134    static_libs: [
135        "libui-types",
136    ],
137
138    aidl: {
139        export_aidl_headers: true
140    }
141}
142
143cc_library_shared {
144    name: "libgui",
145    vendor_available: true,
146    vndk: {
147        enabled: true,
148        private: true,
149    },
150    double_loadable: true,
151
152    defaults: ["libgui_bufferqueue-defaults"],
153
154    static_libs: [
155        "libgui_aidl_static",
156        "libgui_window_info_static",
157    ],
158    export_static_lib_headers: [
159        "libgui_aidl_static",
160        "libgui_window_info_static",
161    ],
162
163    srcs: [
164        ":framework_native_aidl",
165        ":inputconstants_aidl",
166        ":libgui_bufferqueue_sources",
167
168        "BitTube.cpp",
169        "BLASTBufferQueue.cpp",
170        "BufferHubConsumer.cpp",
171        "BufferHubProducer.cpp",
172        "BufferItemConsumer.cpp",
173        "ConsumerBase.cpp",
174        "CpuConsumer.cpp",
175        "DebugEGLImageTracker.cpp",
176        "DisplayEventDispatcher.cpp",
177        "DisplayEventReceiver.cpp",
178        "FrameTimelineInfo.cpp",
179        "GLConsumer.cpp",
180        "IConsumerListener.cpp",
181        "IDisplayEventConnection.cpp",
182        "IGraphicBufferConsumer.cpp",
183        "IGraphicBufferProducer.cpp",
184        "IProducerListener.cpp",
185        "IRegionSamplingListener.cpp",
186        "ISurfaceComposer.cpp",
187        "ISurfaceComposerClient.cpp",
188        "ITransactionCompletedListener.cpp",
189        "LayerDebugInfo.cpp",
190        "LayerMetadata.cpp",
191        "LayerState.cpp",
192        "OccupancyTracker.cpp",
193        "StreamSplitter.cpp",
194        "ScreenCaptureResults.cpp",
195        "Surface.cpp",
196        "SurfaceControl.cpp",
197        "SurfaceComposerClient.cpp",
198        "SyncFeatures.cpp",
199        "TransactionTracing.cpp",
200        "view/Surface.cpp",
201        "WindowInfosListenerReporter.cpp",
202        "bufferqueue/1.0/B2HProducerListener.cpp",
203        "bufferqueue/1.0/H2BGraphicBufferProducer.cpp",
204        "bufferqueue/2.0/B2HProducerListener.cpp",
205        "bufferqueue/2.0/H2BGraphicBufferProducer.cpp",
206    ],
207
208    shared_libs: [
209        "android.frameworks.bufferhub@1.0",
210        "libbinder",
211        "libbufferhub",
212        "libbufferhubqueue", // TODO(b/70046255): Remove this once BufferHub is integrated into libgui.
213        "libpdx_default_transport",
214    ],
215
216    export_shared_lib_headers: [
217        "libbinder",
218    ],
219
220    export_header_lib_headers: [
221        "libgui_aidl_headers",
222    ],
223
224    // bufferhub is not used when building libgui for vendors
225    target: {
226        vendor: {
227            cflags: [
228                "-DNO_BUFFERHUB",
229            ],
230            exclude_srcs: [
231                "BufferHubConsumer.cpp",
232                "BufferHubProducer.cpp",
233            ],
234            exclude_shared_libs: [
235                "android.frameworks.bufferhub@1.0",
236                "libbufferhub",
237                "libbufferhubqueue",
238                "libpdx_default_transport",
239            ],
240        },
241    },
242
243    aidl: {
244        export_aidl_headers: true,
245    },
246
247    header_libs: [
248        "libdvr_headers",
249        "libgui_aidl_headers",
250        "libpdx_headers",
251    ],
252
253    pgo: {
254        sampling: true,
255        profile_file: "libgui/libgui.profdata",
256    },
257
258    lto: {
259        thin: true,
260    },
261}
262
263// Used by media codec services exclusively as a static lib for
264// core bufferqueue support only.
265cc_library_static {
266    name: "libgui_bufferqueue_static",
267    vendor_available: true,
268    apex_available: [
269        "//apex_available:platform",
270        "com.android.media.swcodec",
271    ],
272    min_sdk_version: "29",
273
274    cflags: [
275        "-DNO_BUFFERHUB",
276        "-DNO_BINDER",
277    ],
278
279    defaults: ["libgui_bufferqueue-defaults"],
280
281    srcs: [
282        ":inputconstants_aidl",
283        ":libgui_bufferqueue_sources",
284        ":libgui_aidl",
285    ],
286}
287
288filegroup {
289    name: "libgui_bufferqueue_sources",
290    srcs: [
291        "BatchBufferOps.cpp",
292        "BufferItem.cpp",
293        "BufferQueue.cpp",
294        "BufferQueueConsumer.cpp",
295        "BufferQueueCore.cpp",
296        "BufferQueueProducer.cpp",
297        "BufferQueueThreadState.cpp",
298        "BufferSlot.cpp",
299        "FrameTimestamps.cpp",
300        "GLConsumerUtils.cpp",
301        "HdrMetadata.cpp",
302        "IGraphicBufferProducerFlattenables.cpp",
303        "bufferqueue/1.0/Conversion.cpp",
304        "bufferqueue/1.0/H2BProducerListener.cpp",
305        "bufferqueue/1.0/WProducerListener.cpp",
306        "bufferqueue/2.0/B2HGraphicBufferProducer.cpp",
307        "bufferqueue/2.0/H2BProducerListener.cpp",
308        "bufferqueue/2.0/types.cpp",
309    ],
310}
311
312// Common build config shared by libgui and libgui_bufferqueue_static.
313cc_defaults {
314    name: "libgui_bufferqueue-defaults",
315
316    clang: true,
317    cflags: [
318        "-Wall",
319        "-Werror",
320    ],
321
322    cppflags: [
323        "-Wextra",
324        "-DDEBUG_ONLY_CODE=0",
325    ],
326
327    product_variables: {
328        eng: {
329            cppflags: [
330                "-UDEBUG_ONLY_CODE",
331                "-DDEBUG_ONLY_CODE=1",
332            ],
333        },
334    },
335
336    whole_static_libs: [
337        "LibGuiProperties",
338    ],
339
340    shared_libs: [
341        "android.hardware.graphics.bufferqueue@1.0",
342        "android.hardware.graphics.bufferqueue@2.0",
343        "android.hardware.graphics.common@1.1",
344        "android.hardware.graphics.common@1.2",
345        "android.hidl.token@1.0-utils",
346        "libbase",
347        "libcutils",
348        "libEGL",
349        "libGLESv2",
350        "libhidlbase",
351        "liblog",
352        "libnativewindow",
353        "libsync",
354        "libui",
355        "libutils",
356        "libvndksupport",
357    ],
358
359    static_libs: [
360        "libbinderthreadstateutils",
361    ],
362
363    header_libs: [
364        "libgui_headers",
365        "libnativebase_headers",
366    ],
367
368    include_dirs: [
369        "frameworks/native/include",
370    ],
371
372    export_shared_lib_headers: [
373        "libEGL",
374        "libnativewindow",
375        "libui",
376        "android.hardware.graphics.bufferqueue@1.0",
377        "android.hardware.graphics.bufferqueue@2.0",
378        "android.hardware.graphics.common@1.1",
379        "android.hardware.graphics.common@1.2",
380        "android.hidl.token@1.0-utils",
381    ],
382
383    export_header_lib_headers: [
384        "libgui_headers",
385    ],
386
387    export_include_dirs: [
388        "include",
389    ],
390}
391
392// GMocks for use by external code
393cc_library_static {
394    name: "libgui_mocks",
395    vendor_available: false,
396
397    defaults: ["libgui_bufferqueue-defaults"],
398    static_libs: [
399        "libgtest",
400        "libgmock",
401    ],
402
403    srcs: [
404        "mock/GraphicBufferConsumer.cpp",
405        "mock/GraphicBufferProducer.cpp",
406    ],
407}
408
409subdirs = ["tests"]
410