Merge "Use MinApiForArch to set minSdkVersion for apexes"
This commit is contained in:
commit
ec731a83e3
2 changed files with 17 additions and 10 deletions
23
apex/apex.go
23
apex/apex.go
|
@ -2735,16 +2735,23 @@ func (a *apexBundle) minSdkVersionValue(ctx android.EarlyModuleContext) string {
|
|||
// Only override the minSdkVersion value on Apexes which already specify
|
||||
// a min_sdk_version (it's optional for non-updatable apexes), and that its
|
||||
// min_sdk_version value is lower than the one to override with.
|
||||
overrideMinSdkValue := ctx.DeviceConfig().ApexGlobalMinSdkVersionOverride()
|
||||
overrideApiLevel := minSdkVersionFromValue(ctx, overrideMinSdkValue)
|
||||
originalMinApiLevel := minSdkVersionFromValue(ctx, proptools.String(a.properties.Min_sdk_version))
|
||||
isMinSdkSet := a.properties.Min_sdk_version != nil
|
||||
isOverrideValueHigher := overrideApiLevel.CompareTo(originalMinApiLevel) > 0
|
||||
if overrideMinSdkValue != "" && isMinSdkSet && isOverrideValueHigher {
|
||||
return overrideMinSdkValue
|
||||
minApiLevel := minSdkVersionFromValue(ctx, proptools.String(a.properties.Min_sdk_version))
|
||||
if minApiLevel.IsNone() {
|
||||
return ""
|
||||
}
|
||||
|
||||
return proptools.String(a.properties.Min_sdk_version)
|
||||
archMinApiLevel := cc.MinApiForArch(ctx, a.MultiTargets()[0].Arch.ArchType)
|
||||
if !archMinApiLevel.IsNone() && archMinApiLevel.CompareTo(minApiLevel) > 0 {
|
||||
minApiLevel = archMinApiLevel
|
||||
}
|
||||
|
||||
overrideMinSdkValue := ctx.DeviceConfig().ApexGlobalMinSdkVersionOverride()
|
||||
overrideApiLevel := minSdkVersionFromValue(ctx, overrideMinSdkValue)
|
||||
if !overrideApiLevel.IsNone() && overrideApiLevel.CompareTo(minApiLevel) > 0 {
|
||||
minApiLevel = overrideApiLevel
|
||||
}
|
||||
|
||||
return minApiLevel.String()
|
||||
}
|
||||
|
||||
// Returns apex's min_sdk_version SdkSpec, honoring overrides
|
||||
|
|
|
@ -20,7 +20,7 @@ import (
|
|||
"android/soong/android"
|
||||
)
|
||||
|
||||
func minApiForArch(ctx android.BaseModuleContext,
|
||||
func MinApiForArch(ctx android.EarlyModuleContext,
|
||||
arch android.ArchType) android.ApiLevel {
|
||||
|
||||
switch arch {
|
||||
|
@ -38,7 +38,7 @@ func minApiForArch(ctx android.BaseModuleContext,
|
|||
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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue