Merge "Add systemserverclasspath_fragments property to apex." into sc-dev
diff --git a/android/api_levels.go b/android/api_levels.go
index 9bc7e83..84ab27c 100644
--- a/android/api_levels.go
+++ b/android/api_levels.go
@@ -158,6 +158,21 @@
// The first version that introduced 64-bit ABIs.
var FirstLp64Version = uncheckedFinalApiLevel(21)
+// Android has had various kinds of packed relocations over the years
+// (http://b/187907243).
+//
+// API level 30 is where the now-standard SHT_RELR is available.
+var FirstShtRelrVersion = uncheckedFinalApiLevel(30)
+
+// API level 28 introduced SHT_RELR when it was still Android-only, and used an
+// Android-specific relocation.
+var FirstAndroidRelrVersion = uncheckedFinalApiLevel(28)
+
+// API level 23 was when we first had the Chrome relocation packer, which is
+// obsolete and has been removed, but lld can now generate compatible packed
+// relocations itself.
+var FirstPackedRelocationsVersion = uncheckedFinalApiLevel(23)
+
// The first API level that does not require NDK code to link
// libandroid_support.
var FirstNonLibAndroidSupportVersion = uncheckedFinalApiLevel(21)
diff --git a/cc/linker.go b/cc/linker.go
index a9930ad..196806d 100644
--- a/cc/linker.go
+++ b/cc/linker.go
@@ -18,7 +18,6 @@
"android/soong/android"
"android/soong/cc/config"
"fmt"
- "strconv"
"github.com/google/blueprint"
"github.com/google/blueprint/proptools"
@@ -390,17 +389,17 @@
}
// Check whether the SDK version is not older than the specific one
-func CheckSdkVersionAtLeast(ctx ModuleContext, SdkVersion int) bool {
- if ctx.sdkVersion() == "current" {
+func CheckSdkVersionAtLeast(ctx ModuleContext, SdkVersion android.ApiLevel) bool {
+ if ctx.minSdkVersion() == "current" {
return true
}
- parsedSdkVersion, err := strconv.Atoi(ctx.sdkVersion())
+ parsedSdkVersion, err := android.ApiLevelFromUser(ctx, ctx.minSdkVersion())
if err != nil {
- ctx.PropertyErrorf("sdk_version",
- "Invalid sdk_version value (must be int or current): %q",
- ctx.sdkVersion())
+ ctx.PropertyErrorf("min_sdk_version",
+ "Invalid min_sdk_version value (must be int or current): %q",
+ ctx.minSdkVersion())
}
- if parsedSdkVersion < SdkVersion {
+ if parsedSdkVersion.LessThan(SdkVersion) {
return false
}
return true
@@ -425,13 +424,13 @@
// ANDROID_RELR relocations were supported at API level >= 28.
// Relocation packer was supported at API level >= 23.
// Do the best we can...
- if !ctx.useSdk() || CheckSdkVersionAtLeast(ctx, 30) {
+ if !ctx.useSdk() || CheckSdkVersionAtLeast(ctx, android.FirstShtRelrVersion) {
flags.Global.LdFlags = append(flags.Global.LdFlags, "-Wl,--pack-dyn-relocs=android+relr")
- } else if CheckSdkVersionAtLeast(ctx, 28) {
+ } else if CheckSdkVersionAtLeast(ctx, android.FirstAndroidRelrVersion) {
flags.Global.LdFlags = append(flags.Global.LdFlags,
"-Wl,--pack-dyn-relocs=android+relr",
"-Wl,--use-android-relr-tags")
- } else if CheckSdkVersionAtLeast(ctx, 23) {
+ } else if CheckSdkVersionAtLeast(ctx, android.FirstPackedRelocationsVersion) {
flags.Global.LdFlags = append(flags.Global.LdFlags, "-Wl,--pack-dyn-relocs=android")
}
}
diff --git a/cc/test.go b/cc/test.go
index d4c23d7..047a69e 100644
--- a/cc/test.go
+++ b/cc/test.go
@@ -48,12 +48,19 @@
Unit_test *bool
// Add ShippingApiLevelModuleController to auto generated test config. If the device properties
- // for the shipping api level is less than the test_min_api_level, skip this module.
- Test_min_api_level *int64
+ // for the shipping api level is less than the min_shipping_api_level, skip this module.
+ Min_shipping_api_level *int64
+
+ // Add ShippingApiLevelModuleController to auto generated test config. If any of the device
+ // shipping api level and vendor api level properties are less than the
+ // vsr_min_shipping_api_level, skip this module.
+ // As this includes the shipping api level check, it is not allowed to define
+ // min_shipping_api_level at the same time with this property.
+ Vsr_min_shipping_api_level *int64
// Add MinApiLevelModuleController with ro.vndk.version property. If ro.vndk.version has an
- // integer value and the value is less than the test_min_vndk_version, skip this module.
- Test_min_vndk_version *int64
+ // integer value and the value is less than the min_vndk_version, skip this module.
+ Min_vndk_version *int64
}
type TestBinaryProperties struct {
@@ -97,7 +104,7 @@
// Add ShippingApiLevelModuleController to auto generated test config. If the device properties
// for the shipping api level is less than the test_min_api_level, skip this module.
- // Deprecated (b/187258404). Use test_options.test_min_api_level instead.
+ // Deprecated (b/187258404). Use test_options.min_shipping_api_level instead.
Test_min_api_level *int64
// Flag to indicate whether or not to create test config automatically. If AndroidTest.xml
@@ -404,19 +411,30 @@
for _, tag := range test.Properties.Test_options.Test_suite_tag {
configs = append(configs, tradefed.Option{Name: "test-suite-tag", Value: tag})
}
- if test.Properties.Test_options.Test_min_api_level != nil {
+ if test.Properties.Test_options.Min_shipping_api_level != nil {
+ if test.Properties.Test_options.Vsr_min_shipping_api_level != nil {
+ ctx.PropertyErrorf("test_options.min_shipping_api_level", "must not be set at the same time as 'vsr_min_shipping_api_level'.")
+ }
var options []tradefed.Option
- options = append(options, tradefed.Option{Name: "min-api-level", Value: strconv.FormatInt(int64(*test.Properties.Test_options.Test_min_api_level), 10)})
+ options = append(options, tradefed.Option{Name: "min-api-level", Value: strconv.FormatInt(int64(*test.Properties.Test_options.Min_shipping_api_level), 10)})
configs = append(configs, tradefed.Object{"module_controller", "com.android.tradefed.testtype.suite.module.ShippingApiLevelModuleController", options})
} else if test.Properties.Test_min_api_level != nil {
// TODO: (b/187258404) Remove test.Properties.Test_min_api_level
+ if test.Properties.Test_options.Vsr_min_shipping_api_level != nil {
+ ctx.PropertyErrorf("test_min_api_level", "must not be set at the same time as 'vsr_min_shipping_api_level'.")
+ }
var options []tradefed.Option
options = append(options, tradefed.Option{Name: "min-api-level", Value: strconv.FormatInt(int64(*test.Properties.Test_min_api_level), 10)})
configs = append(configs, tradefed.Object{"module_controller", "com.android.tradefed.testtype.suite.module.ShippingApiLevelModuleController", options})
}
- if test.Properties.Test_options.Test_min_vndk_version != nil {
+ if test.Properties.Test_options.Vsr_min_shipping_api_level != nil {
var options []tradefed.Option
- options = append(options, tradefed.Option{Name: "min-api-level", Value: strconv.FormatInt(int64(*test.Properties.Test_options.Test_min_vndk_version), 10)})
+ options = append(options, tradefed.Option{Name: "vsr-min-api-level", Value: strconv.FormatInt(int64(*test.Properties.Test_options.Vsr_min_shipping_api_level), 10)})
+ configs = append(configs, tradefed.Object{"module_controller", "com.android.tradefed.testtype.suite.module.ShippingApiLevelModuleController", options})
+ }
+ if test.Properties.Test_options.Min_vndk_version != nil {
+ var options []tradefed.Option
+ options = append(options, tradefed.Option{Name: "min-api-level", Value: strconv.FormatInt(int64(*test.Properties.Test_options.Min_vndk_version), 10)})
options = append(options, tradefed.Option{Name: "api-level-prop", Value: "ro.vndk.version"})
configs = append(configs, tradefed.Object{"module_controller", "com.android.tradefed.testtype.suite.module.MinApiLevelModuleController", options})
}