diff options
author | 2023-01-31 23:13:45 +0000 | |
---|---|---|
committer | 2023-02-01 00:03:09 +0000 | |
commit | aa2aad6d0fdf0487e93169fa8476f37bdd70d649 (patch) | |
tree | ad452d7232f8d0970ee03869e4537b1c0a3a89f7 | |
parent | 6cf5e0d9cb89b909b5087d4057e6f09e4d093f85 (diff) |
Stop ignoring the targetSdkVersion when it includes the API fingerprint SHA
Change https://r.android.com/1959021 introduced a regression in the
handling of the `targetSdkVersion` when using the API fingerprint.
Prior to that change, when `UseApiFingerprint(ctx)` returned true that
would cause all APKs (apart from `framework-res`) that were built to
use a `targetSdkVersion` that included the API fingerprint SHA. After
that change the `UseApiFingerprint(ctx)` had no effect on the setting
of `targetSdkVersion`.
This change corrects that.
Bug: 266899206
Test: UNBUNDLED_BUILD_SDKS_FROM_SOURCE=true UNBUNDLED_BUILD_TARGET_SDK_WITH_API_FINGERPRINT=true TARGET_BUILD_APPS="NetworkStack" m
aapt2 dump badging out/target/product/generic/system/priv-app/NetworkStack/NetworkStack.apk
# Run above before and after this change and see that the targetSdkVersion
# has changed to `UpsideDownCake.<SHA>`.
Change-Id: Ic6e1da552c565cc4bd75cc734b3acb7faec67981
-rw-r--r-- | java/android_manifest.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/java/android_manifest.go b/java/android_manifest.go index c7853103f..f6457a096 100644 --- a/java/android_manifest.go +++ b/java/android_manifest.go @@ -149,13 +149,14 @@ func ManifestFixer(ctx android.ModuleContext, manifest android.Path, if params.SdkContext != nil { targetSdkVersion := targetSdkVersionForManifestFixer(ctx, params) - args = append(args, "--targetSdkVersion ", targetSdkVersion) if UseApiFingerprint(ctx) && ctx.ModuleName() != "framework-res" { targetSdkVersion = ctx.Config().PlatformSdkCodename() + fmt.Sprintf(".$$(cat %s)", ApiFingerprintPath(ctx).String()) deps = append(deps, ApiFingerprintPath(ctx)) } + args = append(args, "--targetSdkVersion ", targetSdkVersion) + minSdkVersion, err := params.SdkContext.MinSdkVersion(ctx).EffectiveVersionString(ctx) if err != nil { ctx.ModuleErrorf("invalid minSdkVersion: %s", err) |