Merge "Always use "${codename}.${sha}" if UNBUNDLED_BUILD_TARGET_SDK_WITH_API_FINGERPRINT=true" am: 643953d170

Change-Id: I0f4600c4717483c4ae2f665d8bd23abc99fa0b00
This commit is contained in:
Automerger Merge Worker 2020-03-11 20:23:23 +00:00
commit 25f0c8f21f
3 changed files with 13 additions and 17 deletions

View file

@ -453,21 +453,18 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
targetSdkVersion := ctx.Config().DefaultAppTargetSdk()
minSdkVersion := ctx.Config().DefaultAppTargetSdk()
// TODO: this should be based on min_sdk_version property of an APEX.
if proptools.Bool(a.properties.Legacy_android10_support) {
if !java.UseApiFingerprint(ctx, targetSdkVersion) {
targetSdkVersion = "29"
}
if !java.UseApiFingerprint(ctx, minSdkVersion) {
minSdkVersion = "29"
}
targetSdkVersion = "29"
minSdkVersion = "29"
}
if java.UseApiFingerprint(ctx, targetSdkVersion) {
targetSdkVersion += fmt.Sprintf(".$$(cat %s)", java.ApiFingerprintPath(ctx).String())
if java.UseApiFingerprint(ctx) {
targetSdkVersion = ctx.Config().PlatformSdkCodename() + fmt.Sprintf(".$$(cat %s)", java.ApiFingerprintPath(ctx).String())
implicitInputs = append(implicitInputs, java.ApiFingerprintPath(ctx))
}
if java.UseApiFingerprint(ctx, minSdkVersion) {
minSdkVersion += fmt.Sprintf(".$$(cat %s)", java.ApiFingerprintPath(ctx).String())
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)

View file

@ -99,8 +99,8 @@ func manifestFixer(ctx android.ModuleContext, manifest android.Path, sdkContext
if err != nil {
ctx.ModuleErrorf("invalid targetSdkVersion: %s", err)
}
if UseApiFingerprint(ctx, targetSdkVersion) {
targetSdkVersion += fmt.Sprintf(".$$(cat %s)", ApiFingerprintPath(ctx).String())
if UseApiFingerprint(ctx) {
targetSdkVersion = ctx.Config().PlatformSdkCodename() + fmt.Sprintf(".$$(cat %s)", ApiFingerprintPath(ctx).String())
deps = append(deps, ApiFingerprintPath(ctx))
}
@ -108,8 +108,8 @@ func manifestFixer(ctx android.ModuleContext, manifest android.Path, sdkContext
if err != nil {
ctx.ModuleErrorf("invalid minSdkVersion: %s", err)
}
if UseApiFingerprint(ctx, minSdkVersion) {
minSdkVersion += fmt.Sprintf(".$$(cat %s)", ApiFingerprintPath(ctx).String())
if UseApiFingerprint(ctx) {
minSdkVersion = ctx.Config().PlatformSdkCodename() + fmt.Sprintf(".$$(cat %s)", ApiFingerprintPath(ctx).String())
deps = append(deps, ApiFingerprintPath(ctx))
}

View file

@ -50,9 +50,8 @@ type sdkContext interface {
targetSdkVersion() sdkSpec
}
func UseApiFingerprint(ctx android.BaseModuleContext, v string) bool {
if v == ctx.Config().PlatformSdkCodename() &&
ctx.Config().UnbundledBuild() &&
func UseApiFingerprint(ctx android.BaseModuleContext) bool {
if ctx.Config().UnbundledBuild() &&
!ctx.Config().UnbundledBuildUsePrebuiltSdks() &&
ctx.Config().IsEnvTrue("UNBUNDLED_BUILD_TARGET_SDK_WITH_API_FINGERPRINT") {
return true