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
This commit is contained in:
Colin Cross
2020-01-28 14:00:53 -08:00
parent 5e0dbe4e3e
commit 503c1d06e8
4 changed files with 37 additions and 14 deletions

View File

@@ -709,7 +709,8 @@ type apexFile struct {
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 @@ func apexFileForAndroidApp(ctx android.BaseModuleContext, aapp interface {
Privileged() bool
OutputFile() android.Path
JacocoReportClassesFile() android.Path
Certificate() java.Certificate
}, pkgName string) apexFile {
appDir := "app"
if aapp.Privileged() {
@@ -1207,6 +1209,7 @@ func apexFileForAndroidApp(ctx android.BaseModuleContext, aapp interface {
fileToCopy := aapp.OutputFile()
af := newApexFile(ctx, fileToCopy, aapp.Name(), dirInApex, app, aapp)
af.jacocoReportClassesFile = aapp.JacocoReportClassesFile()
af.certificate = aapp.Certificate()
return af
}