From 131a5a13fef16a0f4e5568adcd6998b8a0075d57 Mon Sep 17 00:00:00 2001 From: Kun Niu Date: Tue, 7 Dec 2021 19:27:34 +0000 Subject: [PATCH] Revert "Set targetsdkversion to future level if TARGET_BUILD_APPS is not empty" This reverts commit e33e25b4a5260994e05afb381e7da1eb09e6dbf2. Reason for revert: may causing b/209301265, Test: https://android-build.googleplex.com/builds/abtd/run/L66400000952203490 Change-Id: Ifcccdcfbfc014d4172f4d9488ea699380d3f3ebe --- java/android_manifest.go | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/java/android_manifest.go b/java/android_manifest.go index 3a1f5fcb1..38065f153 100644 --- a/java/android_manifest.go +++ b/java/android_manifest.go @@ -16,7 +16,6 @@ package java import ( "fmt" - "strconv" "strings" "github.com/google/blueprint" @@ -43,20 +42,6 @@ var manifestMergerRule = pctx.AndroidStaticRule("manifestMerger", }, "args", "libs") -// targetSdkVersion for manifest_fixer -// When TARGET_BUILD_APPS is not empty, this method returns the unreleased(future) API level -// This enables release builds (that run with TARGET_BUILD_APPS=[val...]) to target APIs that have not yet been finalized as part of an SDK -func targetSdkVersionForManifestFixer(ctx android.ModuleContext, sdkContext android.SdkContext) string { - if ctx.Config().UnbundledBuildApps() { - return strconv.Itoa(android.FutureApiLevel.FinalOrFutureInt()) - } - targetSdkVersion, err := sdkContext.TargetSdkVersion(ctx).EffectiveVersionString(ctx) - if err != nil { - ctx.ModuleErrorf("invalid targetSdkVersion: %s", err) - } - return targetSdkVersion -} - // Uses manifest_fixer.py to inject minSdkVersion, etc. into an AndroidManifest.xml func manifestFixer(ctx android.ModuleContext, manifest android.Path, sdkContext android.SdkContext, classLoaderContexts dexpreopt.ClassLoaderContextMap, isLibrary, useEmbeddedNativeLibs, usesNonSdkApis, @@ -104,7 +89,10 @@ func manifestFixer(ctx android.ModuleContext, manifest android.Path, sdkContext args = append(args, "--logging-parent", loggingParent) } var deps android.Paths - targetSdkVersion := targetSdkVersionForManifestFixer(ctx, sdkContext) + targetSdkVersion, err := sdkContext.TargetSdkVersion(ctx).EffectiveVersionString(ctx) + if err != nil { + ctx.ModuleErrorf("invalid targetSdkVersion: %s", err) + } if UseApiFingerprint(ctx) && ctx.ModuleName() != "framework-res" { targetSdkVersion = ctx.Config().PlatformSdkCodename() + fmt.Sprintf(".$$(cat %s)", ApiFingerprintPath(ctx).String()) deps = append(deps, ApiFingerprintPath(ctx))