From c2b6b65d7380407757dc596af00ee954b3cc2968 Mon Sep 17 00:00:00 2001 From: Ulyana Trafimovich Date: Wed, 6 Jan 2021 15:09:40 +0000 Subject: [PATCH 01/13] Revert "Enforce checks for android_app and android_app_import." This reverts commit 22890c466e8d69968b420af1e2b59341913f6042. Reason for revert: Broken build 7065627 on git_rvc-qpr-dev-plus-aosp on aosp_sunfish-userdebug branch. Bug: 176892941 Test: treehugger Change-Id: I0f5da13644fd2ec7b0472fe82918e3c6a72d953c --- java/app.go | 7 +------ java/app_import.go | 2 -- java/app_import_test.go | 18 +++++++++--------- 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/java/app.go b/java/app.go index 574472c1b..249313c35 100755 --- a/java/app.go +++ b/java/app.go @@ -905,8 +905,6 @@ func AndroidAppFactory() android.Module { &module.appProperties, &module.overridableAppProperties) - module.usesLibrary.enforce = true - android.InitAndroidMultiTargetsArchModule(module, android.DeviceSupported, android.MultilibCommon) android.InitDefaultableModule(module) android.InitOverridableModule(module, &module.appProperties.Overrides) @@ -1177,9 +1175,6 @@ type UsesLibraryProperties struct { // with knowledge of their shared libraries. type usesLibrary struct { usesLibraryProperties UsesLibraryProperties - - // Whether to enforce verify_uses_library check. - enforce bool } func (u *usesLibrary) addLib(lib string, optional bool) { @@ -1246,7 +1241,7 @@ func (u *usesLibrary) classLoaderContextForUsesLibDeps(ctx android.ModuleContext func (u *usesLibrary) enforceUsesLibraries() bool { defaultEnforceUsesLibs := len(u.usesLibraryProperties.Uses_libs) > 0 || len(u.usesLibraryProperties.Optional_uses_libs) > 0 - return BoolDefault(u.usesLibraryProperties.Enforce_uses_libs, u.enforce || defaultEnforceUsesLibs) + return BoolDefault(u.usesLibraryProperties.Enforce_uses_libs, defaultEnforceUsesLibs) } // Freeze the value of `enforce_uses_libs` based on the current values of `uses_libs` and `optional_uses_libs`. diff --git a/java/app_import.go b/java/app_import.go index df940f1ff..2054785f5 100644 --- a/java/app_import.go +++ b/java/app_import.go @@ -430,8 +430,6 @@ func AndroidAppImportFactory() android.Module { android.InitDefaultableModule(module) android.InitSingleSourcePrebuiltModule(module, &module.properties, "Apk") - module.usesLibrary.enforce = true - return module } diff --git a/java/app_import_test.go b/java/app_import_test.go index 344d23b55..3b55c814a 100644 --- a/java/app_import_test.go +++ b/java/app_import_test.go @@ -182,31 +182,31 @@ func TestAndroidAppImport_DpiVariants(t *testing.T) { name: "no preferred", aaptPreferredConfig: nil, aaptPrebuiltDPI: []string{}, - expected: "verify_uses_libraries/apk/app.apk", + expected: "prebuilts/apk/app.apk", }, { name: "AAPTPreferredConfig matches", aaptPreferredConfig: proptools.StringPtr("xhdpi"), aaptPrebuiltDPI: []string{"xxhdpi", "ldpi"}, - expected: "verify_uses_libraries/apk/app_xhdpi.apk", + expected: "prebuilts/apk/app_xhdpi.apk", }, { name: "AAPTPrebuiltDPI matches", aaptPreferredConfig: proptools.StringPtr("mdpi"), aaptPrebuiltDPI: []string{"xxhdpi", "xhdpi"}, - expected: "verify_uses_libraries/apk/app_xxhdpi.apk", + expected: "prebuilts/apk/app_xxhdpi.apk", }, { name: "non-first AAPTPrebuiltDPI matches", aaptPreferredConfig: proptools.StringPtr("mdpi"), aaptPrebuiltDPI: []string{"ldpi", "xhdpi"}, - expected: "verify_uses_libraries/apk/app_xhdpi.apk", + expected: "prebuilts/apk/app_xhdpi.apk", }, { name: "no matches", aaptPreferredConfig: proptools.StringPtr("mdpi"), aaptPrebuiltDPI: []string{"ldpi", "xxxhdpi"}, - expected: "verify_uses_libraries/apk/app.apk", + expected: "prebuilts/apk/app.apk", }, } @@ -225,7 +225,7 @@ func TestAndroidAppImport_DpiVariants(t *testing.T) { if len(matches) != 2 { t.Errorf("failed to extract the src apk path from %q", jniRuleCommand) } - if strings.HasSuffix(matches[1], test.expected) { + if test.expected != matches[1] { t.Errorf("wrong src apk, expected: %q got: %q", test.expected, matches[1]) } } @@ -302,7 +302,7 @@ func TestAndroidAppImport_ArchVariants(t *testing.T) { }, } `, - expected: "verify_uses_libraries/apk/app_arm64.apk", + expected: "prebuilts/apk/app_arm64.apk", }, { name: "no matching arch", @@ -321,7 +321,7 @@ func TestAndroidAppImport_ArchVariants(t *testing.T) { }, } `, - expected: "verify_uses_libraries/apk/app.apk", + expected: "prebuilts/apk/app.apk", }, { name: "no matching arch without default", @@ -359,7 +359,7 @@ func TestAndroidAppImport_ArchVariants(t *testing.T) { if len(matches) != 2 { t.Errorf("failed to extract the src apk path from %q", jniRuleCommand) } - if strings.HasSuffix(matches[1], test.expected) { + if test.expected != matches[1] { t.Errorf("wrong src apk, expected: %q got: %q", test.expected, matches[1]) } } From 0fe6d39e4675439f35e45dfc9cf6b2dfe74da950 Mon Sep 17 00:00:00 2001 From: Martijn Coenen Date: Wed, 17 Feb 2021 11:13:59 +0100 Subject: [PATCH 02/13] Add MediaProvider dependencies to allowed_deps.txt Bug: 180375550 Test: builds Change-Id: I0f5acf1f2de1f9f16294c0ef0e62a7bf48929aff Merged-In: I0f5acf1f2de1f9f16294c0ef0e62a7bf48929aff --- apex/allowed_deps.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apex/allowed_deps.txt b/apex/allowed_deps.txt index 8157b755e..a8a7eb096 100644 --- a/apex/allowed_deps.txt +++ b/apex/allowed_deps.txt @@ -176,6 +176,8 @@ ExtServices(minSdkVersion:current) ExtServices-core(minSdkVersion:current) flatbuffer_headers(minSdkVersion:(no version)) fmtlib(minSdkVersion:29) +fmtlib_ndk(minSdkVersion:29) +framework-mediaprovider(minSdkVersion:30) framework-permission(minSdkVersion:30) framework-permission(minSdkVersion:current) framework-permission-s(minSdkVersion:30) @@ -240,6 +242,7 @@ libbacktrace_rs.rust_sysroot(minSdkVersion:29) libbacktrace_sys.rust_sysroot(minSdkVersion:29) libbase(minSdkVersion:29) libbase_headers(minSdkVersion:29) +libbase_ndk(minSdkVersion:29) libbinder_headers(minSdkVersion:29) libbinder_headers_platform_shared(minSdkVersion:29) libbinderthreadstateutils(minSdkVersion:29) @@ -315,6 +318,8 @@ libflacextractor(minSdkVersion:29) libfmq(minSdkVersion:29) libfmq-base(minSdkVersion:29) libFraunhoferAAC(minSdkVersion:29) +libfuse(minSdkVersion:30) +libfuse_jni(minSdkVersion:30) libgav1(minSdkVersion:29) libgcc(minSdkVersion:(no version)) libgcc_stripped(minSdkVersion:(no version)) @@ -469,6 +474,8 @@ libyuv_static(minSdkVersion:29) libzstd(minSdkVersion:(no version)) media_ndk_headers(minSdkVersion:29) media_plugin_headers(minSdkVersion:29) +MediaProvider(minSdkVersion:30) +MediaProviderGoogle(minSdkVersion:30) mediaswcodec(minSdkVersion:29) metrics-constants-protos(minSdkVersion:29) modules-utils-build(minSdkVersion:29) From fdc78fd88d1968b4d1f12a3f952710bd87a4d8da Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Tue, 8 Dec 2020 17:31:59 -0800 Subject: [PATCH 03/13] Add ArcSettings and SettingsGoogle to the legacy allowlist Settings-core is already in the allowlist, ArcSettings and SettingsGoogle need to compile the same source files but were in Android.mk files. Add them to the allowlist so they can be converted to Android.bp. This relands I73bef76ecc517223827ac6f3cb1f0624c738fb9d. Bug: 175124789 Change-Id: I6e116b5d4574990c8513371bbbb5175f2516c98f Test: m RunSettingsGoogleRoboTests RunArcSettingsRoboTests --- java/legacy_core_platform_api_usage.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/java/legacy_core_platform_api_usage.go b/java/legacy_core_platform_api_usage.go index 021920af6..568ce183f 100644 --- a/java/legacy_core_platform_api_usage.go +++ b/java/legacy_core_platform_api_usage.go @@ -24,6 +24,7 @@ import ( // merges between branches (see the comment in the // useLegacyCorePlatformApi() function): var legacyCorePlatformApiModules = []string{ + "ArcSettings", "ahat-test-dump", "android.car", "android.test.mock", @@ -104,6 +105,7 @@ var legacyCorePlatformApiModules = []string{ "services.usage", "services.usb", "Settings-core", + "SettingsGoogle", "SettingsLib", "SettingsProvider", "SettingsProviderTest", From 5225ca9434283e030ac3332fa44ec676555c2bb6 Mon Sep 17 00:00:00 2001 From: Jeongik Cha Date: Fri, 5 Mar 2021 21:47:22 +0900 Subject: [PATCH 04/13] update apex/allowed_deps.txt Bug: 150578172 Test: m Change-Id: I0ea6b33c2d27081a5f0622edb0f5df4088a71455 Merged-In: I0ea6b33c2d27081a5f0622edb0f5df4088a71455 --- apex/allowed_deps.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apex/allowed_deps.txt b/apex/allowed_deps.txt index d92372896..66d7a5ca8 100644 --- a/apex/allowed_deps.txt +++ b/apex/allowed_deps.txt @@ -168,7 +168,9 @@ derive_sdk(minSdkVersion:30) derive_sdk(minSdkVersion:current) derive_sdk_prefer32(minSdkVersion:30) derive_sdk_prefer32(minSdkVersion:current) +dnsresolver_aidl_interface-lateststable-ndk_platform(minSdkVersion:29) dnsresolver_aidl_interface-unstable-ndk_platform(minSdkVersion:29) +dnsresolver_aidl_interface-V7-ndk_platform(minSdkVersion:29) dnsresolver_aidl_interface-V8-ndk_platform(minSdkVersion:29) DocumentsUI-res-lib(minSdkVersion:29) exoplayer2-extractor(minSdkVersion:16) @@ -505,8 +507,10 @@ netd_aidl_interface-unstable-java(minSdkVersion:29) netd_aidl_interface-V5-java(minSdkVersion:29) netd_aidl_interface-V6-java(minSdkVersion:29) netd_event_listener_interface-java(minSdkVersion:29) +netd_event_listener_interface-lateststable-ndk_platform(minSdkVersion:29) netd_event_listener_interface-ndk_platform(minSdkVersion:29) netd_event_listener_interface-unstable-ndk_platform(minSdkVersion:29) +netd_event_listener_interface-V1-ndk_platform(minSdkVersion:29) netd_event_listener_interface-V2-ndk_platform(minSdkVersion:29) netlink-client(minSdkVersion:29) networkstack-aidl-interfaces-unstable-java(minSdkVersion:29) From 6fb6cffce249d1436bb0acf30ef6c428facfd73c Mon Sep 17 00:00:00 2001 From: Daulet Zhanguzin Date: Thu, 11 Mar 2021 18:23:47 +0000 Subject: [PATCH 05/13] Reinstate the enforcement of stable core platform API usage It appears as though change I3a39be5f0b8736de4822c6a14072c78d4e4ad89d accidentally stopped enforcing the use of the stable core platform API in AOSP when the changes from rvc-dev-plus-aosp-without-vendor were merged in. Unfortunately, since then some additional usages of legacy core platform APIs have crept in so this adds the affected modules to the list of modules allowed to use the legacy core platform APIs. Bug: 180399951 Test: m checkbuild Merged-In: Ieddaf859f568bc8ee486692474a4dec48b3d25e6 Change-Id: Iacbee67fa103279a9823bd26c559821b04849be6 --- java/legacy_core_platform_api_usage.go | 35 +++++++++++++++----------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/java/legacy_core_platform_api_usage.go b/java/legacy_core_platform_api_usage.go index 021920af6..874338d10 100644 --- a/java/legacy_core_platform_api_usage.go +++ b/java/legacy_core_platform_api_usage.go @@ -19,10 +19,6 @@ import ( "android/soong/java/config" ) -// This variable is effectively unused in pre-master branches, and is -// included (with the same value as it has in AOSP) only to ease -// merges between branches (see the comment in the -// useLegacyCorePlatformApi() function): var legacyCorePlatformApiModules = []string{ "ahat-test-dump", "android.car", @@ -34,29 +30,44 @@ var legacyCorePlatformApiModules = []string{ "art_cts_jvmti_test_library", "art-gtest-jars-MyClassNatives", "BackupFrameworksServicesRoboTests", + "backuplib", "BandwidthEnforcementTest", "BlockedNumberProvider", "BluetoothInstrumentationTests", "BluetoothMidiService", + "CarDeveloperOptions", + "CarService", + "CarServiceTest", "car-apps-common", + "car-service-test-lib", + "car-service-test-static-lib", "CertInstaller", "ConnectivityManagerTest", "ContactsProvider", + "CorePerfTests", "core-tests-support", + "CtsAppExitTestCases", "CtsContentTestCases", "CtsIkeTestCases", + "CtsAppExitTestCases", "CtsLibcoreWycheproofBCTestCases", "CtsMediaTestCases", "CtsNetTestCases", "CtsNetTestCasesLatestSdk", "CtsSecurityTestCases", + "CtsSuspendAppsTestCases", "CtsUsageStatsTestCases", + "DeadpoolService", + "DeadpoolServiceBtServices", + "DeviceInfo", + "DiagnosticTools", "DisplayCutoutEmulationEmu01Overlay", "DocumentsUIPerfTests", "DocumentsUITests", "DownloadProvider", "DownloadProviderTests", "DownloadProviderUi", + "ds-car-docs", // for AAOS API documentation only "DynamicSystemInstallationService", "EmergencyInfo-lib", "ethernet-service", @@ -73,6 +84,7 @@ var legacyCorePlatformApiModules = []string{ "FrameworksServicesRoboTests", "FrameworksServicesTests", "FrameworksUtilTests", + "FrameworksWifiTests", "hid", "hidl_test_java_java", "hwbinder", @@ -95,6 +107,9 @@ var legacyCorePlatformApiModules = []string{ "platform_library-docs", "PrintSpooler", "RollbackTest", + "service-blobstore", + "service-connectivity", + "service-jobscheduler", "services", "services.accessibility", "services.backup", @@ -136,10 +151,6 @@ var legacyCorePlatformApiModules = []string{ "wifi-service", } -// This variable is effectively unused in pre-master branches, and is -// included (with the same value as it has in AOSP) only to ease -// merges between branches (see the comment in the -// useLegacyCorePlatformApi() function): var legacyCorePlatformApiLookup = make(map[string]struct{}) func init() { @@ -149,12 +160,8 @@ func init() { } func useLegacyCorePlatformApi(ctx android.EarlyModuleContext) bool { - // In pre-master branches, we don't attempt to force usage of the stable - // version of the core/platform API. Instead, we always use the legacy - // version --- except in tests, where we always use stable, so that we - // can make the test assertions the same as other branches. - // This should be false in tests and true otherwise: - return ctx.Config().TestProductVariables == nil + _, found := legacyCorePlatformApiLookup[ctx.ModuleName()] + return found } func corePlatformSystemModules(ctx android.EarlyModuleContext) string { From b528ed5faed5c29fb94e149c9ac35c82154695e6 Mon Sep 17 00:00:00 2001 From: Daulet Zhanguzin Date: Thu, 11 Mar 2021 18:23:47 +0000 Subject: [PATCH 06/13] Reinstate the enforcement of stable core platform API usage It appears as though change I3a39be5f0b8736de4822c6a14072c78d4e4ad89d accidentally stopped enforcing the use of the stable core platform API in AOSP when the changes from rvc-dev-plus-aosp-without-vendor were merged in. Unfortunately, since then some additional usages of legacy core platform APIs have crept in so this adds the affected modules to the list of modules allowed to use the legacy core platform APIs. Bug: 180399951 Test: m checkbuild Merged-In: Ieddaf859f568bc8ee486692474a4dec48b3d25e6 Change-Id: Iacbee67fa103279a9823bd26c559821b04849be6 (cherry picked from commit 6fb6cffce249d1436bb0acf30ef6c428facfd73c) --- java/legacy_core_platform_api_usage.go | 35 +++++++++++++++----------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/java/legacy_core_platform_api_usage.go b/java/legacy_core_platform_api_usage.go index 568ce183f..0b023e82b 100644 --- a/java/legacy_core_platform_api_usage.go +++ b/java/legacy_core_platform_api_usage.go @@ -19,10 +19,6 @@ import ( "android/soong/java/config" ) -// This variable is effectively unused in pre-master branches, and is -// included (with the same value as it has in AOSP) only to ease -// merges between branches (see the comment in the -// useLegacyCorePlatformApi() function): var legacyCorePlatformApiModules = []string{ "ArcSettings", "ahat-test-dump", @@ -35,29 +31,44 @@ var legacyCorePlatformApiModules = []string{ "art_cts_jvmti_test_library", "art-gtest-jars-MyClassNatives", "BackupFrameworksServicesRoboTests", + "backuplib", "BandwidthEnforcementTest", "BlockedNumberProvider", "BluetoothInstrumentationTests", "BluetoothMidiService", + "CarDeveloperOptions", + "CarService", + "CarServiceTest", "car-apps-common", + "car-service-test-lib", + "car-service-test-static-lib", "CertInstaller", "ConnectivityManagerTest", "ContactsProvider", + "CorePerfTests", "core-tests-support", + "CtsAppExitTestCases", "CtsContentTestCases", "CtsIkeTestCases", + "CtsAppExitTestCases", "CtsLibcoreWycheproofBCTestCases", "CtsMediaTestCases", "CtsNetTestCases", "CtsNetTestCasesLatestSdk", "CtsSecurityTestCases", + "CtsSuspendAppsTestCases", "CtsUsageStatsTestCases", + "DeadpoolService", + "DeadpoolServiceBtServices", + "DeviceInfo", + "DiagnosticTools", "DisplayCutoutEmulationEmu01Overlay", "DocumentsUIPerfTests", "DocumentsUITests", "DownloadProvider", "DownloadProviderTests", "DownloadProviderUi", + "ds-car-docs", // for AAOS API documentation only "DynamicSystemInstallationService", "EmergencyInfo-lib", "ethernet-service", @@ -74,6 +85,7 @@ var legacyCorePlatformApiModules = []string{ "FrameworksServicesRoboTests", "FrameworksServicesTests", "FrameworksUtilTests", + "FrameworksWifiTests", "hid", "hidl_test_java_java", "hwbinder", @@ -96,6 +108,9 @@ var legacyCorePlatformApiModules = []string{ "platform_library-docs", "PrintSpooler", "RollbackTest", + "service-blobstore", + "service-connectivity", + "service-jobscheduler", "services", "services.accessibility", "services.backup", @@ -138,10 +153,6 @@ var legacyCorePlatformApiModules = []string{ "wifi-service", } -// This variable is effectively unused in pre-master branches, and is -// included (with the same value as it has in AOSP) only to ease -// merges between branches (see the comment in the -// useLegacyCorePlatformApi() function): var legacyCorePlatformApiLookup = make(map[string]struct{}) func init() { @@ -151,12 +162,8 @@ func init() { } func useLegacyCorePlatformApi(ctx android.EarlyModuleContext) bool { - // In pre-master branches, we don't attempt to force usage of the stable - // version of the core/platform API. Instead, we always use the legacy - // version --- except in tests, where we always use stable, so that we - // can make the test assertions the same as other branches. - // This should be false in tests and true otherwise: - return ctx.Config().TestProductVariables == nil + _, found := legacyCorePlatformApiLookup[ctx.ModuleName()] + return found } func corePlatformSystemModules(ctx android.EarlyModuleContext) string { From 8c12d89beda5219a12cd53ea1439bf2f5d92dfc6 Mon Sep 17 00:00:00 2001 From: Remi NGUYEN VAN Date: Fri, 12 Mar 2021 10:16:10 +0000 Subject: [PATCH 07/13] Revert "Reinstate the enforcement of stable core platform API usage" This reverts commit b528ed5faed5c29fb94e149c9ac35c82154695e6. Reason for revert: Breaks bramble build, b/182544394 Merged-In: Ieddaf859f568bc8ee486692474a4dec48b3d25e6 Change-Id: Iaf8f80f4b6f70da8d6e45a2619953534f87ea03b --- java/legacy_core_platform_api_usage.go | 35 +++++++++++--------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/java/legacy_core_platform_api_usage.go b/java/legacy_core_platform_api_usage.go index 0b023e82b..568ce183f 100644 --- a/java/legacy_core_platform_api_usage.go +++ b/java/legacy_core_platform_api_usage.go @@ -19,6 +19,10 @@ import ( "android/soong/java/config" ) +// This variable is effectively unused in pre-master branches, and is +// included (with the same value as it has in AOSP) only to ease +// merges between branches (see the comment in the +// useLegacyCorePlatformApi() function): var legacyCorePlatformApiModules = []string{ "ArcSettings", "ahat-test-dump", @@ -31,44 +35,29 @@ var legacyCorePlatformApiModules = []string{ "art_cts_jvmti_test_library", "art-gtest-jars-MyClassNatives", "BackupFrameworksServicesRoboTests", - "backuplib", "BandwidthEnforcementTest", "BlockedNumberProvider", "BluetoothInstrumentationTests", "BluetoothMidiService", - "CarDeveloperOptions", - "CarService", - "CarServiceTest", "car-apps-common", - "car-service-test-lib", - "car-service-test-static-lib", "CertInstaller", "ConnectivityManagerTest", "ContactsProvider", - "CorePerfTests", "core-tests-support", - "CtsAppExitTestCases", "CtsContentTestCases", "CtsIkeTestCases", - "CtsAppExitTestCases", "CtsLibcoreWycheproofBCTestCases", "CtsMediaTestCases", "CtsNetTestCases", "CtsNetTestCasesLatestSdk", "CtsSecurityTestCases", - "CtsSuspendAppsTestCases", "CtsUsageStatsTestCases", - "DeadpoolService", - "DeadpoolServiceBtServices", - "DeviceInfo", - "DiagnosticTools", "DisplayCutoutEmulationEmu01Overlay", "DocumentsUIPerfTests", "DocumentsUITests", "DownloadProvider", "DownloadProviderTests", "DownloadProviderUi", - "ds-car-docs", // for AAOS API documentation only "DynamicSystemInstallationService", "EmergencyInfo-lib", "ethernet-service", @@ -85,7 +74,6 @@ var legacyCorePlatformApiModules = []string{ "FrameworksServicesRoboTests", "FrameworksServicesTests", "FrameworksUtilTests", - "FrameworksWifiTests", "hid", "hidl_test_java_java", "hwbinder", @@ -108,9 +96,6 @@ var legacyCorePlatformApiModules = []string{ "platform_library-docs", "PrintSpooler", "RollbackTest", - "service-blobstore", - "service-connectivity", - "service-jobscheduler", "services", "services.accessibility", "services.backup", @@ -153,6 +138,10 @@ var legacyCorePlatformApiModules = []string{ "wifi-service", } +// This variable is effectively unused in pre-master branches, and is +// included (with the same value as it has in AOSP) only to ease +// merges between branches (see the comment in the +// useLegacyCorePlatformApi() function): var legacyCorePlatformApiLookup = make(map[string]struct{}) func init() { @@ -162,8 +151,12 @@ func init() { } func useLegacyCorePlatformApi(ctx android.EarlyModuleContext) bool { - _, found := legacyCorePlatformApiLookup[ctx.ModuleName()] - return found + // In pre-master branches, we don't attempt to force usage of the stable + // version of the core/platform API. Instead, we always use the legacy + // version --- except in tests, where we always use stable, so that we + // can make the test assertions the same as other branches. + // This should be false in tests and true otherwise: + return ctx.Config().TestProductVariables == nil } func corePlatformSystemModules(ctx android.EarlyModuleContext) string { From db378c551128792307a4aae611d26fda4fe53110 Mon Sep 17 00:00:00 2001 From: Remi NGUYEN VAN Date: Fri, 12 Mar 2021 10:38:52 +0000 Subject: [PATCH 08/13] Add secureprocessor to the legacy core platform API list The build target uses non-stable APIs such as dalvik.system.CloseGuard. Merged-In: Ieddaf859f568bc8ee486692474a4dec48b3d25e6 Change-Id: I7643e6c7febd44509ac819134de91bca88e2d257 --- java/legacy_core_platform_api_usage.go | 1 + 1 file changed, 1 insertion(+) diff --git a/java/legacy_core_platform_api_usage.go b/java/legacy_core_platform_api_usage.go index 0b023e82b..2360b1d60 100644 --- a/java/legacy_core_platform_api_usage.go +++ b/java/legacy_core_platform_api_usage.go @@ -43,6 +43,7 @@ var legacyCorePlatformApiModules = []string{ "car-service-test-lib", "car-service-test-static-lib", "CertInstaller", + "com.qti.media.secureprocessor", "ConnectivityManagerTest", "ContactsProvider", "CorePerfTests", From c3c69e11bd037e5546c525b2c168be77ae07a6e2 Mon Sep 17 00:00:00 2001 From: Remi NGUYEN VAN Date: Fri, 12 Mar 2021 12:04:18 +0000 Subject: [PATCH 09/13] Revert "Revert "Reinstate the enforcement of stable core platform API usage"" It appears as though change I3a39be5f0b8736de4822c6a14072c78d4e4ad89d accidentally stopped enforcing the use of the stable core platform API in AOSP when the changes from rvc-dev-plus-aosp-without-vendor were merged in. Unfortunately, since then some additional usages of legacy core platform APIs have crept in so this adds the affected modules to the list of modules allowed to use the legacy core platform APIs. Bug: 180399951 Change-Id: Ibf7b6e895cc1c66b0fec12ca9ee2f6cb6849a93c Test: m checkbuild Merged-In: Ieddaf859f568bc8ee486692474a4dec48b3d25e6 --- java/legacy_core_platform_api_usage.go | 35 +++++++++++++++----------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/java/legacy_core_platform_api_usage.go b/java/legacy_core_platform_api_usage.go index 568ce183f..0b023e82b 100644 --- a/java/legacy_core_platform_api_usage.go +++ b/java/legacy_core_platform_api_usage.go @@ -19,10 +19,6 @@ import ( "android/soong/java/config" ) -// This variable is effectively unused in pre-master branches, and is -// included (with the same value as it has in AOSP) only to ease -// merges between branches (see the comment in the -// useLegacyCorePlatformApi() function): var legacyCorePlatformApiModules = []string{ "ArcSettings", "ahat-test-dump", @@ -35,29 +31,44 @@ var legacyCorePlatformApiModules = []string{ "art_cts_jvmti_test_library", "art-gtest-jars-MyClassNatives", "BackupFrameworksServicesRoboTests", + "backuplib", "BandwidthEnforcementTest", "BlockedNumberProvider", "BluetoothInstrumentationTests", "BluetoothMidiService", + "CarDeveloperOptions", + "CarService", + "CarServiceTest", "car-apps-common", + "car-service-test-lib", + "car-service-test-static-lib", "CertInstaller", "ConnectivityManagerTest", "ContactsProvider", + "CorePerfTests", "core-tests-support", + "CtsAppExitTestCases", "CtsContentTestCases", "CtsIkeTestCases", + "CtsAppExitTestCases", "CtsLibcoreWycheproofBCTestCases", "CtsMediaTestCases", "CtsNetTestCases", "CtsNetTestCasesLatestSdk", "CtsSecurityTestCases", + "CtsSuspendAppsTestCases", "CtsUsageStatsTestCases", + "DeadpoolService", + "DeadpoolServiceBtServices", + "DeviceInfo", + "DiagnosticTools", "DisplayCutoutEmulationEmu01Overlay", "DocumentsUIPerfTests", "DocumentsUITests", "DownloadProvider", "DownloadProviderTests", "DownloadProviderUi", + "ds-car-docs", // for AAOS API documentation only "DynamicSystemInstallationService", "EmergencyInfo-lib", "ethernet-service", @@ -74,6 +85,7 @@ var legacyCorePlatformApiModules = []string{ "FrameworksServicesRoboTests", "FrameworksServicesTests", "FrameworksUtilTests", + "FrameworksWifiTests", "hid", "hidl_test_java_java", "hwbinder", @@ -96,6 +108,9 @@ var legacyCorePlatformApiModules = []string{ "platform_library-docs", "PrintSpooler", "RollbackTest", + "service-blobstore", + "service-connectivity", + "service-jobscheduler", "services", "services.accessibility", "services.backup", @@ -138,10 +153,6 @@ var legacyCorePlatformApiModules = []string{ "wifi-service", } -// This variable is effectively unused in pre-master branches, and is -// included (with the same value as it has in AOSP) only to ease -// merges between branches (see the comment in the -// useLegacyCorePlatformApi() function): var legacyCorePlatformApiLookup = make(map[string]struct{}) func init() { @@ -151,12 +162,8 @@ func init() { } func useLegacyCorePlatformApi(ctx android.EarlyModuleContext) bool { - // In pre-master branches, we don't attempt to force usage of the stable - // version of the core/platform API. Instead, we always use the legacy - // version --- except in tests, where we always use stable, so that we - // can make the test assertions the same as other branches. - // This should be false in tests and true otherwise: - return ctx.Config().TestProductVariables == nil + _, found := legacyCorePlatformApiLookup[ctx.ModuleName()] + return found } func corePlatformSystemModules(ctx android.EarlyModuleContext) string { From dc5be9099b6deac2074721310ba48192ae6a9b1d Mon Sep 17 00:00:00 2001 From: Bob Badour Date: Mon, 15 Mar 2021 20:00:01 -0700 Subject: [PATCH 10/13] Minimal license feature. Keeps license declarations from breaking the build without implementing the full feature. Test: m all Bug: 181768532 Change-Id: Ic78672cd25da13aa9078a48b06446f66780c792d Merged-in: If3fbc157c6ffed8e3ee4bdd9aa56fabe2c24444b Merged-in: Ie7e1695ecb8cd943124426a0cad2c0d1db2b46ed --- android/Android.bp | 2 + android/license.go | 70 ++++++++++++++++++++ android/license_test.go | 142 ++++++++++++++++++++++++++++++++++++++++ android/module.go | 3 + android/package.go | 2 + android/package_test.go | 1 + 6 files changed, 220 insertions(+) create mode 100644 android/license.go create mode 100644 android/license_test.go diff --git a/android/Android.bp b/android/Android.bp index 9712c46e3..bd72b7b14 100644 --- a/android/Android.bp +++ b/android/Android.bp @@ -23,6 +23,7 @@ bootstrap_go_package { "filegroup.go", "hooks.go", "image.go", + "license.go", "makevars.go", "module.go", "mutator.go", @@ -62,6 +63,7 @@ bootstrap_go_package { "csuite_config_test.go", "depset_test.go", "expand_test.go", + "license_test.go", "module_test.go", "mutator_test.go", "namespace_test.go", diff --git a/android/license.go b/android/license.go new file mode 100644 index 000000000..00ddacd41 --- /dev/null +++ b/android/license.go @@ -0,0 +1,70 @@ +// Copyright 2020 Google Inc. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package android + +func init() { + RegisterLicenseBuildComponents(InitRegistrationContext) +} + +// Register the license module type. +func RegisterLicenseBuildComponents(ctx RegistrationContext) { + ctx.RegisterModuleType("license", LicenseFactory) +} + +type licenseProperties struct { + // Specifies the kinds of license that apply. + License_kinds []string + // Specifies a short copyright notice to use for the license. + Copyright_notice *string + // Specifies the path or label for the text of the license. + License_text []string `android:"path"` + // Specifies the package name to which the license applies. + Package_name *string + // Specifies where this license can be used + Visibility []string +} + +type licenseModule struct { + ModuleBase + DefaultableModuleBase + + properties licenseProperties +} + +func (m *licenseModule) DepsMutator(ctx BottomUpMutatorContext) { + // Do nothing. +} + +func (m *licenseModule) GenerateAndroidBuildActions(ctx ModuleContext) { + // Nothing to do. +} + +func LicenseFactory() Module { + module := &licenseModule{} + + base := module.base() + module.AddProperties(&base.nameProperties, &module.properties) + + base.generalProperties = module.GetProperties() + base.customizableProperties = module.GetProperties() + + // The visibility property needs to be checked and parsed by the visibility module. + setPrimaryVisibilityProperty(module, "visibility", &module.properties.Visibility) + + initAndroidModuleBase(module) + InitDefaultableModule(module) + + return module +} diff --git a/android/license_test.go b/android/license_test.go new file mode 100644 index 000000000..e80ba5e94 --- /dev/null +++ b/android/license_test.go @@ -0,0 +1,142 @@ +package android + +import ( + "testing" +) + +var licenseTests = []struct { + name string + fs map[string][]byte + expectedErrors []string +}{ + { + name: "license must not accept licenses property", + fs: map[string][]byte{ + "top/Blueprints": []byte(` + license { + name: "top_license", + visibility: ["//visibility:private"], + licenses: ["other_license"], + + }`), + }, + expectedErrors: []string{ + `top/Blueprints:5:14: unrecognized property "licenses"`, + }, + }, + { + name: "public license", + fs: map[string][]byte{ + "top/Blueprints": []byte(` + license { + name: "top_proprietary", + license_kinds: ["top_by_exception_only"], + visibility: ["//visibility:public"], + }`), + "other/Blueprints": []byte(` + rule { + name: "arule", + licenses: ["top_proprietary"], + + }`), + "yetmore/Blueprints": []byte(` + package { + default_applicable_licenses: ["top_proprietary"], + }`), + }, + }, + { + name: "multiple licenses", + fs: map[string][]byte{ + "top/Blueprints": []byte(` + package { + default_applicable_licenses: ["top_proprietary"], + } + license { + name: "top_allowed_as_notice", + license_kinds: ["top_notice"], + } + license { + name: "top_proprietary", + license_kinds: ["top_by_exception_only"], + visibility: ["//visibility:public"], + } + rule { + name: "myrule", + licenses: ["top_allowed_as_notice", "top_proprietary"] + }`), + "other/Blueprints": []byte(` + rule { + name: "arule", + licenses: ["top_proprietary"], + + }`), + "yetmore/Blueprints": []byte(` + package { + default_applicable_licenses: ["top_proprietary"], + }`), + }, + }, +} + +func TestLicense(t *testing.T) { + for _, test := range licenseTests { + t.Run(test.name, func(t *testing.T) { + _, errs := testLicense(test.fs) + expectedErrors := test.expectedErrors + if expectedErrors == nil { + FailIfErrored(t, errs) + } else { + for _, expectedError := range expectedErrors { + FailIfNoMatchingErrors(t, expectedError, errs) + } + if len(errs) > len(expectedErrors) { + t.Errorf("additional errors found, expected %d, found %d", len(expectedErrors), len(errs)) + for i, expectedError := range expectedErrors { + t.Errorf("expectedErrors[%d] = %s", i, expectedError) + } + for i, err := range errs { + t.Errorf("errs[%d] = %s", i, err) + } + } + } + }) + } +} +func testLicense(fs map[string][]byte) (*TestContext, []error) { + // Create a new config per test as visibility information is stored in the config. + env := make(map[string]string) + env["ANDROID_REQUIRE_LICENSES"] = "1" + config := TestArchConfig(buildDir, env, "", fs) + ctx := NewTestArchContext() + RegisterPackageBuildComponents(ctx) + registerTestPrebuiltBuildComponents(ctx) + RegisterLicenseBuildComponents(ctx) + ctx.RegisterModuleType("rule", newMockRuleModule) + ctx.PreArchMutators(RegisterVisibilityRuleChecker) + ctx.PreArchMutators(RegisterDefaultsPreArchMutators) + ctx.PreArchMutators(RegisterVisibilityRuleGatherer) + ctx.PostDepsMutators(RegisterVisibilityRuleEnforcer) + ctx.Register(config) + _, errs := ctx.ParseBlueprintsFiles(".") + if len(errs) > 0 { + return ctx, errs + } + _, errs = ctx.PrepareBuildActions(config) + return ctx, errs +} + +type mockRuleModule struct { + ModuleBase + DefaultableModuleBase +} + +func newMockRuleModule() Module { + m := &mockRuleModule{} + InitAndroidModule(m) + InitDefaultableModule(m) + return m +} + +func (p *mockRuleModule) GenerateAndroidBuildActions(ModuleContext) { +} diff --git a/android/module.go b/android/module.go index cd4baabb5..a498839ce 100644 --- a/android/module.go +++ b/android/module.go @@ -360,6 +360,9 @@ type commonProperties struct { // more details. Visibility []string + // Names of the licenses that apply to this module. + Licenses []string + // control whether this module compiles for 32-bit, 64-bit, or both. Possible values // are "32" (compile for 32-bit only), "64" (compile for 64-bit only), "both" (compile for both // architectures), or "first" (compile for 64-bit on a 64-bit platform, and 32-bit on a 32-bit diff --git a/android/package.go b/android/package.go index 182b3ed6e..053fec286 100644 --- a/android/package.go +++ b/android/package.go @@ -31,6 +31,8 @@ func RegisterPackageBuildComponents(ctx RegistrationContext) { type packageProperties struct { // Specifies the default visibility for all modules defined in this package. Default_visibility []string + // Specifies the names of the default licenses for all modules defined in this package. + Default_applicable_licenses []string } type packageModule struct { diff --git a/android/package_test.go b/android/package_test.go index 04dfc08a9..f25599cf8 100644 --- a/android/package_test.go +++ b/android/package_test.go @@ -44,6 +44,7 @@ var packageTests = []struct { "top/Blueprints": []byte(` package { default_visibility: ["//visibility:private"], + default_applicable_licenses: ["license"], } package { From f67c06a7f5b0fa721cc1b762aa8e856d7da80a58 Mon Sep 17 00:00:00 2001 From: Artur Satayev Date: Thu, 11 Mar 2021 16:45:04 +0000 Subject: [PATCH 11/13] Move allowed_deps.txt to packages/modules/common. Bug: 179234385 Test: run update-apex-allowed-deps.sh locally Change-Id: I8e8864468b87342c688d001bc5f6e6f8416863ed Merged-In: I8e8864468b87342c688d001bc5f6e6f8416863ed --- apex/OWNERS | 3 - apex/allowed_deps.txt | 653 ---------------------------- apex/apex_singleton.go | 6 +- scripts/update-apex-allowed-deps.sh | 39 -- 4 files changed, 3 insertions(+), 698 deletions(-) delete mode 100644 apex/allowed_deps.txt delete mode 100755 scripts/update-apex-allowed-deps.sh diff --git a/apex/OWNERS b/apex/OWNERS index fee739b56..8e4ba5cd5 100644 --- a/apex/OWNERS +++ b/apex/OWNERS @@ -1,4 +1 @@ per-file * = jiyong@google.com - -per-file allowed_deps.txt = set noparent -per-file allowed_deps.txt = dariofreni@google.com,hansson@google.com,harpin@google.com,jiyong@google.com,narayan@google.com,jham@google.com diff --git a/apex/allowed_deps.txt b/apex/allowed_deps.txt deleted file mode 100644 index ad069e096..000000000 --- a/apex/allowed_deps.txt +++ /dev/null @@ -1,653 +0,0 @@ -# A list of allowed dependencies for all updatable modules. -# -# The list tracks all direct and transitive dependencies that end up within any -# of the updatable binaries; specifically excluding external dependencies -# required to compile those binaries. This prevents potential regressions in -# case a new dependency is not aware of the different functional and -# non-functional requirements being part of an updatable module, for example -# setting correct min_sdk_version. -# -# To update the list, run: -# repo-root$ build/soong/scripts/update-apex-allowed-deps.sh -# -# See go/apex-allowed-deps-error for more details. -# TODO(b/157465465): introduce automated quality signals and remove this list. - -adbd(minSdkVersion:(no version)) -android.hardware.cas.native@1.0(minSdkVersion:29) -android.hardware.cas@1.0(minSdkVersion:29) -android.hardware.common-ndk_platform(minSdkVersion:29) -android.hardware.common-unstable-ndk_platform(minSdkVersion:29) -android.hardware.common-V2-ndk_platform(minSdkVersion:29) -android.hardware.graphics.allocator@2.0(minSdkVersion:29) -android.hardware.graphics.allocator@3.0(minSdkVersion:29) -android.hardware.graphics.allocator@4.0(minSdkVersion:29) -android.hardware.graphics.bufferqueue@1.0(minSdkVersion:29) -android.hardware.graphics.bufferqueue@2.0(minSdkVersion:29) -android.hardware.graphics.common-ndk_platform(minSdkVersion:29) -android.hardware.graphics.common-unstable-ndk_platform(minSdkVersion:29) -android.hardware.graphics.common-V2-ndk_platform(minSdkVersion:29) -android.hardware.graphics.common@1.0(minSdkVersion:29) -android.hardware.graphics.common@1.1(minSdkVersion:29) -android.hardware.graphics.common@1.2(minSdkVersion:29) -android.hardware.graphics.mapper@2.0(minSdkVersion:29) -android.hardware.graphics.mapper@2.1(minSdkVersion:29) -android.hardware.graphics.mapper@3.0(minSdkVersion:29) -android.hardware.graphics.mapper@4.0(minSdkVersion:29) -android.hardware.media.bufferpool@2.0(minSdkVersion:29) -android.hardware.media.c2@1.0(minSdkVersion:29) -android.hardware.media.c2@1.1(minSdkVersion:29) -android.hardware.media.omx@1.0(minSdkVersion:29) -android.hardware.media@1.0(minSdkVersion:29) -android.hardware.neuralnetworks-V1-ndk_platform(minSdkVersion:30) -android.hardware.neuralnetworks@1.0(minSdkVersion:30) -android.hardware.neuralnetworks@1.1(minSdkVersion:30) -android.hardware.neuralnetworks@1.2(minSdkVersion:30) -android.hardware.neuralnetworks@1.3(minSdkVersion:30) -android.hardware.tetheroffload.config-V1.0-java(minSdkVersion:current) -android.hardware.tetheroffload.control-V1.0-java(minSdkVersion:current) -android.hidl.allocator@1.0(minSdkVersion:29) -android.hidl.base-V1.0-java(minSdkVersion:current) -android.hidl.memory.token@1.0(minSdkVersion:29) -android.hidl.memory@1.0(minSdkVersion:29) -android.hidl.safe_union@1.0(minSdkVersion:29) -android.hidl.token@1.0(minSdkVersion:29) -android.hidl.token@1.0-utils(minSdkVersion:29) -android.net.ipsec.ike(minSdkVersion:30) -android.net.ipsec.ike(minSdkVersion:current) -android.net.ipsec.ike.xml(minSdkVersion:(no version)) -androidx-constraintlayout_constraintlayout(minSdkVersion:14) -androidx-constraintlayout_constraintlayout-solver(minSdkVersion:24) -androidx.activity_activity(minSdkVersion:14) -androidx.activity_activity-ktx(minSdkVersion:14) -androidx.annotation_annotation(minSdkVersion:24) -androidx.annotation_annotation(minSdkVersion:current) -androidx.appcompat_appcompat(minSdkVersion:14) -androidx.appcompat_appcompat-resources(minSdkVersion:14) -androidx.arch.core_core-common(minSdkVersion:24) -androidx.arch.core_core-common(minSdkVersion:current) -androidx.arch.core_core-runtime(minSdkVersion:14) -androidx.asynclayoutinflater_asynclayoutinflater(minSdkVersion:14) -androidx.autofill_autofill(minSdkVersion:14) -androidx.cardview_cardview(minSdkVersion:14) -androidx.collection_collection(minSdkVersion:24) -androidx.collection_collection(minSdkVersion:current) -androidx.collection_collection-ktx(minSdkVersion:24) -androidx.coordinatorlayout_coordinatorlayout(minSdkVersion:14) -androidx.core_core(minSdkVersion:14) -androidx.core_core-ktx(minSdkVersion:14) -androidx.cursoradapter_cursoradapter(minSdkVersion:14) -androidx.customview_customview(minSdkVersion:14) -androidx.documentfile_documentfile(minSdkVersion:14) -androidx.drawerlayout_drawerlayout(minSdkVersion:14) -androidx.dynamicanimation_dynamicanimation(minSdkVersion:14) -androidx.fragment_fragment(minSdkVersion:14) -androidx.fragment_fragment-ktx(minSdkVersion:14) -androidx.interpolator_interpolator(minSdkVersion:14) -androidx.leanback_leanback(minSdkVersion:17) -androidx.leanback_leanback-preference(minSdkVersion:21) -androidx.legacy_legacy-preference-v14(minSdkVersion:14) -androidx.legacy_legacy-support-core-ui(minSdkVersion:14) -androidx.legacy_legacy-support-core-utils(minSdkVersion:14) -androidx.legacy_legacy-support-v13(minSdkVersion:14) -androidx.legacy_legacy-support-v4(minSdkVersion:14) -androidx.lifecycle_lifecycle-common(minSdkVersion:24) -androidx.lifecycle_lifecycle-common(minSdkVersion:current) -androidx.lifecycle_lifecycle-common-java8(minSdkVersion:24) -androidx.lifecycle_lifecycle-extensions(minSdkVersion:14) -androidx.lifecycle_lifecycle-livedata(minSdkVersion:14) -androidx.lifecycle_lifecycle-livedata-core(minSdkVersion:14) -androidx.lifecycle_lifecycle-livedata-core-ktx(minSdkVersion:14) -androidx.lifecycle_lifecycle-process(minSdkVersion:14) -androidx.lifecycle_lifecycle-runtime(minSdkVersion:14) -androidx.lifecycle_lifecycle-runtime-ktx(minSdkVersion:14) -androidx.lifecycle_lifecycle-service(minSdkVersion:14) -androidx.lifecycle_lifecycle-viewmodel(minSdkVersion:14) -androidx.lifecycle_lifecycle-viewmodel-ktx(minSdkVersion:14) -androidx.lifecycle_lifecycle-viewmodel-savedstate(minSdkVersion:14) -androidx.loader_loader(minSdkVersion:14) -androidx.localbroadcastmanager_localbroadcastmanager(minSdkVersion:14) -androidx.media_media(minSdkVersion:14) -androidx.navigation_navigation-common(minSdkVersion:14) -androidx.navigation_navigation-common-ktx(minSdkVersion:14) -androidx.navigation_navigation-fragment(minSdkVersion:14) -androidx.navigation_navigation-fragment-ktx(minSdkVersion:14) -androidx.navigation_navigation-runtime(minSdkVersion:14) -androidx.navigation_navigation-runtime-ktx(minSdkVersion:14) -androidx.navigation_navigation-ui(minSdkVersion:14) -androidx.navigation_navigation-ui-ktx(minSdkVersion:14) -androidx.preference_preference(minSdkVersion:14) -androidx.print_print(minSdkVersion:14) -androidx.recyclerview_recyclerview(minSdkVersion:14) -androidx.recyclerview_recyclerview-selection(minSdkVersion:14) -androidx.savedstate_savedstate(minSdkVersion:14) -androidx.slidingpanelayout_slidingpanelayout(minSdkVersion:14) -androidx.swiperefreshlayout_swiperefreshlayout(minSdkVersion:14) -androidx.transition_transition(minSdkVersion:14) -androidx.vectordrawable_vectordrawable(minSdkVersion:14) -androidx.vectordrawable_vectordrawable-animated(minSdkVersion:14) -androidx.versionedparcelable_versionedparcelable(minSdkVersion:14) -androidx.viewpager_viewpager(minSdkVersion:14) -apache-commons-compress(minSdkVersion:current) -art.module.public.api.stubs(minSdkVersion:(no version)) -bcm_object(minSdkVersion:29) -bionic_libc_platform_headers(minSdkVersion:29) -boringssl_self_test(minSdkVersion:29) -bouncycastle_ike_digests(minSdkVersion:current) -bpf_syscall_wrappers(minSdkVersion:30) -brotli-java(minSdkVersion:current) -captiveportal-lib(minSdkVersion:29) -car-ui-lib(minSdkVersion:28) -car-ui-lib-overlayable(minSdkVersion:28) -CellBroadcastApp(minSdkVersion:29) -CellBroadcastServiceModule(minSdkVersion:29) -codecs_g711dec(minSdkVersion:29) -com.google.android.material_material(minSdkVersion:14) -conscrypt(minSdkVersion:29) -conscrypt.module.platform.api.stubs(minSdkVersion:(no version)) -conscrypt.module.public.api.stubs(minSdkVersion:(no version)) -core-lambda-stubs(minSdkVersion:(no version)) -core.current.stubs(minSdkVersion:(no version)) -crtbegin_dynamic(minSdkVersion:16) -crtbegin_dynamic(minSdkVersion:apex_inherit) -crtbegin_dynamic1(minSdkVersion:16) -crtbegin_dynamic1(minSdkVersion:apex_inherit) -crtbegin_so(minSdkVersion:16) -crtbegin_so(minSdkVersion:apex_inherit) -crtbegin_so1(minSdkVersion:16) -crtbegin_so1(minSdkVersion:apex_inherit) -crtbrand(minSdkVersion:16) -crtbrand(minSdkVersion:apex_inherit) -crtend_android(minSdkVersion:16) -crtend_android(minSdkVersion:apex_inherit) -crtend_so(minSdkVersion:16) -crtend_so(minSdkVersion:apex_inherit) -datastallprotosnano(minSdkVersion:29) -derive_classpath(minSdkVersion:30) -derive_sdk(minSdkVersion:30) -derive_sdk(minSdkVersion:current) -derive_sdk_prefer32(minSdkVersion:30) -derive_sdk_prefer32(minSdkVersion:current) -dnsresolver_aidl_interface-lateststable-ndk_platform(minSdkVersion:29) -dnsresolver_aidl_interface-unstable-ndk_platform(minSdkVersion:29) -dnsresolver_aidl_interface-V7-ndk_platform(minSdkVersion:29) -dnsresolver_aidl_interface-V8-ndk_platform(minSdkVersion:29) -DocumentsUI-res-lib(minSdkVersion:29) -exoplayer2-extractor(minSdkVersion:16) -exoplayer2-extractor-annotation-stubs(minSdkVersion:16) -ExtServices(minSdkVersion:current) -ExtServices-core(minSdkVersion:current) -flatbuffer_headers(minSdkVersion:(no version)) -fmtlib(minSdkVersion:29) -fmtlib_ndk(minSdkVersion:29) -framework-mediaprovider(minSdkVersion:30) -framework-permission(minSdkVersion:30) -framework-permission(minSdkVersion:current) -framework-permission-s(minSdkVersion:30) -framework-permission-s-shared(minSdkVersion:30) -framework-sdkextensions(minSdkVersion:30) -framework-sdkextensions(minSdkVersion:current) -framework-statsd(minSdkVersion:30) -framework-statsd(minSdkVersion:current) -framework-tethering(minSdkVersion:30) -framework-tethering(minSdkVersion:current) -gemmlowp_headers(minSdkVersion:(no version)) -GoogleCellBroadcastApp(minSdkVersion:29) -GoogleCellBroadcastServiceModule(minSdkVersion:29) -GoogleExtServices(minSdkVersion:current) -GooglePermissionController(minSdkVersion:30) -guava(minSdkVersion:current) -gwp_asan_headers(minSdkVersion:(no version)) -i18n.module.public.api.stubs(minSdkVersion:(no version)) -iconloader(minSdkVersion:21) -ike-internals(minSdkVersion:current) -InProcessTethering(minSdkVersion:30) -InProcessTethering(minSdkVersion:current) -ipmemorystore-aidl-interfaces-java(minSdkVersion:29) -ipmemorystore-aidl-interfaces-unstable-java(minSdkVersion:29) -ipmemorystore-aidl-interfaces-V10-java(minSdkVersion:29) -ipmemorystore-aidl-interfaces-V11-java(minSdkVersion:29) -jni_headers(minSdkVersion:29) -jsr305(minSdkVersion:14) -kotlinx-coroutines-android(minSdkVersion:current) -kotlinx-coroutines-core(minSdkVersion:current) -legacy.art.module.platform.api.stubs(minSdkVersion:(no version)) -legacy.core.platform.api.stubs(minSdkVersion:(no version)) -legacy.i18n.module.platform.api.stubs(minSdkVersion:(no version)) -libaacextractor(minSdkVersion:29) -libadb_crypto(minSdkVersion:(no version)) -libadb_pairing_auth(minSdkVersion:(no version)) -libadb_pairing_connection(minSdkVersion:(no version)) -libadb_pairing_server(minSdkVersion:(no version)) -libadb_protos(minSdkVersion:(no version)) -libadb_sysdeps(minSdkVersion:apex_inherit) -libadb_tls_connection(minSdkVersion:(no version)) -libadbconnection_client(minSdkVersion:(no version)) -libadbconnection_server(minSdkVersion:(no version)) -libadbd(minSdkVersion:(no version)) -libadbd_core(minSdkVersion:(no version)) -libadbd_services(minSdkVersion:(no version)) -liballoc.rust_sysroot(minSdkVersion:29) -libamrextractor(minSdkVersion:29) -libapp_processes_protos_lite(minSdkVersion:(no version)) -libarect(minSdkVersion:29) -libasyncio(minSdkVersion:(no version)) -libatomic(minSdkVersion:(no version)) -libaudio_system_headers(minSdkVersion:29) -libaudioclient_headers(minSdkVersion:29) -libaudiofoundation_headers(minSdkVersion:29) -libaudioutils(minSdkVersion:29) -libaudioutils_fixedfft(minSdkVersion:29) -libavcdec(minSdkVersion:29) -libavcenc(minSdkVersion:29) -libavservices_minijail(minSdkVersion:29) -libbacktrace_headers(minSdkVersion:apex_inherit) -libbacktrace_rs.rust_sysroot(minSdkVersion:29) -libbacktrace_sys.rust_sysroot(minSdkVersion:29) -libbase(minSdkVersion:29) -libbase_headers(minSdkVersion:29) -libbase_ndk(minSdkVersion:29) -libbinder_headers(minSdkVersion:29) -libbinder_headers_platform_shared(minSdkVersion:29) -libbinderthreadstateutils(minSdkVersion:29) -libbluetooth-types-header(minSdkVersion:29) -libbrotli(minSdkVersion:(no version)) -libbuildversion(minSdkVersion:(no version)) -libc(minSdkVersion:(no version)) -libc++(minSdkVersion:apex_inherit) -libc++_static(minSdkVersion:apex_inherit) -libc++abi(minSdkVersion:apex_inherit) -libc++demangle(minSdkVersion:apex_inherit) -libc_headers(minSdkVersion:apex_inherit) -libc_headers_arch(minSdkVersion:apex_inherit) -libcap(minSdkVersion:29) -libcfg_if(minSdkVersion:29) -libcfg_if.rust_sysroot(minSdkVersion:29) -libclang_rt.hwasan-aarch64-android.llndk(minSdkVersion:(no version)) -libcodec2(minSdkVersion:29) -libcodec2_headers(minSdkVersion:29) -libcodec2_hidl@1.0(minSdkVersion:29) -libcodec2_hidl@1.1(minSdkVersion:29) -libcodec2_internal(minSdkVersion:29) -libcodec2_soft_aacdec(minSdkVersion:29) -libcodec2_soft_aacenc(minSdkVersion:29) -libcodec2_soft_amrnbdec(minSdkVersion:29) -libcodec2_soft_amrnbenc(minSdkVersion:29) -libcodec2_soft_amrwbdec(minSdkVersion:29) -libcodec2_soft_amrwbenc(minSdkVersion:29) -libcodec2_soft_av1dec_gav1(minSdkVersion:29) -libcodec2_soft_avcdec(minSdkVersion:29) -libcodec2_soft_avcenc(minSdkVersion:29) -libcodec2_soft_common(minSdkVersion:29) -libcodec2_soft_flacdec(minSdkVersion:29) -libcodec2_soft_flacenc(minSdkVersion:29) -libcodec2_soft_g711alawdec(minSdkVersion:29) -libcodec2_soft_g711mlawdec(minSdkVersion:29) -libcodec2_soft_gsmdec(minSdkVersion:29) -libcodec2_soft_h263dec(minSdkVersion:29) -libcodec2_soft_h263enc(minSdkVersion:29) -libcodec2_soft_hevcdec(minSdkVersion:29) -libcodec2_soft_hevcenc(minSdkVersion:29) -libcodec2_soft_mp3dec(minSdkVersion:29) -libcodec2_soft_mpeg2dec(minSdkVersion:29) -libcodec2_soft_mpeg4dec(minSdkVersion:29) -libcodec2_soft_mpeg4enc(minSdkVersion:29) -libcodec2_soft_opusdec(minSdkVersion:29) -libcodec2_soft_opusenc(minSdkVersion:29) -libcodec2_soft_rawdec(minSdkVersion:29) -libcodec2_soft_vorbisdec(minSdkVersion:29) -libcodec2_soft_vp8dec(minSdkVersion:29) -libcodec2_soft_vp8enc(minSdkVersion:29) -libcodec2_soft_vp9dec(minSdkVersion:29) -libcodec2_soft_vp9enc(minSdkVersion:29) -libcodec2_vndk(minSdkVersion:29) -libcompiler_builtins.rust_sysroot(minSdkVersion:29) -libcore.rust_sysroot(minSdkVersion:29) -libcrypto(minSdkVersion:29) -libcrypto_static(minSdkVersion:(no version)) -libcrypto_utils(minSdkVersion:(no version)) -libcutils(minSdkVersion:29) -libcutils_headers(minSdkVersion:29) -libcutils_sockets(minSdkVersion:29) -libderive_classpath(minSdkVersion:30) -libderive_sdk(minSdkVersion:30) -libdiagnose_usb(minSdkVersion:(no version)) -libdl(minSdkVersion:(no version)) -libdmabufheap(minSdkVersion:29) -libeigen(minSdkVersion:(no version)) -libfifo(minSdkVersion:29) -libFLAC(minSdkVersion:29) -libFLAC-config(minSdkVersion:29) -libFLAC-headers(minSdkVersion:29) -libflacextractor(minSdkVersion:29) -libfmq(minSdkVersion:29) -libfmq-base(minSdkVersion:29) -libFraunhoferAAC(minSdkVersion:29) -libfuse(minSdkVersion:30) -libfuse_jni(minSdkVersion:30) -libgav1(minSdkVersion:29) -libgcc(minSdkVersion:(no version)) -libgcc_stripped(minSdkVersion:(no version)) -libgetopts(minSdkVersion:29) -libgralloctypes(minSdkVersion:29) -libgrallocusage(minSdkVersion:29) -libgsm(minSdkVersion:apex_inherit) -libgtest_prod(minSdkVersion:apex_inherit) -libgui_bufferqueue_static(minSdkVersion:29) -libgui_headers(minSdkVersion:29) -libhardware(minSdkVersion:29) -libhardware_headers(minSdkVersion:29) -libhashbrown.rust_sysroot(minSdkVersion:29) -libhevcdec(minSdkVersion:29) -libhevcenc(minSdkVersion:29) -libhidlbase(minSdkVersion:29) -libhidlmemory(minSdkVersion:29) -libhwbinder-impl-internal(minSdkVersion:29) -libhwbinder_headers(minSdkVersion:29) -libion(minSdkVersion:29) -libjavacrypto(minSdkVersion:29) -libjsoncpp(minSdkVersion:29) -liblazy_static(minSdkVersion:29) -liblibc(minSdkVersion:29) -liblibc.rust_sysroot(minSdkVersion:29) -libLibGuiProperties(minSdkVersion:29) -liblibm(minSdkVersion:29) -liblog(minSdkVersion:(no version)) -liblog_headers(minSdkVersion:29) -liblog_rust(minSdkVersion:29) -liblua(minSdkVersion:(no version)) -liblz4(minSdkVersion:(no version)) -libm(minSdkVersion:(no version)) -libmath(minSdkVersion:29) -libmdnssd(minSdkVersion:(no version)) -libmedia_codecserviceregistrant(minSdkVersion:29) -libmedia_datasource_headers(minSdkVersion:29) -libmedia_headers(minSdkVersion:29) -libmedia_helper_headers(minSdkVersion:29) -libmedia_midiiowrapper(minSdkVersion:29) -libmediaparser-jni(minSdkVersion:29) -libmidiextractor(minSdkVersion:29) -libminijail(minSdkVersion:29) -libminijail_gen_constants(minSdkVersion:(no version)) -libminijail_gen_constants_obj(minSdkVersion:29) -libminijail_gen_syscall(minSdkVersion:(no version)) -libminijail_gen_syscall_obj(minSdkVersion:29) -libminijail_generated(minSdkVersion:29) -libmkvextractor(minSdkVersion:29) -libmodules-utils-build(minSdkVersion:29) -libmp3extractor(minSdkVersion:29) -libmp4extractor(minSdkVersion:29) -libmpeg2dec(minSdkVersion:29) -libmpeg2extractor(minSdkVersion:29) -libnativebase_headers(minSdkVersion:29) -libnativehelper_compat_libc++(minSdkVersion:(no version)) -libnativehelper_header_only(minSdkVersion:29) -libnativewindow_headers(minSdkVersion:29) -libnetd_resolv(minSdkVersion:29) -libnetdbinder_utils_headers(minSdkVersion:29) -libnetdutils(minSdkVersion:29) -libnetjniutils(minSdkVersion:29) -libnetworkstackutilsjni(minSdkVersion:29) -libneuralnetworks(minSdkVersion:(no version)) -libneuralnetworks_common(minSdkVersion:(no version)) -libneuralnetworks_headers(minSdkVersion:(no version)) -liboggextractor(minSdkVersion:29) -libonce_cell(minSdkVersion:29) -libopus(minSdkVersion:29) -libpanic_unwind.rust_sysroot(minSdkVersion:29) -libprocessgroup(minSdkVersion:29) -libprocessgroup_headers(minSdkVersion:29) -libprocpartition(minSdkVersion:(no version)) -libprofiler_builtins.rust_sysroot(minSdkVersion:29) -libprotobuf-cpp-lite(minSdkVersion:29) -libprotobuf-java-lite(minSdkVersion:current) -libprotobuf-java-nano(minSdkVersion:9) -libprotoutil(minSdkVersion:(no version)) -libqemu_pipe(minSdkVersion:(no version)) -libquiche_ffi(minSdkVersion:29) -libring(minSdkVersion:29) -libring-core(minSdkVersion:29) -librustc_demangle.rust_sysroot(minSdkVersion:29) -libruy_static(minSdkVersion:30) -libsdk_proto(minSdkVersion:30) -libsfplugin_ccodec_utils(minSdkVersion:29) -libsonivoxwithoutjet(minSdkVersion:29) -libspeexresampler(minSdkVersion:29) -libspin(minSdkVersion:29) -libssl(minSdkVersion:29) -libstagefright_amrnb_common(minSdkVersion:29) -libstagefright_amrnbdec(minSdkVersion:29) -libstagefright_amrnbenc(minSdkVersion:29) -libstagefright_amrwbdec(minSdkVersion:29) -libstagefright_amrwbenc(minSdkVersion:29) -libstagefright_bufferpool@2.0.1(minSdkVersion:29) -libstagefright_bufferqueue_helper(minSdkVersion:29) -libstagefright_enc_common(minSdkVersion:29) -libstagefright_esds(minSdkVersion:29) -libstagefright_flacdec(minSdkVersion:29) -libstagefright_foundation(minSdkVersion:29) -libstagefright_foundation_headers(minSdkVersion:29) -libstagefright_foundation_without_imemory(minSdkVersion:29) -libstagefright_headers(minSdkVersion:29) -libstagefright_id3(minSdkVersion:29) -libstagefright_m4vh263dec(minSdkVersion:29) -libstagefright_m4vh263enc(minSdkVersion:29) -libstagefright_metadatautils(minSdkVersion:29) -libstagefright_mp3dec(minSdkVersion:29) -libstagefright_mp3dec_headers(minSdkVersion:29) -libstagefright_mpeg2extractor(minSdkVersion:29) -libstagefright_mpeg2support_nocrypto(minSdkVersion:29) -libstats_jni(minSdkVersion:(no version)) -libstats_jni(minSdkVersion:30) -libstatslog_resolv(minSdkVersion:29) -libstatslog_statsd(minSdkVersion:(no version)) -libstatslog_statsd(minSdkVersion:30) -libstatspull(minSdkVersion:(no version)) -libstatspull(minSdkVersion:30) -libstatspush_compat(minSdkVersion:29) -libstatssocket(minSdkVersion:(no version)) -libstatssocket(minSdkVersion:30) -libstatssocket_headers(minSdkVersion:29) -libstd(minSdkVersion:29) -libsystem_headers(minSdkVersion:apex_inherit) -libsysutils(minSdkVersion:apex_inherit) -libterm(minSdkVersion:29) -libtest(minSdkVersion:29) -libtetherutilsjni(minSdkVersion:30) -libtetherutilsjni(minSdkVersion:current) -libtextclassifier(minSdkVersion:(no version)) -libtextclassifier-java(minSdkVersion:current) -libtextclassifier_hash_headers(minSdkVersion:(no version)) -libtextclassifier_hash_static(minSdkVersion:(no version)) -libtflite_kernel_utils(minSdkVersion:(no version)) -libtflite_static(minSdkVersion:(no version)) -libui(minSdkVersion:29) -libui_headers(minSdkVersion:29) -libunicode_width.rust_sysroot(minSdkVersion:29) -libuntrusted(minSdkVersion:29) -libunwind.rust_sysroot(minSdkVersion:29) -libunwind_llvm(minSdkVersion:apex_inherit) -libutf(minSdkVersion:(no version)) -libutils(minSdkVersion:apex_inherit) -libutils_headers(minSdkVersion:apex_inherit) -libvorbisidec(minSdkVersion:29) -libvpx(minSdkVersion:29) -libwatchdog(minSdkVersion:29) -libwavextractor(minSdkVersion:29) -libwebm(minSdkVersion:29) -libyuv(minSdkVersion:29) -libyuv_static(minSdkVersion:29) -libzstd(minSdkVersion:(no version)) -media_ndk_headers(minSdkVersion:29) -media_plugin_headers(minSdkVersion:29) -MediaProvider(minSdkVersion:30) -MediaProviderGoogle(minSdkVersion:30) -mediaswcodec(minSdkVersion:29) -metrics-constants-protos(minSdkVersion:29) -modules-annotation-minsdk(minSdkVersion:29) -modules-utils-build(minSdkVersion:29) -modules-utils-build_system(minSdkVersion:29) -modules-utils-os(minSdkVersion:30) -ndk_crtbegin_so.19(minSdkVersion:(no version)) -ndk_crtbegin_so.21(minSdkVersion:(no version)) -ndk_crtbegin_so.27(minSdkVersion:(no version)) -ndk_crtend_so.19(minSdkVersion:(no version)) -ndk_crtend_so.21(minSdkVersion:(no version)) -ndk_crtend_so.27(minSdkVersion:(no version)) -ndk_libc++_static(minSdkVersion:(no version)) -ndk_libc++_static(minSdkVersion:16) -ndk_libc++abi(minSdkVersion:(no version)) -ndk_libc++abi(minSdkVersion:16) -ndk_libunwind(minSdkVersion:16) -net-utils-device-common(minSdkVersion:29) -net-utils-framework-common(minSdkVersion:current) -netd-client(minSdkVersion:29) -netd_aidl_interface-java(minSdkVersion:29) -netd_aidl_interface-lateststable-java(minSdkVersion:29) -netd_aidl_interface-unstable-java(minSdkVersion:29) -netd_aidl_interface-V5-java(minSdkVersion:29) -netd_aidl_interface-V6-java(minSdkVersion:29) -netd_event_listener_interface-java(minSdkVersion:29) -netd_event_listener_interface-lateststable-ndk_platform(minSdkVersion:29) -netd_event_listener_interface-ndk_platform(minSdkVersion:29) -netd_event_listener_interface-unstable-ndk_platform(minSdkVersion:29) -netd_event_listener_interface-V1-ndk_platform(minSdkVersion:29) -netd_event_listener_interface-V2-ndk_platform(minSdkVersion:29) -netlink-client(minSdkVersion:29) -networkstack-aidl-interfaces-unstable-java(minSdkVersion:29) -networkstack-aidl-interfaces-V10-java(minSdkVersion:29) -networkstack-client(minSdkVersion:29) -NetworkStackApi29Shims(minSdkVersion:29) -NetworkStackApi30Shims(minSdkVersion:29) -NetworkStackApiStableDependencies(minSdkVersion:29) -NetworkStackApiStableLib(minSdkVersion:29) -NetworkStackApiStableShims(minSdkVersion:29) -networkstackprotos(minSdkVersion:29) -NetworkStackShimsCommon(minSdkVersion:29) -neuralnetworks_types(minSdkVersion:30) -neuralnetworks_utils_hal_1_0(minSdkVersion:30) -neuralnetworks_utils_hal_1_1(minSdkVersion:30) -neuralnetworks_utils_hal_1_2(minSdkVersion:30) -neuralnetworks_utils_hal_1_3(minSdkVersion:30) -neuralnetworks_utils_hal_aidl(minSdkVersion:30) -neuralnetworks_utils_hal_common(minSdkVersion:30) -neuralnetworks_utils_hal_service(minSdkVersion:30) -no_op(minSdkVersion:current) -note_memtag_heap_async(minSdkVersion:16) -note_memtag_heap_sync(minSdkVersion:16) -PermissionController(minSdkVersion:30) -permissioncontroller-statsd(minSdkVersion:current) -philox_random(minSdkVersion:(no version)) -philox_random_headers(minSdkVersion:(no version)) -prebuilt_androidx-constraintlayout_constraintlayout-nodeps(minSdkVersion:(no version)) -prebuilt_androidx-constraintlayout_constraintlayout-solver-nodeps(minSdkVersion:current) -prebuilt_androidx.activity_activity-ktx-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.activity_activity-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.annotation_annotation-nodeps(minSdkVersion:current) -prebuilt_androidx.appcompat_appcompat-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.appcompat_appcompat-resources-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.arch.core_core-common-nodeps(minSdkVersion:current) -prebuilt_androidx.arch.core_core-runtime-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.asynclayoutinflater_asynclayoutinflater-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.autofill_autofill-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.cardview_cardview-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.collection_collection-ktx-nodeps(minSdkVersion:current) -prebuilt_androidx.collection_collection-nodeps(minSdkVersion:current) -prebuilt_androidx.coordinatorlayout_coordinatorlayout-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.core_core-ktx-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.core_core-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.cursoradapter_cursoradapter-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.customview_customview-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.documentfile_documentfile-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.drawerlayout_drawerlayout-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.dynamicanimation_dynamicanimation-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.fragment_fragment-ktx-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.fragment_fragment-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.interpolator_interpolator-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.leanback_leanback-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.leanback_leanback-preference-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.legacy_legacy-support-core-ui-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.legacy_legacy-support-core-utils-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.legacy_legacy-support-v13-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.lifecycle_lifecycle-common-java8-nodeps(minSdkVersion:current) -prebuilt_androidx.lifecycle_lifecycle-common-nodeps(minSdkVersion:current) -prebuilt_androidx.lifecycle_lifecycle-extensions-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.lifecycle_lifecycle-livedata-core-ktx-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.lifecycle_lifecycle-livedata-core-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.lifecycle_lifecycle-livedata-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.lifecycle_lifecycle-process-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.lifecycle_lifecycle-runtime-ktx-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.lifecycle_lifecycle-runtime-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.lifecycle_lifecycle-service-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.lifecycle_lifecycle-viewmodel-ktx-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.lifecycle_lifecycle-viewmodel-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.lifecycle_lifecycle-viewmodel-savedstate-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.loader_loader-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.localbroadcastmanager_localbroadcastmanager-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.media_media-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.navigation_navigation-common-ktx-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.navigation_navigation-common-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.navigation_navigation-fragment-ktx-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.navigation_navigation-fragment-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.navigation_navigation-runtime-ktx-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.navigation_navigation-runtime-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.navigation_navigation-ui-ktx-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.navigation_navigation-ui-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.preference_preference-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.print_print-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.recyclerview_recyclerview-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.recyclerview_recyclerview-selection-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.savedstate_savedstate-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.slidingpanelayout_slidingpanelayout-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.swiperefreshlayout_swiperefreshlayout-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.transition_transition-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.vectordrawable_vectordrawable-animated-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.vectordrawable_vectordrawable-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.versionedparcelable_versionedparcelable-nodeps(minSdkVersion:(no version)) -prebuilt_androidx.viewpager_viewpager-nodeps(minSdkVersion:(no version)) -prebuilt_com.google.android.material_material-nodeps(minSdkVersion:(no version)) -prebuilt_error_prone_annotations(minSdkVersion:(no version)) -prebuilt_kotlin-stdlib(minSdkVersion:current) -prebuilt_kotlinx-coroutines-android-nodeps(minSdkVersion:(no version)) -prebuilt_kotlinx-coroutines-core-nodeps(minSdkVersion:(no version)) -prebuilt_libclang_rt.builtins-aarch64-android(minSdkVersion:(no version)) -prebuilt_libclang_rt.builtins-arm-android(minSdkVersion:(no version)) -prebuilt_libclang_rt.builtins-i686-android(minSdkVersion:(no version)) -prebuilt_libclang_rt.builtins-x86_64-android(minSdkVersion:(no version)) -prebuilt_libunwind(minSdkVersion:(no version)) -prebuilt_test_framework-sdkextensions(minSdkVersion:(no version)) -server_configurable_flags(minSdkVersion:29) -service-media-s(minSdkVersion:29) -service-permission(minSdkVersion:30) -service-permission(minSdkVersion:current) -service-permission-shared(minSdkVersion:30) -service-statsd(minSdkVersion:30) -service-statsd(minSdkVersion:current) -SettingsLibActionBarShadow(minSdkVersion:21) -SettingsLibAppPreference(minSdkVersion:21) -SettingsLibBarChartPreference(minSdkVersion:21) -SettingsLibHelpUtils(minSdkVersion:21) -SettingsLibLayoutPreference(minSdkVersion:21) -SettingsLibProgressBar(minSdkVersion:21) -SettingsLibRestrictedLockUtils(minSdkVersion:21) -SettingsLibSearchWidget(minSdkVersion:21) -SettingsLibSettingsTheme(minSdkVersion:21) -SettingsLibUtils(minSdkVersion:21) -stats_proto(minSdkVersion:29) -statsd(minSdkVersion:(no version)) -statsd(minSdkVersion:30) -statsd-aidl-ndk_platform(minSdkVersion:(no version)) -statsd-aidl-ndk_platform(minSdkVersion:30) -statsprotos(minSdkVersion:29) -tensorflow_headers(minSdkVersion:(no version)) -Tethering(minSdkVersion:30) -Tethering(minSdkVersion:current) -TetheringApiCurrentLib(minSdkVersion:30) -TetheringApiCurrentLib(minSdkVersion:current) -TetheringGoogle(minSdkVersion:30) -TetheringGoogle(minSdkVersion:current) -textclassifier-statsd(minSdkVersion:current) -TextClassifierNotificationLibNoManifest(minSdkVersion:29) -TextClassifierServiceLibNoManifest(minSdkVersion:28) -updatable-media(minSdkVersion:29) -xz-java(minSdkVersion:current) diff --git a/apex/apex_singleton.go b/apex/apex_singleton.go index ee9fc8115..4890ba45e 100644 --- a/apex/apex_singleton.go +++ b/apex/apex_singleton.go @@ -58,8 +58,8 @@ var ( echo "ERROR: go/apex-allowed-deps-error"; echo "******************************"; echo "Detected changes to allowed dependencies in updatable modules."; - echo "To fix and update build/soong/apex/allowed_deps.txt, please run:"; - echo "$$ (croot && build/soong/scripts/update-apex-allowed-deps.sh)"; + echo "To fix and update packages/modules/common/build/allowed_deps.txt, please run:"; + echo "$$ (croot && packages/modules/common/build/update-apex-allowed-deps.sh)"; echo "Members of mainline-modularization@google.com will review the changes."; echo -e "******************************\n"; exit 1; @@ -81,7 +81,7 @@ func (s *apexDepsInfoSingleton) GenerateBuildActions(ctx android.SingletonContex } }) - allowedDeps := android.ExistentPathForSource(ctx, "build/soong/apex/allowed_deps.txt").Path() + allowedDeps := android.ExistentPathForSource(ctx, "packages/modules/common/build/allowed_deps.txt").Path() newAllowedDeps := android.PathForOutput(ctx, "apex", "depsinfo", "new-allowed-deps.txt") ctx.Build(pctx, android.BuildParams{ diff --git a/scripts/update-apex-allowed-deps.sh b/scripts/update-apex-allowed-deps.sh deleted file mode 100755 index 872d74670..000000000 --- a/scripts/update-apex-allowed-deps.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash -e -# -# The script to run locally to re-generate global allowed list of dependencies -# for updatable modules. - -if [ ! -e "build/envsetup.sh" ]; then - echo "ERROR: $0 must be run from the top of the tree" - exit 1 -fi - -source build/envsetup.sh > /dev/null || exit 1 - -readonly OUT_DIR=$(get_build_var OUT_DIR) - -readonly ALLOWED_DEPS_FILE="build/soong/apex/allowed_deps.txt" -readonly NEW_ALLOWED_DEPS_FILE="${OUT_DIR}/soong/apex/depsinfo/new-allowed-deps.txt" - -# If the script is run after droidcore failure, ${NEW_ALLOWED_DEPS_FILE} -# should already be built. If running the script manually, make sure it exists. -m "${NEW_ALLOWED_DEPS_FILE}" -j - -cat > "${ALLOWED_DEPS_FILE}" << EndOfFileComment -# A list of allowed dependencies for all updatable modules. -# -# The list tracks all direct and transitive dependencies that end up within any -# of the updatable binaries; specifically excluding external dependencies -# required to compile those binaries. This prevents potential regressions in -# case a new dependency is not aware of the different functional and -# non-functional requirements being part of an updatable module, for example -# setting correct min_sdk_version. -# -# To update the list, run: -# repo-root$ build/soong/scripts/update-apex-allowed-deps.sh -# -# See go/apex-allowed-deps-error for more details. -# TODO(b/157465465): introduce automated quality signals and remove this list. -EndOfFileComment - -cat "${NEW_ALLOWED_DEPS_FILE}" >> "${ALLOWED_DEPS_FILE}" From 58d85b87bc7ceba94701ee88e4bc66a757dad6f3 Mon Sep 17 00:00:00 2001 From: Bob Badour Date: Mon, 15 Mar 2021 20:00:01 -0700 Subject: [PATCH 12/13] Minimal license feature. Keeps license declarations from breaking the build without implementing the full feature. Test: m all Bug: 181768532 Change-Id: Ic78672cd25da13aa9078a48b06446f66780c792d Merged-in: Ic78672cd25da13aa9078a48b06446f66780c792d Merged-in: If3fbc157c6ffed8e3ee4bdd9aa56fabe2c24444b Merged-in: Ie7e1695ecb8cd943124426a0cad2c0d1db2b46ed --- Android.bp | 4 ++ android/license.go | 69 ++++++++++++++++++ android/license_test.go | 150 ++++++++++++++++++++++++++++++++++++++++ android/module.go | 3 + android/mutator.go | 1 + android/package.go | 93 +++++++++++++++++++++++++ android/package_test.go | 110 +++++++++++++++++++++++++++++ 7 files changed, 430 insertions(+) create mode 100644 android/license.go create mode 100644 android/license_test.go create mode 100644 android/package.go create mode 100644 android/package_test.go diff --git a/Android.bp b/Android.bp index 28cce1c9c..c9ed95b70 100644 --- a/Android.bp +++ b/Android.bp @@ -49,6 +49,7 @@ bootstrap_go_package { "android/expand.go", "android/filegroup.go", "android/hooks.go", + "android/license.go", "android/makevars.go", "android/module.go", "android/mutator.go", @@ -57,6 +58,7 @@ bootstrap_go_package { "android/notices.go", "android/onceper.go", "android/override_module.go", + "android/package.go", "android/package_ctx.go", "android/path_properties.go", "android/paths.go", @@ -80,10 +82,12 @@ bootstrap_go_package { "android/arch_test.go", "android/config_test.go", "android/expand_test.go", + "android/license_test.go", "android/namespace_test.go", "android/neverallow_test.go", "android/onceper_test.go", "android/path_properties_test.go", + "android/package_test.go", "android/paths_test.go", "android/prebuilt_test.go", "android/prebuilt_etc_test.go", diff --git a/android/license.go b/android/license.go new file mode 100644 index 000000000..6a7c31338 --- /dev/null +++ b/android/license.go @@ -0,0 +1,69 @@ +// Copyright 2020 Google Inc. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package android + +import ( + "github.com/google/blueprint" +) + +func init() { + RegisterModuleType("license", LicenseFactory) +} + +type licenseProperties struct { + // Specifies the kinds of license that apply. + License_kinds []string + // Specifies a short copyright notice to use for the license. + Copyright_notice *string + // Specifies the path or label for the text of the license. + License_text []string `android:"path"` + // Specifies the package name to which the license applies. + Package_name *string + // Specifies where this license can be used + Visibility []string +} + +type licenseModule struct { + ModuleBase + DefaultableModuleBase + + properties licenseProperties +} + +func (m *licenseModule) DepsMutator(ctx BottomUpMutatorContext) { + // Do nothing. +} + +func (m *licenseModule) GenerateAndroidBuildActions(ctx ModuleContext) { + // Nothing to do. +} + +func (m *licenseModule) GenerateBuildActions(ctx blueprint.ModuleContext) { + // Nothing to do. +} + +func LicenseFactory() Module { + module := &licenseModule{} + + base := module.base() + module.AddProperties( + &base.nameProperties, + &module.properties) + + base.generalProperties = module.GetProperties() + base.customizableProperties = module.GetProperties() + + return module +} diff --git a/android/license_test.go b/android/license_test.go new file mode 100644 index 000000000..cd2cb64ff --- /dev/null +++ b/android/license_test.go @@ -0,0 +1,150 @@ +package android + +import ( + "io/ioutil" + "os" + "testing" +) + +var licenseTests = []struct { + name string + fs map[string][]byte + expectedErrors []string +}{ + { + name: "license must not accept licenses property", + fs: map[string][]byte{ + "top/Blueprints": []byte(` + license { + name: "top_license", + visibility: ["//visibility:private"], + licenses: ["other_license"], + + }`), + }, + expectedErrors: []string{ + `top/Blueprints:5:14: unrecognized property "licenses"`, + }, + }, + { + name: "public license", + fs: map[string][]byte{ + "top/Blueprints": []byte(` + license { + name: "top_proprietary", + license_kinds: ["top_by_exception_only"], + visibility: ["//visibility:public"], + }`), + "other/Blueprints": []byte(` + rule { + name: "arule", + licenses: ["top_proprietary"], + + }`), + "yetmore/Blueprints": []byte(` + package { + default_applicable_licenses: ["top_proprietary"], + }`), + }, + }, + { + name: "multiple licenses", + fs: map[string][]byte{ + "top/Blueprints": []byte(` + package { + default_applicable_licenses: ["top_proprietary"], + } + license { + name: "top_allowed_as_notice", + license_kinds: ["top_notice"], + } + license { + name: "top_proprietary", + license_kinds: ["top_by_exception_only"], + visibility: ["//visibility:public"], + } + rule { + name: "myrule", + licenses: ["top_allowed_as_notice", "top_proprietary"] + }`), + "other/Blueprints": []byte(` + rule { + name: "arule", + licenses: ["top_proprietary"], + + }`), + "yetmore/Blueprints": []byte(` + package { + default_applicable_licenses: ["top_proprietary"], + }`), + }, + }, +} + +func TestLicense(t *testing.T) { + for _, test := range licenseTests { + t.Run(test.name, func(t *testing.T) { + _, errs := testLicense(test.fs) + expectedErrors := test.expectedErrors + if expectedErrors == nil { + FailIfErrored(t, errs) + } else { + for _, expectedError := range expectedErrors { + FailIfNoMatchingErrors(t, expectedError, errs) + } + if len(errs) > len(expectedErrors) { + t.Errorf("additional errors found, expected %d, found %d", len(expectedErrors), len(errs)) + for i, expectedError := range expectedErrors { + t.Errorf("expectedErrors[%d] = %s", i, expectedError) + } + for i, err := range errs { + t.Errorf("errs[%d] = %s", i, err) + } + } + } + }) + } +} +func testLicense(fs map[string][]byte) (*TestContext, []error) { + buildDir, err := ioutil.TempDir("", "license_test") + if err != nil { + return nil, []error{err} + } + defer os.RemoveAll(buildDir) + + // Create a new config per test as visibility information is stored in the config. + env := make(map[string]string) + env["ANDROID_REQUIRE_LICENSES"] = "1" + config := TestArchConfig(buildDir, env) + ctx := NewTestArchContext() + ctx.MockFileSystem(fs) + ctx.RegisterModuleType("package", ModuleFactoryAdaptor(PackageFactory)) + ctx.RegisterModuleType("license", ModuleFactoryAdaptor(LicenseFactory)) + ctx.RegisterModuleType("rule", ModuleFactoryAdaptor(newMockRuleModule)) + ctx.PreArchMutators(registerPackageRenamer) + ctx.Register() + _, errs := ctx.ParseBlueprintsFiles(".") + if len(errs) > 0 { + return ctx, errs + } + _, errs = ctx.PrepareBuildActions(config) + return ctx, errs +} + +type mockRuleModule struct { + ModuleBase + DefaultableModuleBase +} + +func newMockRuleModule() Module { + m := &mockRuleModule{} + InitAndroidModule(m) + InitDefaultableModule(m) + return m +} + +func (p *mockRuleModule) GenerateAndroidBuildActions(ModuleContext) { +} + +func (p *mockRuleModule) DepsMutator(BottomUpMutatorContext) { +} diff --git a/android/module.go b/android/module.go index d34916fc4..7f4e30817 100644 --- a/android/module.go +++ b/android/module.go @@ -208,6 +208,9 @@ type commonProperties struct { // emit build rules for this module Enabled *bool `android:"arch_variant"` + // Names of the licenses that apply to this module. + Licenses []string + // control whether this module compiles for 32-bit, 64-bit, or both. Possible values // are "32" (compile for 32-bit only), "64" (compile for 64-bit only), "both" (compile for both // architectures), or "first" (compile for 64-bit on a 64-bit platform, and 32-bit on a 32-bit diff --git a/android/mutator.go b/android/mutator.go index 71237a1cd..31a378941 100644 --- a/android/mutator.go +++ b/android/mutator.go @@ -77,6 +77,7 @@ var preArch = []RegisterMutatorFunc{ ctx.TopDown("load_hooks", LoadHookMutator).Parallel() }, RegisterNamespaceMutator, + registerPackageRenamer, RegisterPrebuiltsPreArchMutators, RegisterDefaultsPreArchMutators, RegisterOverridePreArchMutators, diff --git a/android/package.go b/android/package.go new file mode 100644 index 000000000..6949c4e2d --- /dev/null +++ b/android/package.go @@ -0,0 +1,93 @@ +// Copyright 2019 Google Inc. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package android + +import ( + "fmt" + "sync/atomic" + + "github.com/google/blueprint" +) + +func init() { + RegisterModuleType("package", PackageFactory) +} + +type packageProperties struct { + // Specifies the default visibility for all modules defined in this package. + Default_visibility []string + // Specifies the names of the default licenses for all modules defined in this package. + Default_applicable_licenses []string +} + +type packageModule struct { + ModuleBase + + properties packageProperties + // The module dir + name string `blueprint:"mutated"` +} + +func (p *packageModule) GenerateAndroidBuildActions(ModuleContext) { + // Nothing to do. +} + +func (p *packageModule) GenerateBuildActions(ctx blueprint.ModuleContext) { + // Nothing to do. +} + +func (p *packageModule) DepsMutator(ctx BottomUpMutatorContext) { + // Nothing to do. +} + +func (p *packageModule) Name() string { + return p.name +} + +func registerPackageRenamer(ctx RegisterMutatorsContext) { + ctx.BottomUp("packages", packageRenamer).Parallel() +} + +// packageRenamer ensures that every package gets named +func packageRenamer(ctx BottomUpMutatorContext) { + if p, ok := ctx.Module().(*packageModule); ok { + p.name = "//" + ctx.ModuleDir() + ctx.Rename("//" + ctx.ModuleDir()) + } +} + +// Counter to ensure package modules are created with a unique name within whatever namespace they +// belong. +var packageCount uint32 = 0 + +func PackageFactory() Module { + module := &packageModule{} + + // Get a unique if for the package. Has to be done atomically as the creation of the modules are + // done in parallel. + id := atomic.AddUint32(&packageCount, 1) + module.name = fmt.Sprintf("soong_package_%d", id) + + module.AddProperties(&module.properties) + + // The name is the relative path from build root to the directory containing this + // module. Set that name at the earliest possible moment that information is available + // which is in a LoadHook. + AddLoadHook(module, func(ctx LoadHookContext) { + module.name = "//" + ctx.ModuleDir() + }) + + return module +} diff --git a/android/package_test.go b/android/package_test.go new file mode 100644 index 000000000..c7e9c553f --- /dev/null +++ b/android/package_test.go @@ -0,0 +1,110 @@ +package android + +import ( + "io/ioutil" + "os" + "testing" +) + +var packageTests = []struct { + name string + fs map[string][]byte + expectedErrors []string +}{ + // Package default_visibility handling is tested in visibility_test.go + { + name: "package must not accept visibility and name properties", + fs: map[string][]byte{ + "top/Blueprints": []byte(` + package { + name: "package", + visibility: ["//visibility:private"], + }`), + }, + expectedErrors: []string{ + `top/Blueprints:3:10: unrecognized property "name"`, + `top/Blueprints:4:16: unrecognized property "visibility"`, + }, + }, + { + name: "multiple packages in separate directories", + fs: map[string][]byte{ + "top/Blueprints": []byte(` + package { + }`), + "other/Blueprints": []byte(` + package { + }`), + "other/nested/Blueprints": []byte(` + package { + }`), + }, + }, + { + name: "package must not be specified more than once per package", + fs: map[string][]byte{ + "top/Blueprints": []byte(` + package { + default_visibility: ["//visibility:private"], + default_applicable_licenses: ["license"], + } + + package { + }`), + }, + expectedErrors: []string{ + `"//top" conflicts with existing module`, + }, + }, +} + +func TestPackage(t *testing.T) { + for _, test := range packageTests { + t.Run(test.name, func(t *testing.T) { + _, errs := testPackage(test.fs) + + expectedErrors := test.expectedErrors + if expectedErrors == nil { + FailIfErrored(t, errs) + } else { + for _, expectedError := range expectedErrors { + FailIfNoMatchingErrors(t, expectedError, errs) + } + if len(errs) > len(expectedErrors) { + t.Errorf("additional errors found, expected %d, found %d", len(expectedErrors), len(errs)) + for i, expectedError := range expectedErrors { + t.Errorf("expectedErrors[%d] = %s", i, expectedError) + } + for i, err := range errs { + t.Errorf("errs[%d] = %s", i, err) + } + } + } + }) + } +} + +func testPackage(fs map[string][]byte) (*TestContext, []error) { + buildDir, err := ioutil.TempDir("", "package_test") + if err != nil { + return nil, []error{err} + } + defer os.RemoveAll(buildDir) + + // Create a new config per test as visibility information is stored in the config. + config := TestArchConfig(buildDir, nil) + + ctx := NewTestArchContext() + ctx.MockFileSystem(fs) + ctx.RegisterModuleType("package", ModuleFactoryAdaptor(PackageFactory)) + ctx.PreArchMutators(registerPackageRenamer) + ctx.Register() + + _, errs := ctx.ParseBlueprintsFiles(".") + if len(errs) > 0 { + return ctx, errs + } + + _, errs = ctx.PrepareBuildActions(config) + return ctx, errs +} From 459beab694425a91246a73ff7a991fde83d6d4ca Mon Sep 17 00:00:00 2001 From: Bob Badour Date: Mon, 15 Mar 2021 20:00:01 -0700 Subject: [PATCH 13/13] Minimal license feature. Keeps license declarations from breaking the build without implementing the full feature. Test: m all Bug: 181768532 Change-Id: Ic78672cd25da13aa9078a48b06446f66780c792d Merged-in: Ic78672cd25da13aa9078a48b06446f66780c792d Merged-in: If3fbc157c6ffed8e3ee4bdd9aa56fabe2c24444b Merged-in: Ie7e1695ecb8cd943124426a0cad2c0d1db2b46ed --- Android.bp | 4 ++ android/license.go | 69 ++++++++++++++++++ android/license_test.go | 150 ++++++++++++++++++++++++++++++++++++++++ android/module.go | 3 + android/mutator.go | 1 + android/package.go | 93 +++++++++++++++++++++++++ android/package_test.go | 110 +++++++++++++++++++++++++++++ 7 files changed, 430 insertions(+) create mode 100644 android/license.go create mode 100644 android/license_test.go create mode 100644 android/package.go create mode 100644 android/package_test.go diff --git a/Android.bp b/Android.bp index e9b1ebe07..93e706d68 100644 --- a/Android.bp +++ b/Android.bp @@ -47,12 +47,14 @@ bootstrap_go_package { "android/defs.go", "android/expand.go", "android/hooks.go", + "android/license.go", "android/makevars.go", "android/module.go", "android/mutator.go", "android/namespace.go", "android/neverallow.go", "android/onceper.go", + "android/package.go", "android/package_ctx.go", "android/paths.go", "android/prebuilt.go", @@ -70,8 +72,10 @@ bootstrap_go_package { testSrcs: [ "android/config_test.go", "android/expand_test.go", + "android/license_test.go", "android/namespace_test.go", "android/neverallow_test.go", + "android/package_test.go", "android/paths_test.go", "android/prebuilt_test.go", "android/util_test.go", diff --git a/android/license.go b/android/license.go new file mode 100644 index 000000000..6a7c31338 --- /dev/null +++ b/android/license.go @@ -0,0 +1,69 @@ +// Copyright 2020 Google Inc. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package android + +import ( + "github.com/google/blueprint" +) + +func init() { + RegisterModuleType("license", LicenseFactory) +} + +type licenseProperties struct { + // Specifies the kinds of license that apply. + License_kinds []string + // Specifies a short copyright notice to use for the license. + Copyright_notice *string + // Specifies the path or label for the text of the license. + License_text []string `android:"path"` + // Specifies the package name to which the license applies. + Package_name *string + // Specifies where this license can be used + Visibility []string +} + +type licenseModule struct { + ModuleBase + DefaultableModuleBase + + properties licenseProperties +} + +func (m *licenseModule) DepsMutator(ctx BottomUpMutatorContext) { + // Do nothing. +} + +func (m *licenseModule) GenerateAndroidBuildActions(ctx ModuleContext) { + // Nothing to do. +} + +func (m *licenseModule) GenerateBuildActions(ctx blueprint.ModuleContext) { + // Nothing to do. +} + +func LicenseFactory() Module { + module := &licenseModule{} + + base := module.base() + module.AddProperties( + &base.nameProperties, + &module.properties) + + base.generalProperties = module.GetProperties() + base.customizableProperties = module.GetProperties() + + return module +} diff --git a/android/license_test.go b/android/license_test.go new file mode 100644 index 000000000..cd2cb64ff --- /dev/null +++ b/android/license_test.go @@ -0,0 +1,150 @@ +package android + +import ( + "io/ioutil" + "os" + "testing" +) + +var licenseTests = []struct { + name string + fs map[string][]byte + expectedErrors []string +}{ + { + name: "license must not accept licenses property", + fs: map[string][]byte{ + "top/Blueprints": []byte(` + license { + name: "top_license", + visibility: ["//visibility:private"], + licenses: ["other_license"], + + }`), + }, + expectedErrors: []string{ + `top/Blueprints:5:14: unrecognized property "licenses"`, + }, + }, + { + name: "public license", + fs: map[string][]byte{ + "top/Blueprints": []byte(` + license { + name: "top_proprietary", + license_kinds: ["top_by_exception_only"], + visibility: ["//visibility:public"], + }`), + "other/Blueprints": []byte(` + rule { + name: "arule", + licenses: ["top_proprietary"], + + }`), + "yetmore/Blueprints": []byte(` + package { + default_applicable_licenses: ["top_proprietary"], + }`), + }, + }, + { + name: "multiple licenses", + fs: map[string][]byte{ + "top/Blueprints": []byte(` + package { + default_applicable_licenses: ["top_proprietary"], + } + license { + name: "top_allowed_as_notice", + license_kinds: ["top_notice"], + } + license { + name: "top_proprietary", + license_kinds: ["top_by_exception_only"], + visibility: ["//visibility:public"], + } + rule { + name: "myrule", + licenses: ["top_allowed_as_notice", "top_proprietary"] + }`), + "other/Blueprints": []byte(` + rule { + name: "arule", + licenses: ["top_proprietary"], + + }`), + "yetmore/Blueprints": []byte(` + package { + default_applicable_licenses: ["top_proprietary"], + }`), + }, + }, +} + +func TestLicense(t *testing.T) { + for _, test := range licenseTests { + t.Run(test.name, func(t *testing.T) { + _, errs := testLicense(test.fs) + expectedErrors := test.expectedErrors + if expectedErrors == nil { + FailIfErrored(t, errs) + } else { + for _, expectedError := range expectedErrors { + FailIfNoMatchingErrors(t, expectedError, errs) + } + if len(errs) > len(expectedErrors) { + t.Errorf("additional errors found, expected %d, found %d", len(expectedErrors), len(errs)) + for i, expectedError := range expectedErrors { + t.Errorf("expectedErrors[%d] = %s", i, expectedError) + } + for i, err := range errs { + t.Errorf("errs[%d] = %s", i, err) + } + } + } + }) + } +} +func testLicense(fs map[string][]byte) (*TestContext, []error) { + buildDir, err := ioutil.TempDir("", "license_test") + if err != nil { + return nil, []error{err} + } + defer os.RemoveAll(buildDir) + + // Create a new config per test as visibility information is stored in the config. + env := make(map[string]string) + env["ANDROID_REQUIRE_LICENSES"] = "1" + config := TestArchConfig(buildDir, env) + ctx := NewTestArchContext() + ctx.MockFileSystem(fs) + ctx.RegisterModuleType("package", ModuleFactoryAdaptor(PackageFactory)) + ctx.RegisterModuleType("license", ModuleFactoryAdaptor(LicenseFactory)) + ctx.RegisterModuleType("rule", ModuleFactoryAdaptor(newMockRuleModule)) + ctx.PreArchMutators(registerPackageRenamer) + ctx.Register() + _, errs := ctx.ParseBlueprintsFiles(".") + if len(errs) > 0 { + return ctx, errs + } + _, errs = ctx.PrepareBuildActions(config) + return ctx, errs +} + +type mockRuleModule struct { + ModuleBase + DefaultableModuleBase +} + +func newMockRuleModule() Module { + m := &mockRuleModule{} + InitAndroidModule(m) + InitDefaultableModule(m) + return m +} + +func (p *mockRuleModule) GenerateAndroidBuildActions(ModuleContext) { +} + +func (p *mockRuleModule) DepsMutator(BottomUpMutatorContext) { +} diff --git a/android/module.go b/android/module.go index 1e5447006..2d0d5b8c2 100644 --- a/android/module.go +++ b/android/module.go @@ -196,6 +196,9 @@ type commonProperties struct { // emit build rules for this module Enabled *bool `android:"arch_variant"` + // Names of the licenses that apply to this module. + Licenses []string + // control whether this module compiles for 32-bit, 64-bit, or both. Possible values // are "32" (compile for 32-bit only), "64" (compile for 64-bit only), "both" (compile for both // architectures), or "first" (compile for 64-bit on a 64-bit platform, and 32-bit on a 32-bit diff --git a/android/mutator.go b/android/mutator.go index 64d9fddb7..644a86bb3 100644 --- a/android/mutator.go +++ b/android/mutator.go @@ -77,6 +77,7 @@ var preArch = []RegisterMutatorFunc{ ctx.TopDown("load_hooks", loadHookMutator).Parallel() }, RegisterNamespaceMutator, + registerPackageRenamer, RegisterPrebuiltsPreArchMutators, RegisterDefaultsPreArchMutators, } diff --git a/android/package.go b/android/package.go new file mode 100644 index 000000000..6949c4e2d --- /dev/null +++ b/android/package.go @@ -0,0 +1,93 @@ +// Copyright 2019 Google Inc. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package android + +import ( + "fmt" + "sync/atomic" + + "github.com/google/blueprint" +) + +func init() { + RegisterModuleType("package", PackageFactory) +} + +type packageProperties struct { + // Specifies the default visibility for all modules defined in this package. + Default_visibility []string + // Specifies the names of the default licenses for all modules defined in this package. + Default_applicable_licenses []string +} + +type packageModule struct { + ModuleBase + + properties packageProperties + // The module dir + name string `blueprint:"mutated"` +} + +func (p *packageModule) GenerateAndroidBuildActions(ModuleContext) { + // Nothing to do. +} + +func (p *packageModule) GenerateBuildActions(ctx blueprint.ModuleContext) { + // Nothing to do. +} + +func (p *packageModule) DepsMutator(ctx BottomUpMutatorContext) { + // Nothing to do. +} + +func (p *packageModule) Name() string { + return p.name +} + +func registerPackageRenamer(ctx RegisterMutatorsContext) { + ctx.BottomUp("packages", packageRenamer).Parallel() +} + +// packageRenamer ensures that every package gets named +func packageRenamer(ctx BottomUpMutatorContext) { + if p, ok := ctx.Module().(*packageModule); ok { + p.name = "//" + ctx.ModuleDir() + ctx.Rename("//" + ctx.ModuleDir()) + } +} + +// Counter to ensure package modules are created with a unique name within whatever namespace they +// belong. +var packageCount uint32 = 0 + +func PackageFactory() Module { + module := &packageModule{} + + // Get a unique if for the package. Has to be done atomically as the creation of the modules are + // done in parallel. + id := atomic.AddUint32(&packageCount, 1) + module.name = fmt.Sprintf("soong_package_%d", id) + + module.AddProperties(&module.properties) + + // The name is the relative path from build root to the directory containing this + // module. Set that name at the earliest possible moment that information is available + // which is in a LoadHook. + AddLoadHook(module, func(ctx LoadHookContext) { + module.name = "//" + ctx.ModuleDir() + }) + + return module +} diff --git a/android/package_test.go b/android/package_test.go new file mode 100644 index 000000000..c7e9c553f --- /dev/null +++ b/android/package_test.go @@ -0,0 +1,110 @@ +package android + +import ( + "io/ioutil" + "os" + "testing" +) + +var packageTests = []struct { + name string + fs map[string][]byte + expectedErrors []string +}{ + // Package default_visibility handling is tested in visibility_test.go + { + name: "package must not accept visibility and name properties", + fs: map[string][]byte{ + "top/Blueprints": []byte(` + package { + name: "package", + visibility: ["//visibility:private"], + }`), + }, + expectedErrors: []string{ + `top/Blueprints:3:10: unrecognized property "name"`, + `top/Blueprints:4:16: unrecognized property "visibility"`, + }, + }, + { + name: "multiple packages in separate directories", + fs: map[string][]byte{ + "top/Blueprints": []byte(` + package { + }`), + "other/Blueprints": []byte(` + package { + }`), + "other/nested/Blueprints": []byte(` + package { + }`), + }, + }, + { + name: "package must not be specified more than once per package", + fs: map[string][]byte{ + "top/Blueprints": []byte(` + package { + default_visibility: ["//visibility:private"], + default_applicable_licenses: ["license"], + } + + package { + }`), + }, + expectedErrors: []string{ + `"//top" conflicts with existing module`, + }, + }, +} + +func TestPackage(t *testing.T) { + for _, test := range packageTests { + t.Run(test.name, func(t *testing.T) { + _, errs := testPackage(test.fs) + + expectedErrors := test.expectedErrors + if expectedErrors == nil { + FailIfErrored(t, errs) + } else { + for _, expectedError := range expectedErrors { + FailIfNoMatchingErrors(t, expectedError, errs) + } + if len(errs) > len(expectedErrors) { + t.Errorf("additional errors found, expected %d, found %d", len(expectedErrors), len(errs)) + for i, expectedError := range expectedErrors { + t.Errorf("expectedErrors[%d] = %s", i, expectedError) + } + for i, err := range errs { + t.Errorf("errs[%d] = %s", i, err) + } + } + } + }) + } +} + +func testPackage(fs map[string][]byte) (*TestContext, []error) { + buildDir, err := ioutil.TempDir("", "package_test") + if err != nil { + return nil, []error{err} + } + defer os.RemoveAll(buildDir) + + // Create a new config per test as visibility information is stored in the config. + config := TestArchConfig(buildDir, nil) + + ctx := NewTestArchContext() + ctx.MockFileSystem(fs) + ctx.RegisterModuleType("package", ModuleFactoryAdaptor(PackageFactory)) + ctx.PreArchMutators(registerPackageRenamer) + ctx.Register() + + _, errs := ctx.ParseBlueprintsFiles(".") + if len(errs) > 0 { + return ctx, errs + } + + _, errs = ctx.PrepareBuildActions(config) + return ctx, errs +}