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