diff options
author | 2023-07-14 16:23:39 -0700 | |
---|---|---|
committer | 2023-08-29 11:18:44 -0700 | |
commit | 6158528e152304f1259e31ff343358ff0f50c0e4 (patch) | |
tree | 12db2727afc7948f1cc810b7c9d9c5a1ae8daf2d /java/builder.go | |
parent | 4e6c42d417c41f91f60333dad0974d7bfb7f5ae2 (diff) |
Only allow setting presigned without preprocessed on targetSdk < 30
When targetSdk is >= 30, the system verifies that you use a valid
signature V2+ certificate. Uncompressing ndk/dex files or aligning
the zip file will break a signature V2, so these apks should really
just set preprocessed: true.
Fixes: 185811447
Test: Presubmits
Change-Id: Id89c42bcd5b5daa6eda1716bff4023423298036b
Diffstat (limited to 'java/builder.go')
-rw-r--r-- | java/builder.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/java/builder.go b/java/builder.go index debf49a00..bf919175d 100644 --- a/java/builder.go +++ b/java/builder.go @@ -277,6 +277,14 @@ var ( Command: `${config.Zip2ZipCmd} -i ${in} -o ${out} -x 'META-INF/services/**/*'`, CommandDeps: []string{"${config.Zip2ZipCmd}"}, }) + + checkBelowTargetSdk30ForNonPreprocessedApks = pctx.AndroidStaticRule("checkBelowTargetSdk30ForNonPreprocessedApks", + blueprint.RuleParams{ + Command: "build/soong/scripts/check_target_sdk_less_than_30.py ${config.Aapt2Cmd} $in $out", + CommandDeps: []string{"build/soong/scripts/check_target_sdk_less_than_30.py", "${config.Aapt2Cmd}"}, + Description: "Check prebuilt target sdk version", + }, + ) ) func init() { @@ -689,12 +697,13 @@ func GenerateMainClassManifest(ctx android.ModuleContext, outputFile android.Wri android.WriteFileRule(ctx, outputFile, "Main-Class: "+mainClass+"\n") } -func TransformZipAlign(ctx android.ModuleContext, outputFile android.WritablePath, inputFile android.Path) { +func TransformZipAlign(ctx android.ModuleContext, outputFile android.WritablePath, inputFile android.Path, validations android.Paths) { ctx.Build(pctx, android.BuildParams{ Rule: zipalign, Description: "align", Input: inputFile, Output: outputFile, + Validations: validations, }) } |