aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2023-07-10 15:15:27 -0700
committerIvan Chiang <chiangi@google.com>2024-02-29 04:15:27 +0000
commit2150160d8f59cb827fdd92b5f830cd2085dd3e95 (patch)
tree5899edcfb13ba2a2185334fd1c7fbb56ca085bdc
parent955f87b65a092f3606421badd6baff22852d2140 (diff)
Copy imported APKs to output filename
android_app_import and android_test_import modules with processed: true and skip_preprocessed_apk_checks are used directly from the source tree. If the source file name doesn t match the module name and the file is used as test data it can result in the wrong filename being used. Copy the source file to an output file with the correct name first. Bug: 290376750 Test: m CtsAppSecurityHostTestCases (cherry picked from https://android-review.googlesource.com/q/commit:5780d57a7116643c6d9eac735982ac44bd6b0189) Merged-In: I4a6dd1c5e48db7085ea41035def31f0844948a46 Change-Id: I4a6dd1c5e48db7085ea41035def31f0844948a46
-rw-r--r--java/app_import.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/java/app_import.go b/java/app_import.go
index 4a4c57a9f..9aa112470 100644
--- a/java/app_import.go
+++ b/java/app_import.go
@@ -319,7 +319,16 @@ func (a *AndroidAppImport) generateAndroidBuildActions(ctx android.ModuleContext
// Sign or align the package if package has not been preprocessed
if a.preprocessed {
- a.outputFile = srcApk
+ var output android.WritablePath
+ // If using the input APK unmodified, still make a copy of it so that the output filename has the
+ // right basename.
+ output = android.PathForModuleOut(ctx, apkFilename)
+ ctx.Build(pctx, android.BuildParams{
+ Rule: android.Cp,
+ Input: srcApk,
+ Output: output,
+ })
+ a.outputFile = output
a.certificate = PresignedCertificate
} else if !Bool(a.properties.Presigned) {
// If the certificate property is empty at this point, default_dev_cert must be set to true.