Debian Codegraph @

libs/hwui/Android.bp

raw
1 package {
2 default_applicable_licenses: ["frameworks_base_libs_hwui_license"],
3 }
4
5 // Added automatically by a large-scale-change that took the approach of
6 // 'apply every license found to every target'. While this makes sure we respect
7 // every license restriction, it may not be entirely correct.
8 //
9 // e.g. GPL in an MIT project might only apply to the contrib/ directory.
10 //
11 // Please consider splitting the single license below into multiple licenses,
12 // taking care not to lose any license_kind information, and overriding the
13 // default license using the 'licenses: [...]' property on targets as needed.
14 //
15 // For unused files, consider creating a 'fileGroup' with "//visibility:private"
16 // to attach the license to, and including a comment whether the files may be
17 // used in the current project.
18 // See: http://go/android-license-faq
19 license {
20 name: "frameworks_base_libs_hwui_license",
21 visibility: [":__subpackages__"],
22 license_kinds: [
23 "SPDX-license-identifier-Apache-2.0",
24 "SPDX-license-identifier-BSD",
25 ],
26 license_text: [
27 "NOTICE",
28 ],
29 }
30
31 cc_defaults {
32 name: "hwui_defaults",
33 defaults: [
34 "hwui_static_deps",
35 "skia_deps",
36 //"hwui_bugreport_font_cache_usage",
37 //"hwui_compile_for_perf",
38 "hwui_lto",
39 ],
40
41 cpp_std: "experimental",
42
43 cflags: [
44 "-DEGL_EGLEXT_PROTOTYPES",
45 "-DGL_GLEXT_PROTOTYPES",
46 "-DATRACE_TAG=ATRACE_TAG_VIEW",
47 "-DLOG_TAG=\"OpenGLRenderer\"",
48 "-Wall",
49 "-Wthread-safety",
50 "-Wno-unused-parameter",
51 "-Wunreachable-code",
52 "-Werror",
53 "-fvisibility=hidden",
54
55 // GCC false-positives on this warning, and since we -Werror that's
56 // a problem
57 "-Wno-free-nonheap-object",
58
59 // Do not de-optimise cold code paths in AFDO.
60 // Some code paths might be infrequently executed but critical to latency.
61 "-fno-profile-sample-accurate",
62 ],
63
64 include_dirs: [
65 "external/skia/include/private",
66 "external/skia/src/core",
67 ],
68
69 product_variables: {
70 eng: {
71 lto: {
72 never: true,
73 },
74 },
75 },
76
77 target: {
78 android: {
79 include_dirs: [
80 "external/skia/src/effects",
81 "external/skia/src/image",
82 "external/skia/src/utils",
83 "external/skia/src/gpu",
84 "external/skia/src/shaders",
85 ],
86 },
87 host: {
88 include_dirs: [
89 "external/vulkan-headers/include",
90 ],
91 cflags: [
92 "-Wno-unused-variable",
93 ],
94 },
95 },
96 }
97
98 cc_defaults {
99 name: "hwui_static_deps",
100 defaults: [
101 "android.hardware.graphics.common-ndk_shared",
102 "android.hardware.graphics.composer3-ndk_shared",
103 ],
104 shared_libs: [
105 "libbase",
106 "libharfbuzz_ng",
107 "libminikin",
108 ],
109
110 static_libs: [
111 "libui-types",
112 ],
113
114 target: {
115 android: {
116 shared_libs: [
117 "[email protected]",
118 "liblog",
119 "libcutils",
120 "libutils",
121 "libEGL",
122 "libGLESv1_CM",
123 "libGLESv2",
124 "libGLESv3",
125 "libvulkan",
126 "libnativedisplay",
127 "libnativewindow",
128 "libprotobuf-cpp-lite",
129 "libft2",
130 "libandroidfw",
131 "libcrypto",
132 "libsync",
133 ],
134 static_libs: [
135 "libEGL_blobCache",
136 "libprotoutil",
137 "libshaders",
138 "libstatslog_hwui",
139 "libstatspull_lazy",
140 "libstatssocket_lazy",
141 "libtonemap",
142 ],
143 },
144 host: {
145 static_libs: [
146 "libandroidfw",
147 "libutils",
148 ],
149 },
150 },
151 }
152
153 cc_defaults {
154 name: "hwui_bugreport_font_cache_usage",
155 cflags: ["-DBUGREPORT_FONT_CACHE_USAGE"],
156 }
157
158 cc_defaults {
159 name: "hwui_compile_for_perf",
160 // TODO: Non-arm?
161 cflags: [
162 "-fno-omit-frame-pointer",
163 "-marm",
164 "-mapcs",
165 ],
166 }
167
168 // Build hwui library with ThinLTO by default.
169 cc_defaults {
170 name: "hwui_lto",
171 target: {
172 android: {
173 lto: {
174 thin: true,
175 },
176 },
177 },
178 }
179
180 // ------------------------
181 // framework-graphics jar
182 // ------------------------
183
184 java_sdk_library {
185 name: "framework-graphics",
186 defaults: ["framework-module-defaults"],
187 visibility: [
188 "//frameworks/base", // Framework
189 ],
190
191 srcs: [
192 ":framework-graphics-srcs",
193 ],
194
195 permitted_packages: [
196 "android.graphics",
197 ],
198
199 // TODO: once framework-graphics is officially part of the
200 // UI-rendering module this line would no longer be
201 // needed.
202 installable: true,
203
204 // Disable api_lint that the defaults enable
205 // TODO: enable this
206 api_lint: {
207 enabled: false,
208 },
209 // TODO: remove this
210 unsafe_ignore_missing_latest_api: true,
211 }
212
213 filegroup {
214 name: "framework-graphics-srcs",
215 srcs: [
216 "apex/java/**/*.java",
217 ],
218 path: "apex/java",
219 }
220
221 java_api_contribution {
222 name: "framework-graphics-public-stubs",
223 api_surface: "public",
224 api_file: "api/current.txt",
225 visibility: [
226 "//build/orchestrator/apis",
227 ],
228 }
229
230 // ------------------------
231 // APEX
232 // ------------------------
233
234 cc_library_headers {
235 name: "android_graphics_apex_headers",
236
237 host_supported: true,
238 export_include_dirs: [
239 "apex/include",
240 ],
241 target: {
242 windows: {
243 enabled: true,
244 },
245 },
246 }
247
248 cc_defaults {
249 name: "android_graphics_apex",
250 cflags: [
251 "-Wno-unused-parameter",
252 "-Wno-non-virtual-dtor",
253 "-Wno-maybe-uninitialized",
254 "-Wno-parentheses",
255 "-Wall",
256 "-Werror",
257 "-Wno-error=deprecated-declarations",
258 "-Wunused",
259 "-Wunreachable-code",
260 ],
261
262 cppflags: ["-Wno-conversion-null"],
263
264 srcs: [
265 "apex/android_matrix.cpp",
266 "apex/android_paint.cpp",
267 "apex/android_region.cpp",
268 "apex/properties.cpp",
269 ],
270
271 header_libs: ["android_graphics_apex_headers"],
272
273 target: {
274 android: {
275 srcs: [ // sources that depend on android only libraries
276 "apex/android_bitmap.cpp",
277 "apex/android_canvas.cpp",
278 "apex/jni_runtime.cpp",
279 ],
280 },
281 host: {
282 srcs: [
283 "apex/LayoutlibLoader.cpp",
284 ],
285 },
286 },
287 }
288
289 // ------------------------
290 // Android Graphics JNI
291 // ------------------------
292
293 cc_library_headers {
294 name: "android_graphics_jni_headers",
295
296 host_supported: true,
297 export_include_dirs: [
298 "jni",
299 ],
300 target: {
301 windows: {
302 enabled: true,
303 },
304 },
305 }
306
307 cc_defaults {
308 name: "android_graphics_jni",
309 cflags: [
310 "-Wno-unused-parameter",
311 "-Wno-non-virtual-dtor",
312 "-Wno-maybe-uninitialized",
313 "-Wno-parentheses",
314
315 "-DGL_GLEXT_PROTOTYPES",
316 "-DEGL_EGLEXT_PROTOTYPES",
317
318 "-DU_USING_ICU_NAMESPACE=0",
319
320 "-Wall",
321 "-Werror",
322 "-Wno-error=deprecated-declarations",
323 "-Wunused",
324 "-Wunreachable-code",
325 ],
326
327 cppflags: ["-Wno-conversion-null"],
328
329 srcs: [
330 "jni/android_graphics_animation_NativeInterpolatorFactory.cpp",
331 "jni/android_graphics_animation_RenderNodeAnimator.cpp",
332 "jni/android_graphics_Canvas.cpp",
333 "jni/android_graphics_ColorSpace.cpp",
334 "jni/android_graphics_drawable_AnimatedVectorDrawable.cpp",
335 "jni/android_graphics_drawable_VectorDrawable.cpp",
336 "jni/android_graphics_HardwareRendererObserver.cpp",
337 "jni/android_graphics_Matrix.cpp",
338 "jni/android_graphics_Picture.cpp",
339 "jni/android_graphics_DisplayListCanvas.cpp",
340 "jni/android_graphics_RenderNode.cpp",
341 "jni/android_nio_utils.cpp",
342 "jni/android_util_PathParser.cpp",
343
344 "jni/Bitmap.cpp",
345 "jni/BitmapFactory.cpp",
346 "jni/ByteBufferStreamAdaptor.cpp",
347 "jni/Camera.cpp",
348 "jni/CanvasProperty.cpp",
349 "jni/ColorFilter.cpp",
350 "jni/CreateJavaOutputStreamAdaptor.cpp",
351 "jni/FontFamily.cpp",
352 "jni/FontUtils.cpp",
353 "jni/Graphics.cpp",
354 "jni/ImageDecoder.cpp",
355 "jni/Interpolator.cpp",
356 "jni/MaskFilter.cpp",
357 "jni/NinePatch.cpp",
358 "jni/NinePatchPeeker.cpp",
359 "jni/Paint.cpp",
360 "jni/PaintFilter.cpp",
361 "jni/Path.cpp",
362 "jni/PathEffect.cpp",
363 "jni/PathMeasure.cpp",
364 "jni/Picture.cpp",
365 "jni/Region.cpp",
366 "jni/Shader.cpp",
367 "jni/RenderEffect.cpp",
368 "jni/Typeface.cpp",
369 "jni/Utils.cpp",
370 "jni/YuvToJpegEncoder.cpp",
371 "jni/fonts/Font.cpp",
372 "jni/fonts/FontFamily.cpp",
373 "jni/text/LineBreaker.cpp",
374 "jni/text/MeasuredText.cpp",
375 "jni/text/TextShaper.cpp",
376 ],
377
378 header_libs: ["android_graphics_jni_headers"],
379
380 include_dirs: [
381 "external/skia/include/private",
382 "external/skia/src/codec",
383 "external/skia/src/core",
384 "external/skia/src/effects",
385 "external/skia/src/image",
386 "external/skia/src/images",
387 ],
388
389 shared_libs: [
390 "libbase",
391 "libcutils",
392 "libharfbuzz_ng",
393 "liblog",
394 "libminikin",
395 "libz",
396 "libjpeg",
397 ],
398
399 static_libs: [
400 "libnativehelper_lazy",
401 "libziparchive_for_incfs",
402 ],
403
404 target: {
405 android: {
406 srcs: [ // sources that depend on android only libraries
407 "jni/AnimatedImageDrawable.cpp",
408 "jni/android_graphics_TextureLayer.cpp",
409 "jni/android_graphics_HardwareRenderer.cpp",
410 "jni/BitmapRegionDecoder.cpp",
411 "jni/GIFMovie.cpp",
412 "jni/GraphicsStatsService.cpp",
413 "jni/Movie.cpp",
414 "jni/MovieImpl.cpp",
415 "jni/pdf/PdfDocument.cpp",
416 "jni/pdf/PdfEditor.cpp",
417 "jni/pdf/PdfRenderer.cpp",
418 "jni/pdf/PdfUtils.cpp",
419 ],
420 shared_libs: [
421 "libandroidfw",
422 "libbinder",
423 "libbinder_ndk",
424 "libmediandk",
425 "libnativedisplay",
426 "libnativewindow",
427 "libpdfium",
428 ],
429 static_libs: [
430 "libgif",
431 "libstatslog_hwui",
432 "libstatspull_lazy",
433 "libstatssocket_lazy",
434 ],
435 },
436 host: {
437 cflags: [
438 "-Wno-unused-const-variable",
439 "-Wno-unused-function",
440 ],
441 static_libs: [
442 "libandroidfw",
443 ],
444 },
445 },
446 }
447
448 cc_library_static {
449 name: "libstatslog_hwui",
450 generated_sources: ["statslog_hwui.cpp"],
451 generated_headers: ["statslog_hwui.h"],
452 export_generated_headers: ["statslog_hwui.h"],
453 static_libs: [
454 "libstatssocket_lazy",
455 "libstatspull_lazy",
456 ],
457 }
458
459 genrule {
460 name: "statslog_hwui.h",
461 tools: ["stats-log-api-gen"],
462 cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_hwui.h --module hwui" +
463 " --namespace android,uirenderer,stats",
464 out: [
465 "statslog_hwui.h",
466 ],
467 }
468
469 genrule {
470 name: "statslog_hwui.cpp",
471 tools: ["stats-log-api-gen"],
472 cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog_hwui.cpp --module hwui" +
473 " --namespace android,uirenderer,stats --importHeader statslog_hwui.h",
474 out: [
475 "statslog_hwui.cpp",
476 ],
477 }
478
479 // ------------------------
480 // library
481 // ------------------------
482
483 cc_library_headers {
484 name: "libhwui_internal_headers",
485
486 host_supported: true,
487 export_include_dirs: [
488 ".",
489 ],
490 header_libs: ["android_graphics_jni_headers"],
491 export_header_lib_headers: ["android_graphics_jni_headers"],
492 }
493
494 cc_defaults {
495 name: "libhwui_defaults",
496 defaults: ["hwui_defaults"],
497
498 whole_static_libs: ["libskia"],
499
500 srcs: [
501 "canvas/CanvasFrontend.cpp",
502 "canvas/CanvasOpBuffer.cpp",
503 "canvas/CanvasOpRasterizer.cpp",
504 "effects/StretchEffect.cpp",
505 "pipeline/skia/HolePunch.cpp",
506 "pipeline/skia/SkiaDisplayList.cpp",
507 "pipeline/skia/SkiaRecordingCanvas.cpp",
508 "pipeline/skia/StretchMask.cpp",
509 "pipeline/skia/RenderNodeDrawable.cpp",
510 "pipeline/skia/ReorderBarrierDrawables.cpp",
511 "pipeline/skia/TransformCanvas.cpp",
512 "renderthread/Frame.cpp",
513 "renderthread/RenderTask.cpp",
514 "renderthread/TimeLord.cpp",
515 "hwui/AnimatedImageDrawable.cpp",
516 "hwui/Bitmap.cpp",
517 "hwui/BlurDrawLooper.cpp",
518 "hwui/Canvas.cpp",
519 "hwui/ImageDecoder.cpp",
520 "hwui/MinikinSkia.cpp",
521 "hwui/MinikinUtils.cpp",
522 "hwui/PaintImpl.cpp",
523 "hwui/Typeface.cpp",
524 "utils/Blur.cpp",
525 "utils/Color.cpp",
526 "utils/LinearAllocator.cpp",
527 "utils/VectorDrawableUtils.cpp",
528 "AnimationContext.cpp",
529 "Animator.cpp",
530 "AnimatorManager.cpp",
531 "CanvasTransform.cpp",
532 "DamageAccumulator.cpp",
533 "Interpolator.cpp",
534 "LightingInfo.cpp",
535 "Matrix.cpp",
536 "PathParser.cpp",
537 "Properties.cpp",
538 "PropertyValuesAnimatorSet.cpp",
539 "PropertyValuesHolder.cpp",
540 "RecordingCanvas.cpp",
541 "RenderNode.cpp",
542 "RenderProperties.cpp",
543 "RootRenderNode.cpp",
544 "SkiaCanvas.cpp",
545 "SkiaInterpolator.cpp",
546 "VectorDrawable.cpp",
547 ],
548
549 proto: {
550 export_proto_headers: true,
551 },
552
553 target: {
554 android: {
555 header_libs: [
556 "libandroid_headers_private",
557 "libtonemap_headers",
558 ],
559
560 srcs: [
561 "hwui/AnimatedImageThread.cpp",
562 "pipeline/skia/ATraceMemoryDump.cpp",
563 "pipeline/skia/GLFunctorDrawable.cpp",
564 "pipeline/skia/LayerDrawable.cpp",
565 "pipeline/skia/ShaderCache.cpp",
566 "pipeline/skia/SkiaMemoryTracer.cpp",
567 "pipeline/skia/SkiaOpenGLPipeline.cpp",
568 "pipeline/skia/SkiaPipeline.cpp",
569 "pipeline/skia/SkiaProfileRenderer.cpp",
570 "pipeline/skia/SkiaVulkanPipeline.cpp",
571 "pipeline/skia/VkFunctorDrawable.cpp",
572 "pipeline/skia/VkInteropFunctorDrawable.cpp",
573 "renderstate/RenderState.cpp",
574 "renderthread/CacheManager.cpp",
575 "renderthread/CanvasContext.cpp",
576 "renderthread/DrawFrameTask.cpp",
577 "renderthread/EglManager.cpp",
578 "renderthread/ReliableSurface.cpp",
579 "renderthread/RenderEffectCapabilityQuery.cpp",
580 "renderthread/VulkanManager.cpp",
581 "renderthread/VulkanSurface.cpp",
582 "renderthread/RenderProxy.cpp",
583 "renderthread/RenderThread.cpp",
584 "service/GraphicsStatsService.cpp",
585 "thread/CommonPool.cpp",
586 "utils/GLUtils.cpp",
587 "utils/NdkUtils.cpp",
588 "utils/StringUtils.cpp",
589 "AutoBackendTextureRelease.cpp",
590 "DeferredLayerUpdater.cpp",
591 "DeviceInfo.cpp",
592 "FrameInfo.cpp",
593 "FrameInfoVisualizer.cpp",
594 "HardwareBitmapUploader.cpp",
595 "HWUIProperties.sysprop",
596 "JankTracker.cpp",
597 "FrameMetricsReporter.cpp",
598 "Layer.cpp",
599 "LayerUpdateQueue.cpp",
600 "ProfileData.cpp",
601 "ProfileDataContainer.cpp",
602 "Readback.cpp",
603 "TreeInfo.cpp",
604 "WebViewFunctorManager.cpp",
605 "protos/graphicsstats.proto",
606 ],
607
608 // Allow implicit fallthroughs in HardwareBitmapUploader.cpp until they are fixed.
609 cflags: ["-Wno-implicit-fallthrough"],
610 },
611 host: {
612 srcs: [
613 "utils/HostColorSpace.cpp",
614 ],
615 export_static_lib_headers: [
616 "libarect",
617 ],
618 },
619 },
620 }
621
622 cc_library {
623 name: "libhwui",
624 host_supported: true,
625 defaults: [
626 "libhwui_defaults",
627 "android_graphics_apex",
628 "android_graphics_jni",
629 "linker_hugepage_aligned",
630 ],
631 export_header_lib_headers: ["android_graphics_apex_headers"],
632 target: {
633 android: {
634 version_script: "libhwui.map.txt",
635 },
636 },
637 afdo: true,
638 }
639
640 cc_library_static {
641 name: "libhwui_static",
642 defaults: [
643 "libhwui_defaults",
644 ],
645 }
646
647 cc_defaults {
648 name: "hwui_test_defaults",
649 defaults: ["hwui_defaults"],
650 test_suites: ["general-tests"],
651 header_libs: ["libandroid_headers_private"],
652 target: {
653 android: {
654 shared_libs: [
655 "libgui",
656 "libui",
657 ],
658 },
659 },
660 srcs: [
661 "tests/common/scenes/*.cpp",
662 "tests/common/LeakChecker.cpp",
663 "tests/common/TestListViewSceneBase.cpp",
664 "tests/common/TestContext.cpp",
665 "tests/common/TestScene.cpp",
666 "tests/common/TestUtils.cpp",
667 ],
668 }
669
670 // ------------------------
671 // unit tests
672 // ------------------------
673
674 cc_test {
675 name: "hwui_unit_tests",
676 defaults: [
677 "hwui_test_defaults",
678 "android_graphics_apex",
679 "android_graphics_jni",
680 ],
681
682 static_libs: [
683 "libgmock",
684 "libhwui_static",
685 ],
686 shared_libs: [
687 "libmemunreachable",
688 ],
689 srcs: [
690 "tests/unit/main.cpp",
691 "tests/unit/ABitmapTests.cpp",
692 "tests/unit/AutoBackendTextureReleaseTests.cpp",
693 "tests/unit/CacheManagerTests.cpp",
694 "tests/unit/CanvasContextTests.cpp",
695 "tests/unit/CanvasOpTests.cpp",
696 "tests/unit/CanvasFrontendTests.cpp",
697 "tests/unit/CommonPoolTests.cpp",
698 "tests/unit/DamageAccumulatorTests.cpp",
699 "tests/unit/DeferredLayerUpdaterTests.cpp",
700 "tests/unit/EglManagerTests.cpp",
701 "tests/unit/FatVectorTests.cpp",
702 "tests/unit/GraphicsStatsServiceTests.cpp",
703 "tests/unit/JankTrackerTests.cpp",
704 "tests/unit/FrameMetricsReporterTests.cpp",
705 "tests/unit/LayerUpdateQueueTests.cpp",
706 "tests/unit/LinearAllocatorTests.cpp",
707 "tests/unit/MatrixTests.cpp",
708 "tests/unit/OpBufferTests.cpp",
709 "tests/unit/PathInterpolatorTests.cpp",
710 "tests/unit/RenderEffectCapabilityQueryTests.cpp",
711 "tests/unit/RenderNodeDrawableTests.cpp",
712 "tests/unit/RenderNodeTests.cpp",
713 "tests/unit/RenderPropertiesTests.cpp",
714 "tests/unit/RenderThreadTests.cpp",
715 "tests/unit/ShaderCacheTests.cpp",
716 "tests/unit/SkiaBehaviorTests.cpp",
717 "tests/unit/SkiaDisplayListTests.cpp",
718 "tests/unit/SkiaPipelineTests.cpp",
719 "tests/unit/SkiaRenderPropertiesTests.cpp",
720 "tests/unit/SkiaCanvasTests.cpp",
721 "tests/unit/StretchEffectTests.cpp",
722 "tests/unit/StringUtilsTests.cpp",
723 "tests/unit/TestUtilsTests.cpp",
724 "tests/unit/ThreadBaseTests.cpp",
725 "tests/unit/TypefaceTests.cpp",
726 "tests/unit/VectorDrawableTests.cpp",
727 "tests/unit/WebViewFunctorManagerTests.cpp",
728 ],
729 data: [
730 ":hwuimicro",
731 ],
732 }
733
734 // ------------------------
735 // Macro-bench app
736 // ------------------------
737
738 cc_benchmark {
739 name: "hwuimacro",
740 defaults: ["hwui_test_defaults"],
741
742 static_libs: ["libhwui"],
743 shared_libs: [
744 "libmemunreachable",
745 ],
746
747 srcs: [
748 "tests/macrobench/TestSceneRunner.cpp",
749 "tests/macrobench/main.cpp",
750 ],
751 }
752
753 // ------------------------
754 // Micro-bench app
755 // ---------------------
756
757 cc_benchmark {
758 name: "hwuimicro",
759 defaults: ["hwui_test_defaults"],
760
761 static_libs: ["libhwui_static"],
762 shared_libs: [
763 "libmemunreachable",
764 ],
765
766 srcs: [
767 "tests/microbench/main.cpp",
768 "tests/microbench/CanvasOpBench.cpp",
769 "tests/microbench/DisplayListCanvasBench.cpp",
770 "tests/microbench/LinearAllocatorBench.cpp",
771 "tests/microbench/PathParserBench.cpp",
772 "tests/microbench/RenderNodeBench.cpp",
773 ],
774 }