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