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    default_team: "trendy_team_android_core_graphics_stack",
22}
23
24aconfig_declarations {
25    name: "libgui_flags",
26    package: "com.android.graphics.libgui.flags",
27    container: "system",
28    srcs: ["libgui_flags.aconfig"],
29}
30
31cc_aconfig_library {
32    name: "libguiflags",
33    host_supported: true,
34    vendor_available: true,
35    min_sdk_version: "29",
36    apex_available: [
37        "//apex_available:platform",
38        "com.android.media.swcodec",
39        "test_com.android.media.swcodec",
40    ],
41    aconfig_declarations: "libgui_flags",
42}
43
44cc_aconfig_library {
45    name: "libguiflags_no_apex",
46    aconfig_declarations: "libgui_flags",
47}
48
49cc_library_headers {
50    name: "libgui_headers",
51    vendor_available: true,
52    export_include_dirs: ["include"],
53
54    // we must build this module to get the required header as that is generated
55    export_shared_lib_headers: [
56        "android.hidl.token@1.0-utils",
57        "android.hardware.graphics.bufferqueue@1.0",
58        "android.hardware.graphics.bufferqueue@2.0",
59    ],
60    shared_libs: [
61        "android.hidl.token@1.0-utils",
62        "android.hardware.graphics.bufferqueue@1.0",
63        "android.hardware.graphics.bufferqueue@2.0",
64    ],
65    static_libs: ["libguiflags"],
66    export_static_lib_headers: ["libguiflags"],
67    min_sdk_version: "29",
68    // TODO(b/218719284) can media use be constrained to libgui_bufferqueue_static?
69    apex_available: [
70        "//apex_available:platform",
71        "com.android.media.swcodec",
72        "test_com.android.media.swcodec",
73    ],
74}
75
76cc_library_headers {
77    name: "libgui_aidl_headers",
78    vendor_available: true,
79    static_libs: [
80        "libgui_aidl_static",
81    ],
82
83    export_static_lib_headers: [
84        "libgui_aidl_static",
85    ],
86}
87
88// AIDL files that should be exposed to java
89filegroup {
90    name: "guiconstants_aidl",
91    srcs: [
92        "android/gui/DropInputMode.aidl",
93        "android/gui/StalledTransactionInfo.aidl",
94        "android/**/TouchOcclusionMode.aidl",
95        "android/gui/TrustedOverlay.aidl",
96    ],
97}
98
99filegroup {
100    name: "android_gui_aidl",
101    srcs: [
102        "android/gui/DisplayInfo.aidl",
103        "android/gui/FocusRequest.aidl",
104        "android/gui/InputApplicationInfo.aidl",
105        "android/gui/IWindowInfosListener.aidl",
106        "android/gui/IWindowInfosPublisher.aidl",
107        "android/gui/IWindowInfosReportedListener.aidl",
108        "android/gui/WindowInfo.aidl",
109        "android/gui/WindowInfosUpdate.aidl",
110    ],
111}
112
113cc_library_static {
114    name: "libgui_window_info_static",
115    vendor_available: true,
116    host_supported: true,
117    srcs: [
118        ":guiconstants_aidl",
119        ":inputconstants_aidl",
120        "android/gui/DisplayInfo.aidl",
121        "android/gui/FocusRequest.aidl",
122        "android/gui/InputApplicationInfo.aidl",
123        "android/gui/IWindowInfosListener.aidl",
124        "android/gui/IWindowInfosPublisher.aidl",
125        "android/gui/IWindowInfosReportedListener.aidl",
126        "android/gui/WindowInfosUpdate.aidl",
127        "android/gui/WindowInfo.aidl",
128        "DisplayInfo.cpp",
129        "WindowInfo.cpp",
130        "WindowInfosUpdate.cpp",
131    ],
132
133    shared_libs: [
134        "libbinder",
135    ],
136
137    local_include_dirs: [
138        "include",
139    ],
140
141    export_shared_lib_headers: [
142        "libbinder",
143    ],
144
145    static_libs: [
146        "libui-types",
147    ],
148
149    aidl: {
150        export_aidl_headers: true,
151    },
152
153    include_dirs: [
154        "frameworks/native/include",
155    ],
156
157    target: {
158        darwin: {
159            enabled: false,
160        },
161    },
162}
163
164filegroup {
165    name: "libgui_extra_aidl_files",
166    srcs: [
167        "android/gui/DisplayInfo.aidl",
168        "android/gui/FocusRequest.aidl",
169        "android/gui/InputApplicationInfo.aidl",
170        "android/gui/IWindowInfosListener.aidl",
171        "android/gui/IWindowInfosPublisher.aidl",
172        "android/gui/IWindowInfosReportedListener.aidl",
173        "android/gui/StalledTransactionInfo.aidl",
174        "android/gui/WindowInfo.aidl",
175        "android/gui/WindowInfosUpdate.aidl",
176    ],
177}
178
179filegroup {
180    name: "libgui_extra_unstructured_aidl_files",
181    srcs: [
182        "android/gui/DisplayInfo.aidl",
183        "android/gui/InputApplicationInfo.aidl",
184        "android/gui/WindowInfo.aidl",
185        "android/gui/WindowInfosUpdate.aidl",
186    ],
187}
188
189aidl_library {
190    name: "libgui_aidl_hdrs",
191    hdrs: [":libgui_extra_aidl_files"],
192}
193
194aidl_library {
195    name: "libgui_extra_unstructured_aidl_hdrs",
196    hdrs: [":libgui_extra_unstructured_aidl_files"],
197}
198
199aidl_library {
200    name: "libgui_aidl",
201    srcs: ["aidl/**/*.aidl"],
202    strip_import_prefix: "aidl",
203    deps: [
204        "libgui_aidl_hdrs",
205        "libgui_extra_unstructured_aidl_hdrs",
206    ],
207}
208
209filegroup {
210    name: "libgui_frame_event_aidl",
211    srcs: ["aidl/android/gui/FrameEvent.aidl"],
212    path: "aidl/",
213}
214
215cc_library_static {
216    name: "libgui_aidl_static",
217    vendor_available: true,
218
219    shared_libs: [
220        "libbinder",
221        "libui",
222    ],
223
224    local_include_dirs: [
225        "include",
226    ],
227
228    include_dirs: [
229        "frameworks/native/include",
230    ],
231
232    export_shared_lib_headers: [
233        "libbinder",
234    ],
235
236    static_libs: [
237        "libui-types",
238        "libgui_window_info_static",
239    ],
240
241    aidl: {
242        export_aidl_headers: true,
243        libs: ["libgui_aidl"],
244    },
245}
246
247filegroup {
248    name: "libgui-sources",
249    srcs: [
250        ":framework_native_aidl_binder",
251        ":framework_native_aidl_gui",
252        ":inputconstants_aidl",
253        ":libgui_bufferqueue_sources",
254
255        "BitTube.cpp",
256        "BLASTBufferQueue.cpp",
257        "BufferItemConsumer.cpp",
258        "Choreographer.cpp",
259        "CompositorTiming.cpp",
260        "ConsumerBase.cpp",
261        "CpuConsumer.cpp",
262        "DebugEGLImageTracker.cpp",
263        "DisplayEventDispatcher.cpp",
264        "DisplayEventReceiver.cpp",
265        "FenceMonitor.cpp",
266        "GLConsumer.cpp",
267        "IConsumerListener.cpp",
268        "IGraphicBufferConsumer.cpp",
269        "IGraphicBufferProducer.cpp",
270        "IProducerListener.cpp",
271        "ISurfaceComposer.cpp",
272        "ITransactionCompletedListener.cpp",
273        "LayerMetadata.cpp",
274        "LayerStatePermissions.cpp",
275        "LayerState.cpp",
276        "OccupancyTracker.cpp",
277        "StreamSplitter.cpp",
278        "ScreenCaptureResults.cpp",
279        "Surface.cpp",
280        "SurfaceControl.cpp",
281        "SurfaceComposerClient.cpp",
282        "SyncFeatures.cpp",
283        "VsyncEventData.cpp",
284        "view/Surface.cpp",
285        "WindowInfosListenerReporter.cpp",
286        "bufferqueue/1.0/B2HProducerListener.cpp",
287        "bufferqueue/1.0/H2BGraphicBufferProducer.cpp",
288        "bufferqueue/2.0/B2HProducerListener.cpp",
289        "bufferqueue/2.0/H2BGraphicBufferProducer.cpp",
290    ],
291}
292
293cc_defaults {
294    name: "libgui-defaults",
295    defaults: ["libgui_bufferqueue-defaults"],
296    srcs: [":libgui-sources"],
297    static_libs: [
298        "libgui_aidl_static",
299        "libgui_window_info_static",
300        "libguiflags",
301    ],
302    shared_libs: [
303        "libbinder",
304        "libGLESv2",
305    ],
306    export_static_lib_headers: [
307        "libguiflags",
308    ],
309}
310
311cc_library_shared {
312    name: "libgui",
313    vendor_available: true,
314    double_loadable: true,
315
316    defaults: [
317        "libgui-defaults",
318    ],
319
320    export_static_lib_headers: [
321        "libgui_aidl_static",
322        "libgui_window_info_static",
323    ],
324
325    export_shared_lib_headers: [
326        "libbinder",
327    ],
328
329    export_header_lib_headers: [
330        "libgui_aidl_headers",
331        "jni_headers",
332    ],
333
334    aidl: {
335        export_aidl_headers: true,
336    },
337
338    header_libs: [
339        "jni_headers",
340        "libdvr_headers",
341        "libgui_aidl_headers",
342        "libpdx_headers",
343    ],
344
345    afdo: true,
346
347    lto: {
348        thin: true,
349    },
350
351    cflags: [
352        "-Wthread-safety",
353    ],
354}
355
356// Used by media codec services exclusively as a static lib for
357// core bufferqueue support only.
358cc_library_static {
359    name: "libgui_bufferqueue_static",
360    vendor_available: true,
361    apex_available: [
362        "//apex_available:platform",
363        "com.android.media.swcodec",
364    ],
365    min_sdk_version: "29",
366
367    cflags: [
368        "-DNO_BINDER",
369    ],
370
371    defaults: ["libgui_bufferqueue-defaults"],
372
373    srcs: [
374        ":libgui_frame_event_aidl",
375        ":inputconstants_aidl",
376        ":libgui_bufferqueue_sources",
377    ],
378
379    aidl: {
380        include_dirs: [
381            "frameworks/native/libs/gui",
382        ],
383    },
384}
385
386filegroup {
387    name: "libgui_bufferqueue_sources",
388    srcs: [
389        "BatchBufferOps.cpp",
390        "BufferItem.cpp",
391        "BufferQueue.cpp",
392        "BufferQueueConsumer.cpp",
393        "BufferQueueCore.cpp",
394        "BufferQueueProducer.cpp",
395        "BufferQueueThreadState.cpp",
396        "BufferSlot.cpp",
397        "FrameRateUtils.cpp",
398        "FrameTimestamps.cpp",
399        "GLConsumerUtils.cpp",
400        "HdrMetadata.cpp",
401        "IGraphicBufferProducerFlattenables.cpp",
402        "bufferqueue/1.0/Conversion.cpp",
403        "bufferqueue/1.0/H2BProducerListener.cpp",
404        "bufferqueue/1.0/WProducerListener.cpp",
405        "bufferqueue/2.0/B2HGraphicBufferProducer.cpp",
406        "bufferqueue/2.0/H2BProducerListener.cpp",
407        "bufferqueue/2.0/types.cpp",
408    ],
409}
410
411// Common build config shared by libgui and libgui_bufferqueue_static.
412cc_defaults {
413    name: "libgui_bufferqueue-defaults",
414
415    defaults: ["android.hardware.graphics.common-ndk_shared"],
416
417    cflags: [
418        "-Wall",
419        "-Werror",
420    ],
421
422    cppflags: [
423        "-Wextra",
424        "-DDEBUG_ONLY_CODE=0",
425    ],
426
427    product_variables: {
428        eng: {
429            cppflags: [
430                "-UDEBUG_ONLY_CODE",
431                "-DDEBUG_ONLY_CODE=1",
432            ],
433        },
434    },
435
436    whole_static_libs: [
437        "libLibGuiProperties",
438    ],
439
440    shared_libs: [
441        "android.hardware.graphics.bufferqueue@1.0",
442        "android.hardware.graphics.bufferqueue@2.0",
443        "android.hardware.graphics.common@1.1",
444        "android.hardware.graphics.common@1.2",
445        "android.hidl.token@1.0-utils",
446        "libbase",
447        "libcutils",
448        "libEGL",
449        "libhidlbase",
450        "liblog",
451        "libnativewindow",
452        "libsync",
453        "libui",
454        "libutils",
455    ],
456
457    static_libs: [
458        "libbinderthreadstateutils",
459    ],
460
461    header_libs: [
462        "libgui_headers",
463        "libnativebase_headers",
464    ],
465
466    include_dirs: [
467        "frameworks/native/include",
468    ],
469
470    export_shared_lib_headers: [
471        "libEGL",
472        "libnativewindow",
473        "libui",
474        "android.hardware.graphics.bufferqueue@1.0",
475        "android.hardware.graphics.bufferqueue@2.0",
476        "android.hardware.graphics.common@1.1",
477        "android.hardware.graphics.common@1.2",
478        "android.hidl.token@1.0-utils",
479    ],
480
481    export_header_lib_headers: [
482        "libgui_headers",
483    ],
484
485    export_include_dirs: [
486        "include",
487    ],
488}
489
490// GMocks for use by external code
491cc_library_static {
492    name: "libgui_mocks",
493    vendor_available: false,
494
495    defaults: ["libgui_bufferqueue-defaults"],
496    static_libs: [
497        "libgtest",
498        "libgmock",
499        "libguiflags",
500    ],
501
502    srcs: [
503        ":libgui_frame_event_aidl",
504        "mock/GraphicBufferConsumer.cpp",
505        "mock/GraphicBufferProducer.cpp",
506    ],
507}
508
509subdirs = ["tests"]
510