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))