From 78ec5d8d6c2ca0cef1546ed1436a5cf77056a300 Mon Sep 17 00:00:00 2001 From: Jaewoong Jung Date: Fri, 31 Jan 2020 10:11:47 -0800 Subject: [PATCH] Export the cert path for runtime_resource_overlay. Fixes: 119811120 Test: app_test.go Test: Converted and built IconPackFilledSystemUIOverlay Change-Id: I3f7eae3127996773c5abf9f9bdb9d57a198ddaa3 --- java/androidmk.go | 3 ++- java/app.go | 3 +++ java/app_test.go | 9 +++++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/java/androidmk.go b/java/androidmk.go index 6d4d40bf6..d76e29b21 100644 --- a/java/androidmk.go +++ b/java/androidmk.go @@ -341,7 +341,7 @@ func (app *AndroidApp) AndroidMkEntries() []android.AndroidMkEntries { entries.SetBoolIfTrue("LOCAL_PRIVILEGED_MODULE", app.Privileged()) - entries.SetPath("LOCAL_CERTIFICATE", app.certificate.Pem) + entries.SetString("LOCAL_CERTIFICATE", app.certificate.AndroidMkString()) entries.AddStrings("LOCAL_OVERRIDES_PACKAGES", app.getOverriddenPackages()...) for _, jniLib := range app.installJniLibs { @@ -699,6 +699,7 @@ func (r *RuntimeResourceOverlay) AndroidMkEntries() []android.AndroidMkEntries { Include: "$(BUILD_SYSTEM)/soong_app_prebuilt.mk", ExtraEntries: []android.AndroidMkExtraEntriesFunc{ func(entries *android.AndroidMkEntries) { + entries.SetString("LOCAL_CERTIFICATE", r.certificate.AndroidMkString()) entries.SetPath("LOCAL_MODULE_PATH", r.installDir.ToMakePath()) }, }, diff --git a/java/app.go b/java/app.go index a27996c14..6e0ffeb67 100755 --- a/java/app.go +++ b/java/app.go @@ -1243,6 +1243,8 @@ type RuntimeResourceOverlay struct { properties RuntimeResourceOverlayProperties + certificate Certificate + outputFile android.Path installDir android.InstallPath } @@ -1288,6 +1290,7 @@ func (r *RuntimeResourceOverlay) GenerateAndroidBuildActions(ctx android.ModuleC certificates = processMainCert(r.ModuleBase, String(r.properties.Certificate), certificates, ctx) signed := android.PathForModuleOut(ctx, "signed", r.Name()+".apk") SignAppPackage(ctx, signed, r.aapt.exportPackage, certificates) + r.certificate = certificates[0] r.outputFile = signed r.installDir = android.PathForModuleInstall(ctx, "overlay", String(r.properties.Theme)) diff --git a/java/app_test.go b/java/app_test.go index 2682682cf..c20a8e7a9 100644 --- a/java/app_test.go +++ b/java/app_test.go @@ -2242,10 +2242,15 @@ func TestRuntimeResourceOverlay(t *testing.T) { if expected != signingFlag { t.Errorf("Incorrect signing flags, expected: %q, got: %q", expected, signingFlag) } + path := android.AndroidMkEntriesForTest(t, config, "", m.Module())[0].EntryMap["LOCAL_CERTIFICATE"] + expectedPath := []string{"build/make/target/product/security/platform.x509.pem"} + if !reflect.DeepEqual(path, expectedPath) { + t.Errorf("Unexpected LOCAL_CERTIFICATE value: %v, expected: %v", path, expectedPath) + } // Check device location. - path := android.AndroidMkEntriesForTest(t, config, "", m.Module())[0].EntryMap["LOCAL_MODULE_PATH"] - expectedPath := []string{"/tmp/target/product/test_device/product/overlay"} + path = android.AndroidMkEntriesForTest(t, config, "", m.Module())[0].EntryMap["LOCAL_MODULE_PATH"] + expectedPath = []string{"/tmp/target/product/test_device/product/overlay"} if !reflect.DeepEqual(path, expectedPath) { t.Errorf("Unexpected LOCAL_MODULE_PATH value: %v, expected: %v", path, expectedPath) }