Disable VNDK apexes for unsupported API levels
Disable VNDK apexes when their version is below the minimum
supported API level for the primary architecture.
Test: TestVndkApexCurrent
Change-Id: Ie72a5beb9da432660d3fec5c520402224326f961
diff --git a/cc/api_level.go b/cc/api_level.go
index fdff5cb..a5571f3 100644
--- a/cc/api_level.go
+++ b/cc/api_level.go
@@ -20,7 +20,9 @@
"android/soong/android"
)
-func minApiForArch(ctx android.EarlyModuleContext,
+// MinApiLevelForArch returns the ApiLevel for the Android version that
+// first supported the architecture.
+func MinApiForArch(ctx android.EarlyModuleContext,
arch android.ArchType) android.ApiLevel {
switch arch {
@@ -38,7 +40,7 @@
func nativeApiLevelFromUser(ctx android.BaseModuleContext,
raw string) (android.ApiLevel, error) {
- min := minApiForArch(ctx, ctx.Arch().ArchType)
+ min := MinApiForArch(ctx, ctx.Arch().ArchType)
if raw == "minimum" {
return min, nil
}
diff --git a/cc/cc.go b/cc/cc.go
index 27ea1a2..151ad9c 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -2214,7 +2214,7 @@
}
// Raise the minSdkVersion to the minimum supported for the architecture.
- minApiForArch := minApiForArch(ctx, m.Target().Arch.ArchType)
+ minApiForArch := MinApiForArch(ctx, m.Target().Arch.ArchType)
if apiLevel.LessThan(minApiForArch) {
apiLevel = minApiForArch
}
@@ -3700,7 +3700,7 @@
// This allows introducing new architectures in the platform that
// need to be included in apexes that normally require an older
// min_sdk_version.
- minApiForArch := minApiForArch(ctx, c.Target().Arch.ArchType)
+ minApiForArch := MinApiForArch(ctx, c.Target().Arch.ArchType)
if sdkVersion.LessThan(minApiForArch) {
sdkVersion = minApiForArch
}