apex_sets is added to apexkeys.txt

apex_sets is a new module type that can be used to deliver pre-signed
APEXes, which previously could be done only via prebuilt_apex.

Soon gnow understands apex_sets module types and emits the signing info
of the modules to apexkeys.txt

Exempt-From-Owner-Approval: cherry-pic from AOSP

Bug: 158729168
Test: m
Merged-In: I9507375342ec053309660d94c931a79bf4f21218
(cherry picked from commit 8d6c51ebcc)
Change-Id: I9507375342ec053309660d94c931a79bf4f21218
This commit is contained in:
Jiyong Park
2020-06-12 17:26:31 +09:00
parent 78bb73972d
commit 8d6286befe
3 changed files with 100 additions and 21 deletions

View File

@@ -231,6 +231,7 @@ func testApexContext(_ *testing.T, bp string, handlers ...testCustomizer) (*andr
java.RegisterSystemModulesBuildComponents(ctx)
java.RegisterAppBuildComponents(ctx)
java.RegisterSdkLibraryBuildComponents(ctx)
ctx.RegisterSingletonType("apex_keys_text", apexKeysTextFactory)
ctx.PreDepsMutators(RegisterPreDepsMutators)
ctx.PostDepsMutators(RegisterPostDepsMutators)
@@ -4950,6 +4951,46 @@ func TestApexSet(t *testing.T) {
}
}
func TestApexKeysTxt(t *testing.T) {
ctx, _ := testApex(t, `
apex {
name: "myapex",
key: "myapex.key",
}
apex_key {
name: "myapex.key",
public_key: "testkey.avbpubkey",
private_key: "testkey.pem",
}
prebuilt_apex {
name: "myapex",
prefer: true,
arch: {
arm64: {
src: "myapex-arm64.apex",
},
arm: {
src: "myapex-arm.apex",
},
},
}
apex_set {
name: "myapex_set",
set: "myapex.apks",
filename: "myapex_set.apex",
overrides: ["myapex"],
}
`)
apexKeysText := ctx.SingletonForTests("apex_keys_text")
content := apexKeysText.MaybeDescription("apexkeys.txt").BuildParams.Args["content"]
ensureContains(t, content, `name="myapex_set.apex" public_key="PRESIGNED" private_key="PRESIGNED" container_certificate="PRESIGNED" container_private_key="PRESIGNED" partition="system"`)
ensureNotContains(t, content, "myapex.apex")
}
func TestMain(m *testing.M) {
run := func() int {
setUp()