Support min_sdk_version overrides in apps

This replaces the global override of min_sdk_version (via
`APEX_GLOBAL_MIN_SDK_VERSION_OVERRIDE`) with an min_sdk_version override
that can be set by each individual soong override_app.

The use case for this are go apps which are only installed in T and
above, even though the base AOSP apexes might be installable on < T
devices.

Test: added a unit test

Bug: 295311875
Change-Id: Ie2e738a6786bb24417c675617f7c78358017c96c
This commit is contained in:
Spandan Das
2024-05-13 18:29:45 +00:00
parent 229b0098bd
commit b9c58350ca
5 changed files with 43 additions and 66 deletions

View File

@@ -909,7 +909,7 @@ func (j *Library) GenerateAndroidBuildActions(ctx android.ModuleContext) {
// Check min_sdk_version of the transitive dependencies if this module is created from
// java_sdk_library.
if j.deviceProperties.Min_sdk_version != nil && j.SdkLibraryName() != nil {
if j.overridableProperties.Min_sdk_version != nil && j.SdkLibraryName() != nil {
j.CheckDepsMinSdkVersion(ctx)
}
@@ -1097,7 +1097,7 @@ func (p *librarySdkMemberProperties) PopulateFromVariant(ctx android.SdkMemberCo
// If the min_sdk_version was set then add the canonical representation of the API level to the
// snapshot.
if j.deviceProperties.Min_sdk_version != nil {
if j.overridableProperties.Min_sdk_version != nil {
canonical, err := android.ReplaceFinalizedCodenames(ctx.SdkModuleContext().Config(), j.minSdkVersion.String())
if err != nil {
ctx.ModuleErrorf("%s", err)