1// Copyright (C) 2018 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. 14 15package { 16 // See: http://go/android-license-faq 17 default_applicable_licenses: ["Android-Apache-2.0"], 18} 19 20min_launcher3_sdk_version = "31" 21 22// Targets that don't inherit framework aconfig libs (i.e., those that don't set 23// `platform_apis: true`) must manually link them. 24java_defaults { 25 name: "launcher-non-platform-apis-defaults", 26 static_libs: [ 27 "android.os.flags-aconfig-java", 28 "android.multiuser.flags-aconfig-java", 29 "android.appwidget.flags-aconfig-java", 30 "com.android.window.flags.window-aconfig-java", 31 ], 32} 33 34// Common source files used to build launcher (java and kotlin) 35// All sources are split so they can be reused in many other libraries/apps in other folders 36 37// Main Launcher source, excluding the build config 38filegroup { 39 name: "launcher-src", 40 srcs: [ 41 "src/**/*.java", 42 "src/**/*.kt", 43 ], 44} 45 46// Main Launcher source for compose, excluding the build config 47filegroup { 48 name: "launcher-compose-enabled-src", 49 srcs: [ 50 "compose/facade/enabled/*.kt", 51 "compose/facade/core/*.kt", 52 "compose/features/**/*.kt", 53 ], 54} 55 56filegroup { 57 name: "launcher-compose-disabled-src", 58 srcs: [ 59 "compose/facade/core/*.kt", 60 "compose/facade/disabled/*.kt", 61 ], 62} 63 64// Source code for quickstep build, on top of launcher-src 65filegroup { 66 name: "launcher-quickstep-src", 67 srcs: [ 68 "quickstep/src/**/*.kt", 69 "quickstep/src/**/*.java", 70 ], 71 device_common_srcs: [ 72 ":launcher-quickstep-processed-protolog-src", 73 ], 74} 75 76// Launcher ProtoLog support 77filegroup { 78 name: "launcher-quickstep-unprocessed-protolog-src", 79 srcs: [ 80 "quickstep/src_protolog/**/*.java", 81 ], 82} 83 84java_library { 85 name: "launcher-quickstep_protolog-groups", 86 srcs: [ 87 "quickstep/src_protolog/**/*.java", 88 ], 89 static_libs: [ 90 "protolog-group", 91 "androidx.annotation_annotation", 92 "com_android_launcher3_flags_lib", 93 ], 94} 95 96java_genrule { 97 name: "launcher-quickstep-processed-protolog-src", 98 srcs: [ 99 ":protolog-impl", 100 ":launcher-quickstep-unprocessed-protolog-src", 101 ":launcher-quickstep_protolog-groups", 102 ], 103 tools: ["protologtool"], 104 cmd: "$(location protologtool) transform-protolog-calls " + 105 "--protolog-class com.android.internal.protolog.common.ProtoLog " + 106 "--loggroups-class com.android.quickstep.util.QuickstepProtoLogGroup " + 107 "--loggroups-jar $(location :launcher-quickstep_protolog-groups) " + 108 "--viewer-config-file-path /system_ext/etc/launcher.quickstep.protolog.pb " + 109 "--output-srcjar $(out) " + 110 "$(locations :launcher-quickstep-unprocessed-protolog-src)", 111 out: ["launcher.quickstep.protolog.srcjar"], 112} 113 114java_genrule { 115 name: "gen-launcher.quickstep.protolog.pb", 116 srcs: [ 117 ":launcher-quickstep-unprocessed-protolog-src", 118 ":launcher-quickstep_protolog-groups", 119 ], 120 tools: ["protologtool"], 121 cmd: "$(location protologtool) generate-viewer-config " + 122 "--protolog-class com.android.internal.protolog.common.ProtoLog " + 123 "--loggroups-class com.android.quickstep.util.QuickstepProtoLogGroup " + 124 "--loggroups-jar $(location :launcher-quickstep_protolog-groups) " + 125 "--viewer-config-type proto " + 126 "--viewer-config $(out) " + 127 "$(locations :launcher-quickstep-unprocessed-protolog-src)", 128 out: ["launcher.quickstep.protolog.pb"], 129} 130 131prebuilt_etc { 132 name: "launcher.quickstep.protolog.pb", 133 system_ext_specific: true, 134 src: ":gen-launcher.quickstep.protolog.pb", 135 filename_from_src: true, 136} 137 138// Source code for quickstep dagger 139filegroup { 140 name: "launcher-quickstep-dagger", 141 srcs: [ 142 "quickstep/dagger/**/*.java", 143 "quickstep/dagger/**/*.kt", 144 ], 145} 146 147// Source code for quickstep build with compose enabled, on top of launcher-src 148filegroup { 149 name: "launcher-quickstep-compose-enabled-src", 150 srcs: [ 151 "quickstep/compose/facade/core/*.kt", 152 "quickstep/compose/facade/enabled/*.kt", 153 "quickstep/compose/features/**/*.kt", 154 ], 155} 156 157filegroup { 158 name: "launcher-quickstep-compose-disabled-src", 159 srcs: [ 160 "quickstep/compose/facade/core/*.kt", 161 "quickstep/compose/facade/disabled/*.kt", 162 ], 163} 164 165// Alternate source when quickstep is not included 166filegroup { 167 name: "launcher-src_no_quickstep", 168 srcs: [ 169 "src_no_quickstep/**/*.java", 170 "src_no_quickstep/**/*.kt", 171 ], 172} 173 174// Default build config for Launcher3 175filegroup { 176 name: "launcher-build-config", 177 srcs: [ 178 "src_build_config/**/*.java", 179 ], 180} 181 182// Proguard files for Launcher3 183filegroup { 184 name: "launcher-proguard-rules", 185 srcs: ["proguard.flags"], 186} 187 188// Opt-in configuration for Launcher3 code depending on Jetpack Compose. 189soong_config_module_type { 190 name: "launcher_compose_java_defaults", 191 module_type: "java_defaults", 192 config_namespace: "ANDROID", 193 bool_variables: ["release_enable_compose_in_launcher"], 194 properties: [ 195 "srcs", 196 "static_libs", 197 ], 198} 199 200// Opt-in configuration for Launcher Quickstep code depending on Jetpack Compose. 201soong_config_bool_variable { 202 name: "release_enable_compose_in_launcher", 203} 204 205soong_config_module_type { 206 name: "quickstep_compose_java_defaults", 207 module_type: "java_defaults", 208 config_namespace: "ANDROID", 209 bool_variables: ["release_enable_compose_in_launcher"], 210 properties: [ 211 "srcs", 212 "static_libs", 213 ], 214} 215 216soong_config_module_type { 217 name: "launcher_compose_tests_java_defaults", 218 module_type: "java_defaults", 219 config_namespace: "ANDROID", 220 bool_variables: ["release_enable_compose_in_launcher"], 221 properties: [ 222 "static_libs", 223 ], 224} 225 226launcher_compose_java_defaults { 227 name: "launcher_compose_defaults", 228 soong_config_variables: { 229 release_enable_compose_in_launcher: { 230 srcs: [ 231 ":launcher-compose-enabled-src", 232 ], 233 234 // Compose dependencies 235 static_libs: [ 236 "androidx.compose.runtime_runtime", 237 "androidx.compose.material3_material3", 238 ], 239 240 // By default, Compose is disabled and we compile the ComposeFacade 241 // in compose/launcher3/facade/disabled/. 242 conditions_default: { 243 srcs: [ 244 ":launcher-compose-disabled-src", 245 ], 246 static_libs: [], 247 }, 248 }, 249 }, 250} 251 252quickstep_compose_java_defaults { 253 name: "quickstep_compose_defaults", 254 soong_config_variables: { 255 release_enable_compose_in_launcher: { 256 srcs: [ 257 ":launcher-quickstep-compose-enabled-src", 258 ], 259 260 // Compose dependencies 261 static_libs: [ 262 "androidx.compose.runtime_runtime", 263 "androidx.compose.material3_material3", 264 ], 265 266 // By default, Compose is disabled and we compile the ComposeFacade 267 // in compose/quickstep/facade/disabled/. 268 conditions_default: { 269 srcs: [ 270 ":launcher-quickstep-compose-disabled-src", 271 ], 272 static_libs: [], 273 }, 274 }, 275 }, 276} 277 278launcher_compose_tests_java_defaults { 279 name: "launcher_compose_tests_defaults", 280 soong_config_variables: { 281 release_enable_compose_in_launcher: { 282 // Compose dependencies 283 static_libs: [ 284 "androidx.compose.runtime_runtime", 285 "androidx.compose.ui_ui-test-junit4", 286 "androidx.compose.ui_ui-test-manifest", 287 ], 288 289 conditions_default: { 290 static_libs: [], 291 }, 292 }, 293 }, 294} 295 296android_library { 297 name: "launcher-aosp-tapl", 298 libs: [ 299 "framework-statsd.stubs.module_lib", 300 ], 301 static_libs: [ 302 "androidx.annotation_annotation", 303 "androidx.test.runner", 304 "androidx.test.rules", 305 "androidx.test.uiautomator_uiautomator", 306 "androidx.preference_preference", 307 "SystemUISharedLib", 308 "//frameworks/libs/systemui:animationlib", 309 "//frameworks/libs/systemui:contextualeducationlib", 310 "launcher-testing-shared", 311 ], 312 srcs: [ 313 "tests/tapl/**/*.java", 314 "tests/tapl/**/*.kt", 315 ], 316 resource_dirs: [], 317 manifest: "tests/tapl/AndroidManifest.xml", 318 platform_apis: true, 319} 320 321java_library_static { 322 name: "launcher_log_protos_lite", 323 srcs: [ 324 "protos/*.proto", 325 "protos_overrides/*.proto", 326 ], 327 sdk_version: "current", 328 proto: { 329 type: "lite", 330 local_include_dirs: [ 331 "protos", 332 "protos_overrides", 333 ], 334 }, 335 static_libs: ["libprotobuf-java-lite"], 336} 337 338java_library_static { 339 name: "launcher_quickstep_log_protos_lite", 340 srcs: [ 341 "quickstep/protos_overrides/*.proto", 342 ], 343 sdk_version: "current", 344 proto: { 345 type: "lite", 346 local_include_dirs: [ 347 "quickstep/protos_overrides", 348 ], 349 }, 350 static_libs: [ 351 "libprotobuf-java-lite", 352 "launcher_log_protos_lite", 353 ], 354} 355 356java_library { 357 name: "LauncherPluginLib", 358 359 static_libs: ["PluginCoreLib"], 360 361 srcs: ["src_plugins/**/*.java"], 362 363 sdk_version: "current", 364 min_sdk_version: min_launcher3_sdk_version, 365} 366 367// Library with all the dependencies for building Launcher3 368android_library { 369 name: "Launcher3ResLib", 370 defaults: [ 371 "launcher_compose_defaults", 372 ], 373 srcs: [], 374 resource_dirs: ["res"], 375 static_libs: [ 376 "LauncherPluginLib", 377 "launcher_quickstep_log_protos_lite", 378 "androidx-constraintlayout_constraintlayout", 379 "androidx.recyclerview_recyclerview", 380 "androidx.dynamicanimation_dynamicanimation", 381 "androidx.fragment_fragment", 382 "androidx.preference_preference", 383 "androidx.slice_slice-view", 384 "androidx.cardview_cardview", 385 "androidx.window_window", 386 "com.google.android.material_material", 387 "//frameworks/libs/systemui:iconloader_base", 388 "//frameworks/libs/systemui:view_capture", 389 "//frameworks/libs/systemui:animationlib", 390 "//frameworks/libs/systemui:contextualeducationlib", 391 "//frameworks/libs/systemui:msdl", 392 "SystemUI-statsd", 393 "WindowManager-Shell-shared-AOSP", 394 "launcher-testing-shared", 395 "androidx.lifecycle_lifecycle-common-java8", 396 "androidx.lifecycle_lifecycle-extensions", 397 "androidx.lifecycle_lifecycle-runtime-ktx", 398 "kotlinx_coroutines_android", 399 "kotlinx_coroutines", 400 "com_android_launcher3_flags_lib", 401 "com_android_wm_shell_flags_lib", 402 "dagger2", 403 "jsr330", 404 "com_android_systemui_shared_flags_lib", 405 ], 406 manifest: "AndroidManifest-common.xml", 407 sdk_version: "current", 408 min_sdk_version: min_launcher3_sdk_version, 409 lint: { 410 baseline_filename: "lint-baseline.xml", 411 }, 412 flags_packages: [ 413 "com_android_launcher3_flags", 414 ], 415} 416 417// 418// Build rule for Launcher3 app. 419// 420android_app { 421 name: "Launcher3", 422 defaults: ["launcher-non-platform-apis-defaults"], 423 424 static_libs: [ 425 "Launcher3ResLib", 426 ], 427 srcs: [ 428 ":launcher-src", 429 ":launcher-src_no_quickstep", 430 ":launcher-build-config", 431 ], 432 433 optimize: { 434 proguard_flags_files: [":launcher-proguard-rules"], 435 // Proguard is disable for testing. Derivarive prjects to keep proguard enabled 436 enabled: false, 437 }, 438 439 sdk_version: "current", 440 min_sdk_version: min_launcher3_sdk_version, 441 target_sdk_version: "current", 442 plugins: ["dagger2-compiler"], 443 privileged: true, 444 system_ext_specific: true, 445 446 overrides: [ 447 "Home", 448 "Launcher2", 449 ], 450 required: ["privapp_whitelist_com.android.launcher3"], 451 452 jacoco: { 453 include_filter: ["com.android.launcher3.**"], 454 }, 455 additional_manifests: [ 456 "AndroidManifest-common.xml", 457 ], 458 lint: { 459 extra_check_modules: ["Launcher3LintChecker"], 460 baseline_filename: "lint-baseline.xml", 461 }, 462 kotlincflags: [ 463 "-Xjvm-default=all", 464 ], 465} 466 467// Library with all the dependencies for building quickstep 468android_library { 469 name: "QuickstepResLib", 470 srcs: [], 471 resource_dirs: [ 472 "quickstep/res", 473 ], 474 libs: [ 475 "framework-statsd.stubs.module_lib", 476 ], 477 static_libs: [ 478 "Launcher3ResLib", 479 "lottie", 480 "SystemUISharedLib", 481 "SettingsLibSettingsTheme", 482 "dagger2", 483 "protolog-group", 484 ], 485 manifest: "quickstep/AndroidManifest.xml", 486 min_sdk_version: "current", 487 lint: { 488 disabled_checks: ["MissingClass"], 489 }, 490} 491 492// Library with all the source code and dependencies for building Launcher Go 493android_library { 494 name: "Launcher3GoLib", 495 defaults: [ 496 "launcher_compose_defaults", 497 "quickstep_compose_defaults", 498 ], 499 srcs: [ 500 ":launcher-src", 501 ":launcher-quickstep-src", 502 ":launcher-quickstep-dagger", 503 "go/quickstep/src/**/*.java", 504 "go/quickstep/src/**/*.kt", 505 ], 506 resource_dirs: [ 507 "go/quickstep/res", 508 ], 509 // Note the ordering here is important when it comes to resource 510 // overriding. We want the most specific resource overrides defined 511 // in QuickstepResLib to take precendece, so it should be the final 512 // dependency. See b/205278434 for how this can go wrong. 513 static_libs: [ 514 "QuickstepResLib", 515 "androidx.room_room-runtime", 516 ], 517 plugins: [ 518 "androidx.room_room-compiler-plugin", 519 "dagger2-compiler", 520 ], 521 manifest: "quickstep/AndroidManifest.xml", 522 additional_manifests: [ 523 "go/AndroidManifest.xml", 524 "AndroidManifest-common.xml", 525 ], 526 min_sdk_version: "current", 527 // TODO(b/319712088): re-enable use_resource_processor 528 use_resource_processor: false, 529 kotlincflags: [ 530 "-Xjvm-default=all", 531 ], 532} 533 534// Library with all the source code and dependencies for building Quickstep 535android_library { 536 name: "Launcher3QuickStepLib", 537 defaults: [ 538 "launcher_compose_defaults", 539 "quickstep_compose_defaults", 540 ], 541 srcs: [ 542 ":launcher-src", 543 ":launcher-quickstep-src", 544 ":launcher-quickstep-dagger", 545 ":launcher-build-config", 546 ], 547 resource_dirs: [], 548 libs: [ 549 "framework-statsd.stubs.module_lib", 550 ], 551 // Note the ordering here is important when it comes to resource 552 // overriding. We want the most specific resource overrides defined 553 // in QuickstepResLib to take precendece, so it should be the final 554 // dependency. See b/208647810 for how this can go wrong. 555 static_libs: [ 556 "SystemUI-statsd", 557 "QuickstepResLib", 558 ], 559 manifest: "quickstep/AndroidManifest.xml", 560 platform_apis: true, 561 plugins: ["dagger2-compiler"], 562 min_sdk_version: "current", 563 // TODO(b/319712088): re-enable use_resource_processor 564 use_resource_processor: false, 565 kotlincflags: [ 566 "-Xjvm-default=all", 567 ], 568} 569 570// Build rule for Quickstep app. 571android_app { 572 name: "Launcher3QuickStep", 573 static_libs: ["Launcher3QuickStepLib"], 574 optimize: { 575 proguard_flags_files: [":launcher-proguard-rules"], 576 enabled: true, 577 shrink_resources: true, 578 }, 579 580 platform_apis: true, 581 min_sdk_version: "current", 582 target_sdk_version: "current", 583 584 privileged: true, 585 system_ext_specific: true, 586 overrides: [ 587 "Home", 588 "Launcher2", 589 "Launcher3", 590 ], 591 required: [ 592 "privapp_whitelist_com.android.launcher3", 593 "launcher.quickstep.protolog.pb", 594 ], 595 596 resource_dirs: ["quickstep/res"], 597 598 additional_manifests: [ 599 "quickstep/AndroidManifest-launcher.xml", 600 "AndroidManifest-common.xml", 601 ], 602 603 manifest: "quickstep/AndroidManifest.xml", 604 jacoco: { 605 include_filter: ["com.android.launcher3.*"], 606 }, 607 608} 609 610// Build rule for Launcher3 Go app with quickstep for Android Go devices. 611// Note that the following two rules are exactly same, and should 612// eventually be merged into a single target 613android_app { 614 name: "Launcher3Go", 615 static_libs: ["Launcher3GoLib"], 616 resource_dirs: [], 617 618 platform_apis: true, 619 min_sdk_version: "current", 620 target_sdk_version: "current", 621 622 optimize: { 623 proguard_flags_files: ["proguard.flags"], 624 enabled: true, 625 shrink_resources: true, 626 }, 627 628 privileged: true, 629 system_ext_specific: true, 630 overrides: [ 631 "Home", 632 "Launcher2", 633 "Launcher3", 634 "Launcher3QuickStep", 635 ], 636 required: ["privapp_whitelist_com.android.launcher3"], 637 638 additional_manifests: [ 639 "go/AndroidManifest.xml", 640 "go/AndroidManifest-launcher.xml", 641 "AndroidManifest-common.xml", 642 ], 643 644 manifest: "quickstep/AndroidManifest.xml", 645 jacoco: { 646 include_filter: ["com.android.launcher3.*"], 647 }, 648} 649 650android_app { 651 name: "Launcher3QuickStepGo", 652 static_libs: ["Launcher3GoLib"], 653 resource_dirs: [], 654 655 platform_apis: true, 656 min_sdk_version: "current", 657 target_sdk_version: "current", 658 659 optimize: { 660 proguard_flags_files: ["proguard.flags"], 661 enabled: true, 662 shrink_resources: true, 663 }, 664 665 privileged: true, 666 system_ext_specific: true, 667 overrides: [ 668 "Home", 669 "Launcher2", 670 "Launcher3", 671 "Launcher3QuickStep", 672 ], 673 required: ["privapp_whitelist_com.android.launcher3"], 674 675 additional_manifests: [ 676 "go/AndroidManifest.xml", 677 "go/AndroidManifest-launcher.xml", 678 "AndroidManifest-common.xml", 679 ], 680 681 manifest: "quickstep/AndroidManifest.xml", 682 jacoco: { 683 include_filter: ["com.android.launcher3.*"], 684 }, 685} 686