Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 131a5a13 authored by Kun Niu's avatar Kun Niu
Browse files

Revert "Set targetsdkversion to future level if TARGET_BUILD_APPS is not empty"

This reverts commit e33e25b4.

Reason for revert: may causing b/209301265,
Test: https://android-build.googleplex.com/builds/abtd/run/L66400000952203490
Change-Id: Ifcccdcfbfc014d4172f4d9488ea699380d3f3ebe
parent e33e25b4
Loading
Loading
Loading
Loading
+4 −16
Original line number Diff line number Diff line
@@ -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))