Set LOCAL_CERTIFICATE for flattened apex APKs
Leaving out LOCAL_CERTIFICATE for flattened apex APKs causes
the apkcerts.txt to have empty keys for those APKs, which
confuses the signing tools. Set LOCAL_CERTIFICATE for them.
Also refactor the Certificate support to avoid introducing
duplicated handling for presigned certificates.
Bug: 147765187
Test: m apkcerts-list
Change-Id: Ife07661761cd5a89c9f009b8ce041db4dff9ec54
diff --git a/apex/apex.go b/apex/apex.go
index ae93790..48cdedf 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -709,7 +709,8 @@
targetRequiredModuleNames []string
hostRequiredModuleNames []string
- jacocoReportClassesFile android.Path // only for javalibs and apps
+ jacocoReportClassesFile android.Path // only for javalibs and apps
+ certificate java.Certificate // only for apps
}
func newApexFile(ctx android.BaseModuleContext, builtFile android.Path, moduleName string, installDir string, class apexFileClass, module android.Module) apexFile {
@@ -1198,6 +1199,7 @@
Privileged() bool
OutputFile() android.Path
JacocoReportClassesFile() android.Path
+ Certificate() java.Certificate
}, pkgName string) apexFile {
appDir := "app"
if aapp.Privileged() {
@@ -1207,6 +1209,7 @@
fileToCopy := aapp.OutputFile()
af := newApexFile(ctx, fileToCopy, aapp.Name(), dirInApex, app, aapp)
af.jacocoReportClassesFile = aapp.JacocoReportClassesFile()
+ af.certificate = aapp.Certificate()
return af
}