Allow java_sdk_library in an APEX to have higher min_sdk_version.
Inidividual boot or system server jars may have higher min_sdk_version
than the contianing apex, since the runtime respects the values of
min/max_sdk_version; e.g. runtime would not load a boot jar with
higher min_sdk_version. This allows shipping new boot jars via apexes
that target older platforms.
Bug: 190818041
Test: presubmit
Change-Id: I08ec0b4463a17bc8265b948fe09da55eb4e52ac3
Merged-In: I08ec0b4463a17bc8265b948fe09da55eb4e52ac3
(cherry picked from commit 758968a70081ee5d299452008e25cd75eead742b)
diff --git a/java/base.go b/java/base.go
index 4caca31..4780cc9 100644
--- a/java/base.go
+++ b/java/base.go
@@ -1500,8 +1500,7 @@
}
// Implements android.ApexModule
-func (j *Module) ShouldSupportSdkVersion(ctx android.BaseModuleContext,
- sdkVersion android.ApiLevel) error {
+func (j *Module) ShouldSupportSdkVersion(ctx android.BaseModuleContext, sdkVersion android.ApiLevel) error {
sdkSpec := j.MinSdkVersion(ctx)
if !sdkSpec.Specified() {
return fmt.Errorf("min_sdk_version is not specified")
diff --git a/java/sdk_library.go b/java/sdk_library.go
index dbb97c8..c6747c7 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -1122,6 +1122,8 @@
return generatedScopes
}
+var _ android.ModuleWithMinSdkVersionCheck = (*SdkLibrary)(nil)
+
func (module *SdkLibrary) CheckMinSdkVersion(ctx android.ModuleContext) {
android.CheckMinSdkVersion(ctx, module.MinSdkVersion(ctx).ApiLevel, func(c android.ModuleContext, do android.PayloadDepsCallback) {
ctx.WalkDeps(func(child android.Module, parent android.Module) bool {