Use fingerprint when min_sdk is current or none

We have versions of the same apex targetting different min_sdk_versions;
however, fingerprint is overriding the hardcoded min_sdk_version. We
should only be overriding if it is current or unset.

Test: go test apex soong tests
Change-Id: Id030a5ba7d8edebb806ce83d318132fd839a00a5
This commit is contained in:
Liz Kammer
2021-05-27 14:28:27 -04:00
parent f6840284b6
commit 4854a7d2cb
2 changed files with 78 additions and 4 deletions

View File

@@ -602,6 +602,11 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
// codename
if moduleMinSdkVersion.IsCurrent() || moduleMinSdkVersion.IsNone() {
minSdkVersion = ctx.Config().DefaultAppTargetSdk(ctx).String()
if java.UseApiFingerprint(ctx) {
minSdkVersion = ctx.Config().PlatformSdkCodename() + fmt.Sprintf(".$$(cat %s)", java.ApiFingerprintPath(ctx).String())
implicitInputs = append(implicitInputs, java.ApiFingerprintPath(ctx))
}
}
// apex module doesn't have a concept of target_sdk_version, hence for the time
// being targetSdkVersion == default targetSdkVersion of the branch.
@@ -611,10 +616,6 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
targetSdkVersion = ctx.Config().PlatformSdkCodename() + fmt.Sprintf(".$$(cat %s)", java.ApiFingerprintPath(ctx).String())
implicitInputs = append(implicitInputs, java.ApiFingerprintPath(ctx))
}
if java.UseApiFingerprint(ctx) {
minSdkVersion = ctx.Config().PlatformSdkCodename() + fmt.Sprintf(".$$(cat %s)", java.ApiFingerprintPath(ctx).String())
implicitInputs = append(implicitInputs, java.ApiFingerprintPath(ctx))
}
optFlags = append(optFlags, "--target_sdk_version "+targetSdkVersion)
optFlags = append(optFlags, "--min_sdk_version "+minSdkVersion)