xref: /aosp_15_r20/frameworks/native/libs/gui/Android.bp (revision 38e8c45f13ce32b0dcecb25141ffecaf386fa17f)
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        "[email protected]",
57        "[email protected]",
58        "[email protected]",
59    ],
60    shared_libs: [
61        "[email protected]",
62        "[email protected]",
63        "[email protected]",
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        "BufferReleaseChannel.cpp",
259        "Choreographer.cpp",
260        "CompositorTiming.cpp",
261        "ConsumerBase.cpp",
262        "CpuConsumer.cpp",
263        "DebugEGLImageTracker.cpp",
264        "DisplayEventDispatcher.cpp",
265        "DisplayEventReceiver.cpp",
266        "FenceMonitor.cpp",
267        "Flags.cpp",
268        "GLConsumer.cpp",
269        "IConsumerListener.cpp",
270        "IGraphicBufferConsumer.cpp",
271        "IGraphicBufferProducer.cpp",
272        "IProducerListener.cpp",
273        "ISurfaceComposer.cpp",
274        "ITransactionCompletedListener.cpp",
275        "LayerMetadata.cpp",
276        "LayerStatePermissions.cpp",
277        "LayerState.cpp",
278        "DisplayLuts.cpp",
279        "OccupancyTracker.cpp",
280        "StreamSplitter.cpp",
281        "ScreenCaptureResults.cpp",
282        "Surface.cpp",
283        "SurfaceControl.cpp",
284        "SurfaceComposerClient.cpp",
285        "SyncFeatures.cpp",
286        "VsyncEventData.cpp",
287        "view/Surface.cpp",
288        "WindowInfosListenerReporter.cpp",
289        "bufferqueue/1.0/B2HProducerListener.cpp",
290        "bufferqueue/1.0/H2BGraphicBufferProducer.cpp",
291        "bufferqueue/2.0/B2HProducerListener.cpp",
292        "bufferqueue/2.0/H2BGraphicBufferProducer.cpp",
293    ],
294}
295
296cc_defaults {
297    name: "libgui-defaults",
298    defaults: ["libgui_bufferqueue-defaults"],
299    srcs: [":libgui-sources"],
300    static_libs: [
301        "libgui_aidl_static",
302        "libgui_window_info_static",
303        "libguiflags",
304    ],
305    shared_libs: [
306        "libbinder",
307        "libGLESv2",
308    ],
309    export_static_lib_headers: [
310        "libguiflags",
311    ],
312}
313
314cc_library_shared {
315    name: "libgui",
316    vendor_available: true,
317    double_loadable: true,
318
319    defaults: [
320        "libgui-defaults",
321    ],
322
323    export_static_lib_headers: [
324        "libgui_aidl_static",
325        "libgui_window_info_static",
326    ],
327
328    export_shared_lib_headers: [
329        "libbinder",
330    ],
331
332    export_header_lib_headers: [
333        "libgui_aidl_headers",
334        "jni_headers",
335    ],
336
337    aidl: {
338        export_aidl_headers: true,
339    },
340
341    header_libs: [
342        "jni_headers",
343        "libgui_aidl_headers",
344    ],
345
346    static_libs: [
347        "libsurfaceflingerflags",
348    ],
349
350    afdo: true,
351
352    lto: {
353        thin: true,
354    },
355
356    cflags: [
357        "-Wthread-safety",
358    ],
359}
360
361// Used by media codec services exclusively as a static lib for
362// core bufferqueue support only.
363cc_library_static {
364    name: "libgui_bufferqueue_static",
365    vendor_available: true,
366    apex_available: [
367        "//apex_available:platform",
368        "com.android.media.swcodec",
369    ],
370    min_sdk_version: "29",
371
372    cflags: [
373        "-DNO_BINDER",
374    ],
375
376    defaults: ["libgui_bufferqueue-defaults"],
377
378    srcs: [
379        ":libgui_frame_event_aidl",
380        ":inputconstants_aidl",
381        ":libgui_bufferqueue_sources",
382    ],
383
384    aidl: {
385        include_dirs: [
386            "frameworks/native/libs/gui",
387        ],
388    },
389}
390
391filegroup {
392    name: "libgui_bufferqueue_sources",
393    srcs: [
394        "BatchBufferOps.cpp",
395        "BufferItem.cpp",
396        "BufferQueue.cpp",
397        "BufferQueueConsumer.cpp",
398        "BufferQueueCore.cpp",
399        "BufferQueueProducer.cpp",
400        "BufferQueueThreadState.cpp",
401        "BufferSlot.cpp",
402        "FrameRateUtils.cpp",
403        "FrameTimestamps.cpp",
404        "GLConsumerUtils.cpp",
405        "HdrMetadata.cpp",
406        "IGraphicBufferProducerFlattenables.cpp",
407        "bufferqueue/1.0/Conversion.cpp",
408        "bufferqueue/1.0/H2BProducerListener.cpp",
409        "bufferqueue/1.0/WProducerListener.cpp",
410        "bufferqueue/2.0/B2HGraphicBufferProducer.cpp",
411        "bufferqueue/2.0/H2BProducerListener.cpp",
412        "bufferqueue/2.0/types.cpp",
413    ],
414}
415
416// Common build config shared by libgui and libgui_bufferqueue_static.
417cc_defaults {
418    name: "libgui_bufferqueue-defaults",
419
420    defaults: ["android.hardware.graphics.common-ndk_shared"],
421
422    cflags: [
423        "-Wall",
424        "-Werror",
425    ],
426
427    cppflags: [
428        "-Wextra",
429        "-DDEBUG_ONLY_CODE=0",
430    ],
431
432    product_variables: {
433        eng: {
434            cppflags: [
435                "-UDEBUG_ONLY_CODE",
436                "-DDEBUG_ONLY_CODE=1",
437            ],
438        },
439    },
440
441    whole_static_libs: [
442        "libLibGuiProperties",
443    ],
444
445    shared_libs: [
446        "[email protected]",
447        "[email protected]",
448        "[email protected]",
449        "[email protected]",
450        "[email protected]",
451        "libbase",
452        "libcutils",
453        "libEGL",
454        "libhidlbase",
455        "liblog",
456        "libnativewindow",
457        "libsync",
458        "libui",
459        "libutils",
460    ],
461
462    static_libs: [
463        "libbinderthreadstateutils",
464    ],
465
466    header_libs: [
467        "libgui_headers",
468        "libnativebase_headers",
469    ],
470
471    include_dirs: [
472        "frameworks/native/include",
473    ],
474
475    export_shared_lib_headers: [
476        "libEGL",
477        "libnativewindow",
478        "libui",
479        "[email protected]",
480        "[email protected]",
481        "[email protected]",
482        "[email protected]",
483        "[email protected]",
484    ],
485
486    export_header_lib_headers: [
487        "libgui_headers",
488    ],
489
490    export_include_dirs: [
491        "include",
492    ],
493}
494
495// GMocks for use by external code
496cc_library_static {
497    name: "libgui_mocks",
498    vendor_available: false,
499
500    defaults: ["libgui_bufferqueue-defaults"],
501    static_libs: [
502        "libgtest",
503        "libgmock",
504        "libguiflags",
505    ],
506
507    srcs: [
508        ":libgui_frame_event_aidl",
509        "mock/GraphicBufferConsumer.cpp",
510        "mock/GraphicBufferProducer.cpp",
511    ],
512}
513
514subdirs = ["tests"]
515