1// List of clang-tidy checks that are reported as errors. 2// Please keep this list ordered lexicographically. 3package { 4 default_applicable_licenses: ["Android-Apache-2.0"], 5} 6 7tidy_errors = [ 8 "android-*", 9 "bugprone-infinite-loop", 10 "bugprone-macro-parentheses", 11 "bugprone-misplaced-widening-cast", 12 "bugprone-move-forwarding-reference", 13 "bugprone-sizeof-container", 14 "bugprone-sizeof-expression", 15 "bugprone-string-constructor", 16 "bugprone-terminating-continue", 17 "bugprone-undefined-memory-manipulation", 18 "bugprone-undelegated-constructor", 19 // "bugprone-unhandled-self-assignment", // found in apex_manifest.proto 20 "bugprone-unused-raii", 21 "cert-err34-c", 22 "google-default-arguments", 23 // "google-explicit-constructor", // found in com_android_apex.h 24 "google-readability-avoid-underscore-in-googletest-name", 25 "google-readability-todo", 26 "google-runtime-int", 27 "google-runtime-member-string-references", 28 "misc-move-const-arg", 29 "misc-move-forwarding-reference", 30 // "misc-unused-parameters", // found in apexd_utils.h 31 "misc-unused-using-decls", 32 "misc-use-after-move", 33 // "modernize-pass-by-value", // found in apex_database.h 34 "performance-faster-string-find", 35 "performance-for-range-copy", 36 "performance-implicit-conversion-in-loop", 37 "performance-inefficient-vector-operation", 38 "performance-move-const-arg", 39 // "performance-move-constructor-init", // found in apexd_loop.h 40 "performance-noexcept-move-constructor", 41 "performance-unnecessary-copy-initialization", 42 "performance-unnecessary-value-param", 43 // "readability-avoid-const-params-in-decls", // found in apexd.h 44] 45 46cc_defaults { 47 name: "apex_flags_defaults", 48 cflags: [ 49 "-Wall", 50 "-Wextra", 51 "-Werror", 52 "-Wno-unused-parameter", 53 54 // Some extra flags. 55 "-fstrict-aliasing", 56 "-Wredundant-decls", 57 "-Wshadow", 58 "-Wstrict-aliasing", 59 "-Wthread-safety", 60 "-Wthread-safety-negative", 61 "-Wunreachable-code", 62 "-Wunreachable-code-break", 63 "-Wunreachable-code-return", 64 "-Wunused", 65 "-Wused-but-marked-unused", 66 ], 67 tidy: true, 68 tidy_checks: tidy_errors, 69 tidy_checks_as_errors: tidy_errors, 70 tidy_flags: [ 71 "-format-style=file", 72 "-header-filter=system/apex/", 73 ], 74} 75 76soong_config_module_type { 77 name: "apexd_cc_defaults", 78 module_type: "cc_defaults", 79 config_namespace: "ANDROID", 80 bool_variables: [ 81 "target_board_auto", 82 ], 83 properties: [ 84 "cppflags", 85 ], 86} 87 88apexd_cc_defaults { 89 name: "libapexd-deps", 90 defaults: ["libapex-deps"], 91 shared_libs: [ 92 "libbinder", 93 "liblog", 94 "liblogwrap", 95 ], 96 static_libs: [ 97 "libapex", 98 "libavb", 99 "libdm", 100 "libext2_uuid", 101 "libsigningutils", 102 "libverity_tree", 103 "libvold_binder", 104 "libxml2", 105 ], 106 whole_static_libs: ["com.android.sysprop.apex"], 107 soong_config_variables: { 108 target_board_auto: { 109 cppflags: ["-DDISABLE_LOOP_IO_CONFIG"], 110 }, 111 }, 112} 113 114aidl_interface { 115 name: "apex_aidl_interface", 116 unstable: true, 117 srcs: [ 118 "aidl/android/apex/ApexInfo.aidl", 119 "aidl/android/apex/ApexInfoList.aidl", 120 "aidl/android/apex/ApexSessionInfo.aidl", 121 "aidl/android/apex/ApexSessionParams.aidl", 122 "aidl/android/apex/CompressedApexInfo.aidl", 123 "aidl/android/apex/CompressedApexInfoList.aidl", 124 "aidl/android/apex/IApexService.aidl", 125 ], 126 local_include_dir: "aidl", 127 backend: { 128 java: { 129 sdk_version: "28", 130 }, 131 ndk: { 132 enabled: false, 133 }, 134 }, 135} 136 137cc_binary { 138 name: "apexd", 139 defaults: [ 140 "apex_flags_defaults", 141 "libapex-deps", 142 "libapexd-deps", 143 "libapexservice-deps", 144 ], 145 srcs: [ 146 "apexd_main.cpp", 147 ], 148 static_libs: [ 149 "libapex", 150 "libapexd", 151 "libapexd_checkpoint_vold", 152 "libapexservice", 153 ], 154 init_rc: ["apexd.rc"], 155 // Just like the init, apexd should be able to run without 156 // any APEX activated. To do so, it uses the bootstrap linker 157 // and the bootstrap bionic libraries. 158 bootstrap: true, 159} 160 161cc_library_static { 162 name: "libapexd", 163 defaults: [ 164 "apex_flags_defaults", 165 "libapexd-deps", 166 ], 167 srcs: [ 168 "apex_classpath.cpp", 169 "apex_database.cpp", 170 "apexd.cpp", 171 "apexd_lifecycle.cpp", 172 "apexd_loop.cpp", 173 "apexd_private.cpp", 174 "apexd_session.cpp", 175 "apexd_verity.cpp", 176 ], 177 export_include_dirs: ["."], 178 generated_sources: ["apex-info-list"], 179 // Don't add shared/static libs here; add to libapexd_defaults instead. 180} 181 182cc_library_static { 183 name: "libapexd_checkpoint_vold", 184 defaults: ["apex_flags_defaults"], 185 srcs: [ "apexd_checkpoint_vold.cpp" ], 186 static_libs: [ 187 "libbase", 188 "libutils", 189 "libvold_binder", 190 ], 191 export_include_dirs: ["."], 192} 193 194cc_defaults { 195 name: "libapexservice-deps", 196 shared_libs: [ 197 "apex_aidl_interface-cpp", 198 "libbinder", 199 "libutils", 200 ], 201} 202 203cc_library_static { 204 name: "libapexservice", 205 defaults: [ 206 "apex_flags_defaults", 207 "libapexd-deps", 208 "libapexservice-deps", 209 ], 210 srcs: ["apexservice.cpp"], 211 static_libs: [ 212 "libapexd", 213 ], 214 cflags: [ 215 "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION", 216 ], 217} 218 219cc_defaults { 220 name: "libapex-deps", 221 shared_libs: [ 222 "libbase", 223 "libcrypto", 224 "libcutils", 225 "libprotobuf-cpp-full", 226 "libziparchive", 227 "libselinux", 228 ], 229 static_libs: [ 230 "lib_apex_session_state_proto", 231 "lib_apex_manifest_proto", 232 "lib_microdroid_metadata_proto", 233 "libavb", 234 "libverity_tree", 235 ], 236 static: { 237 whole_static_libs: ["libc++fs"], 238 }, 239 cpp_std: "experimental", 240 shared: { 241 static_libs: ["libc++fs"], 242 }, 243} 244 245cc_library_static { 246 name: "libapex", 247 defaults: [ 248 "apex_flags_defaults", 249 "libapex-deps" 250 ], 251 srcs: [ 252 "apex_file.cpp", 253 "apex_file_repository.cpp", 254 "apex_manifest.cpp", 255 "apex_shim.cpp", 256 "apexd_verity.cpp", 257 ], 258 host_supported: true, 259 target: { 260 darwin: { 261 enabled: false, 262 }, 263 }, 264 header_libs: [ 265 "libutils_headers", 266 ], 267 export_header_lib_headers: [ 268 "libutils_headers", 269 ], 270 export_include_dirs: ["."], 271} 272 273genrule { 274 // Generates an apex which has a different manifest outside the filesystem 275 // image. 276 name: "gen_manifest_mismatch_apex", 277 out: ["apex.apexd_test_manifest_mismatch.apex"], 278 srcs: [":apex.apexd_test"], 279 tools: ["soong_zip", "zipalign", "conv_apex_manifest"], 280 cmd: "unzip -q $(in) -d $(genDir) && " + 281 "$(location conv_apex_manifest) setprop version 137 $(genDir)/apex_manifest.pb && " + 282 "$(location soong_zip) -d -C $(genDir) -D $(genDir) " + 283 "-s apex_manifest.pb -s apex_payload.img -s apex_pubkey " + 284 "-o $(genDir)/unaligned.apex && " + 285 "$(location zipalign) -f 4096 $(genDir)/unaligned.apex " + 286 "$(genDir)/apex.apexd_test_manifest_mismatch.apex" 287} 288 289genrule { 290 // Generates an apex which has a different manifest outside the filesystem 291 // image. 292 name: "gen_manifest_mismatch_apex_no_hashtree", 293 out: ["apex.apexd_test_no_hashtree_manifest_mismatch.apex"], 294 srcs: [":apex.apexd_test_no_hashtree"], 295 tools: ["soong_zip", "zipalign", "conv_apex_manifest"], 296 cmd: "unzip -q $(in) -d $(genDir) && " + 297 "$(location conv_apex_manifest) setprop version 137 $(genDir)/apex_manifest.pb && " + 298 "$(location soong_zip) -d -C $(genDir) -D $(genDir) " + 299 "-s apex_manifest.pb -s apex_payload.img -s apex_pubkey " + 300 "-o $(genDir)/unaligned.apex && " + 301 "$(location zipalign) -f 4096 $(genDir)/unaligned.apex " + 302 "$(genDir)/apex.apexd_test_no_hashtree_manifest_mismatch.apex" 303} 304 305genrule { 306 // Generates an apex with a corrupted filesystem superblock, which should cause 307 // Apex::Open to fail 308 name: "gen_corrupt_superblock_apex", 309 out: ["apex.apexd_test_corrupt_superblock_apex.apex"], 310 srcs: [":apex.apexd_test"], 311 tools: ["soong_zip", "zipalign"], 312 cmd: "unzip -q $(in) -d $(genDir) && " + 313 "dd if=/dev/zero of=$(genDir)/apex_payload.img conv=notrunc bs=1024 seek=1 count=1 && " + 314 "$(location soong_zip) -d -C $(genDir) -D $(genDir) " + 315 "-s apex_manifest.pb -s apex_payload.img -s apex_pubkey " + 316 "-o $(genDir)/unaligned.apex && " + 317 "$(location zipalign) -f 4096 $(genDir)/unaligned.apex " + 318 "$(genDir)/apex.apexd_test_corrupt_superblock_apex.apex" 319} 320 321genrule { 322 // Generates an apex with a corrupted filesystem image, which should cause 323 // dm-verity verification to fail 324 name: "gen_corrupt_apex", 325 out: ["apex.apexd_test_corrupt_apex.apex"], 326 srcs: [":apex.apexd_test"], 327 tools: ["soong_zip", "zipalign"], 328 cmd: "unzip -q $(in) -d $(genDir) && " + 329 "dd if=/dev/zero of=$(genDir)/apex_payload.img conv=notrunc bs=1024 seek=16 count=1 && " + 330 "$(location soong_zip) -d -C $(genDir) -D $(genDir) " + 331 "-s apex_manifest.pb -s apex_payload.img -s apex_pubkey " + 332 "-o $(genDir)/unaligned.apex && " + 333 "$(location zipalign) -f 4096 $(genDir)/unaligned.apex " + 334 "$(genDir)/apex.apexd_test_corrupt_apex.apex" 335} 336 337genrule { 338 // Extract the root digest with avbtool 339 name: "apex.apexd_test_digest", 340 out: ["apex.apexd_test_digest.txt"], 341 srcs: [":apex.apexd_test"], 342 tools: ["avbtool"], 343 cmd: "unzip -q $(in) -d $(genDir) apex_payload.img && " + 344 "$(location avbtool) print_partition_digests --image $(genDir)/apex_payload.img " + 345 "| cut -c 3-| tee $(out)" 346} 347 348genrule { 349 // Extract the root digest with avbtool 350 name: "apex.apexd_test_f2fs_digest", 351 out: ["apex.apexd_test_f2fs_digest.txt"], 352 srcs: [":apex.apexd_test_f2fs"], 353 tools: ["avbtool"], 354 cmd: "unzip -q $(in) -d $(genDir) apex_payload.img && " + 355 "$(location avbtool) print_partition_digests --image $(genDir)/apex_payload.img " + 356 "| cut -c 3-| tee $(out)" 357} 358 359genrule { 360 // Extract the root digest with avbtool 361 name: "apex.apexd_test_erofs_digest", 362 out: ["apex.apexd_test_erofs_digest.txt"], 363 srcs: [":apex.apexd_test_erofs"], 364 tools: ["avbtool"], 365 cmd: "unzip -q $(in) -d $(genDir) apex_payload.img && " + 366 "$(location avbtool) print_partition_digests --image $(genDir)/apex_payload.img " + 367 "| cut -c 3-| tee $(out)" 368} 369 370genrule { 371 // Generates an apex which has same module name as apex.apexd_test.apex, but 372 // is actually signed with a different key. 373 name: "gen_key_mismatch_apex", 374 out: ["apex.apexd_test_different_key.apex"], 375 srcs: [":apex.apexd_test_no_inst_key"], 376 tools: ["soong_zip", "zipalign", "conv_apex_manifest"], 377 cmd: "unzip -q $(in) -d $(genDir) && " + 378 "$(location conv_apex_manifest) setprop name com.android.apex.test_package $(genDir)/apex_manifest.pb && " + 379 "$(location soong_zip) -d -C $(genDir) -D $(genDir) " + 380 "-s apex_manifest.pb -s apex_payload.img -s apex_pubkey " + 381 "-o $(genDir)/unaligned.apex && " + 382 "$(location zipalign) -f 4096 $(genDir)/unaligned.apex " + 383 "$(genDir)/apex.apexd_test_different_key.apex" 384} 385 386genrule { 387 // Generates an apex which has same module name as apex.apexd_test.apex, but 388 // is actually signed with a different key. 389 name: "gen_key_mismatch_apex_v2", 390 out: ["apex.apexd_test_different_key_v2.apex"], 391 srcs: [":apex.apexd_test_no_inst_key"], 392 tools: ["soong_zip", "zipalign", "conv_apex_manifest"], 393 cmd: "unzip -q $(in) -d $(genDir) && " + 394 "$(location conv_apex_manifest) setprop name com.android.apex.test_package $(genDir)/apex_manifest.pb && " + 395 "$(location conv_apex_manifest) setprop version 2 $(genDir)/apex_manifest.pb && " + 396 "$(location soong_zip) -d -C $(genDir) -D $(genDir) " + 397 "-s apex_manifest.pb -s apex_payload.img -s apex_pubkey " + 398 "-o $(genDir)/unaligned.apex && " + 399 "$(location zipalign) -f 4096 $(genDir)/unaligned.apex " + 400 "$(genDir)/apex.apexd_test_different_key_v2.apex" 401} 402 403genrule { 404 // Generates an apex which has a different manifest outside the filesystem 405 // image. 406 name: "gen_manifest_mismatch_rebootless_apex", 407 out: ["test.rebootless_apex_manifest_mismatch.apex"], 408 srcs: [":test.rebootless_apex_v1"], 409 tools: ["soong_zip", "zipalign", "conv_apex_manifest"], 410 cmd: "unzip -q $(in) -d $(genDir) && " + 411 "$(location conv_apex_manifest) setprop version 137 $(genDir)/apex_manifest.pb && " + 412 "$(location soong_zip) -d -C $(genDir) -D $(genDir) " + 413 "-s apex_manifest.pb -s apex_payload.img -s apex_pubkey " + 414 "-o $(genDir)/unaligned.apex && " + 415 "$(location zipalign) -f 4096 $(genDir)/unaligned.apex " + 416 "$(genDir)/test.rebootless_apex_manifest_mismatch.apex" 417} 418 419genrule { 420 // Generates an apex with a corrupted filesystem image, which should cause 421 // dm-verity verification to fail 422 name: "gen_corrupt_rebootless_apex", 423 out: ["test.rebootless_apex_corrupted.apex"], 424 srcs: [":test.rebootless_apex_v1"], 425 tools: ["soong_zip", "zipalign"], 426 cmd: "unzip -q $(in) -d $(genDir) && " + 427 "dd if=/dev/zero of=$(genDir)/apex_payload.img conv=notrunc bs=1024 seek=16 count=1 && " + 428 "$(location soong_zip) -d -C $(genDir) -D $(genDir) " + 429 "-s apex_manifest.pb -s apex_payload.img -s apex_pubkey " + 430 "-o $(genDir)/unaligned.apex && " + 431 "$(location zipalign) -f 4096 $(genDir)/unaligned.apex " + 432 "$(genDir)/test.rebootless_apex_corrupted.apex" 433} 434 435cc_test { 436 name: "ApexTestCases", 437 defaults: [ 438 "apex_flags_defaults", 439 "libapex-deps", 440 "libapexd-deps" 441 ], 442 require_root: true, 443 cflags: [ 444 // Otherwise libgmock won't compile. 445 "-Wno-used-but-marked-unused", 446 ], 447 data: [ 448 ":apex.apexd_test", 449 ":apex.apexd_test_erofs", 450 ":apex.apexd_test_f2fs", 451 ":apex.apexd_test_digest", 452 ":apex.apexd_test_erofs_digest", 453 ":apex.apexd_test_f2fs_digest", 454 ":apex.apexd_test_classpath", 455 ":apex.apexd_test_different_app", 456 ":apex.apexd_test_no_hashtree", 457 ":apex.apexd_test_no_hashtree_2", 458 ":apex.apexd_test_no_inst_key", 459 ":apex.apexd_test_f2fs_no_inst_key", 460 ":apex.apexd_test_nocode", 461 ":apex.apexd_test_v2", 462 ":apex.corrupted_b146895998", 463 ":apex.banned_name", 464 ":gen_key_mismatch_apex", 465 ":gen_key_mismatch_apex_v2", 466 ":gen_key_mismatch_capex", 467 ":gen_manifest_mismatch_apex", 468 ":gen_manifest_mismatch_apex_no_hashtree", 469 ":gen_corrupt_superblock_apex", 470 ":gen_corrupt_apex", 471 ":gen_capex_not_decompressible", 472 ":gen_capex_without_apex", 473 ":gen_capex_with_v2_apex", 474 ":gen_key_mismatch_with_original_capex", 475 ":com.android.apex.cts.shim.v1_prebuilt", 476 ":com.android.apex.cts.shim.v2_prebuilt", 477 ":com.android.apex.cts.shim.v2_wrong_sha_prebuilt", 478 ":com.android.apex.cts.shim.v2_additional_file_prebuilt", 479 ":com.android.apex.cts.shim.v2_additional_folder_prebuilt", 480 ":com.android.apex.cts.shim.v2_with_pre_install_hook_prebuilt", 481 ":com.android.apex.cts.shim.v2_with_post_install_hook_prebuilt", 482 ":com.android.apex.compressed_sharedlibs", 483 ":com.android.apex.compressed.v1", 484 ":com.android.apex.compressed.v1_different_digest", 485 ":com.android.apex.compressed.v1_different_digest_original", 486 ":com.android.apex.compressed.v1_original", 487 ":com.android.apex.compressed.v2", 488 ":com.android.apex.compressed.v2_original", 489 ":com.android.sepolicy", 490 ":gen_manifest_mismatch_compressed_apex_v2", 491 "apexd_testdata/com.android.apex.test_package.avbpubkey", 492 "apexd_testdata/com.android.apex.compressed.avbpubkey", 493 ":com.android.apex.test.sharedlibs_generated.v1.libvX_prebuilt", 494 ":com.android.apex.test.sharedlibs_generated.v2.libvY_prebuilt", 495 ":test.rebootless_apex_v1", 496 ":test.rebootless_apex_v2", 497 ":test.rebootless_apex_v2_no_hashtree", 498 ":gen_manifest_mismatch_rebootless_apex", 499 ":gen_corrupt_rebootless_apex", 500 ":test.rebootless_apex_provides_sharedlibs", 501 ":test.rebootless_apex_provides_native_libs", 502 ":test.rebootless_apex_requires_shared_apex_libs", 503 ":test.rebootless_apex_jni_libs", 504 ":test.rebootless_apex_add_native_lib", 505 ":test.rebootless_apex_remove_native_lib", 506 ":test.rebootless_apex_app_in_apex", 507 ":test.rebootless_apex_priv_app_in_apex", 508 ], 509 srcs: [ 510 "apex_classpath_test.cpp", 511 "apex_database_test.cpp", 512 "apex_file_test.cpp", 513 "apex_file_repository_test.cpp", 514 "apex_manifest_test.cpp", 515 "apexd_test.cpp", 516 "apexd_session_test.cpp", 517 "apexd_verity_test.cpp", 518 "apexd_utils_test.cpp", 519 "apexservice_test.cpp", 520 ], 521 host_supported: false, 522 compile_multilib: "first", 523 static_libs: [ 524 "apex_aidl_interface-cpp", 525 "libapex", 526 "libapexd", 527 "libfstab", 528 "libgmock", 529 ], 530 shared_libs: [ 531 "libbinder", 532 "libfs_mgr", 533 "libutils", 534 ], 535 generated_sources: ["apex-info-list"], 536 test_suites: ["device-tests"], 537 test_config: "AndroidTest.xml", 538} 539 540cc_test { 541 name: "flattened_apex_test", 542 defaults: [ 543 "apex_flags_defaults", 544 "libapex-deps", 545 "libapexd-deps" 546 ], 547 srcs: ["flattened_apex_test.cpp"], 548 host_supported: false, 549 compile_multilib: "first", 550 static_libs: [ 551 "libapex", 552 "libapexd", 553 ], 554 test_suites: ["device-tests"], 555 test_config: "flattened_apex_test_config.xml", 556} 557 558xsd_config { 559 name: "apex-info-list", 560 srcs: ["ApexInfoList.xsd"], 561 package_name: "com.android.apex", 562 api_dir: "apex-info-list-api", 563 gen_writer: true, 564} 565 566xsd_config { 567 name: "apex-info-list-tinyxml", 568 srcs: ["ApexInfoList.xsd"], 569 package_name: "com.android.apex", 570 api_dir: "apex-info-list-api", 571 gen_writer: true, 572 tinyxml: true, 573} 574