From 98410fd9d66a3717a1b0d52b68071821d11e6302 Mon Sep 17 00:00:00 2001 From: Dario Freni Date: Mon, 27 Apr 2020 18:21:11 +0100 Subject: [PATCH] Allow building unsigned APEXs payload for testing. Bug: 148447155 Test: built a testing apex with unsigned payload. Change-Id: I95aa3f11ff1adc1421fcd7ed5a356ee531a0a818 --- apex/apex.go | 8 ++++++++ apex/builder.go | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/apex/apex.go b/apex/apex.go index 07253c1cf..774289d02 100644 --- a/apex/apex.go +++ b/apex/apex.go @@ -1106,6 +1106,10 @@ type apexBundleProperties struct { // Should be only used in tests#. Test_only_no_hashtree *bool + // Whenever apex_payload.img of the APEX should not be dm-verity signed. + // Should be only used in tests#. + Test_only_unsigned_payload *bool + IsCoverageVariant bool `blueprint:"mutated"` // Whether this APEX is considered updatable or not. When set to true, this will enforce additional @@ -1595,6 +1599,10 @@ func (a *apexBundle) testOnlyShouldSkipHashtreeGeneration() bool { return proptools.Bool(a.properties.Test_only_no_hashtree) } +func (a *apexBundle) testOnlyShouldSkipPayloadSign() bool { + return proptools.Bool(a.properties.Test_only_unsigned_payload) +} + func (a *apexBundle) getImageVariation(config android.DeviceConfig) string { if a.vndkApex { return cc.VendorVariationPrefix + a.vndkVersion(config) diff --git a/apex/builder.go b/apex/builder.go index f84d426b3..9ef1e0d86 100644 --- a/apex/builder.go +++ b/apex/builder.go @@ -484,6 +484,10 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) { optFlags = append(optFlags, "--no_hashtree") } + if a.testOnlyShouldSkipPayloadSign() { + optFlags = append(optFlags, "--unsigned_payload") + } + if a.properties.Apex_name != nil { // If apex_name is set, apexer can skip checking if key name matches with apex name. // Note that apex_manifest is also mended.