apex: support prebuilt_firmware for vendor apexes

prebuilt_firmware module is one of many prebuilt_etc-like modules. When
it is soc-specific, it is installed in /vendor/firmware. Similarly, when
prebuilt_firmware is embeded in a vendor apex, installing it in
<apex>/firmware instead of <apex>/etc.

Bug: 162701747
Test: lunch sunfish-userdebug
      m && device boots && vibrator works
Change-Id: I00d28cde42259aaf8221e3897df77efc42b0c1ca
This commit is contained in:
Jooyung Han
2020-08-26 22:11:53 +09:00
parent 588aae727b
commit 0703fd873f
5 changed files with 64 additions and 18 deletions

View File

@@ -248,7 +248,7 @@ func testApexContext(_ *testing.T, bp string, handlers ...testCustomizer) (*andr
ctx.RegisterModuleType("cc_test", cc.TestFactory)
ctx.RegisterModuleType("vndk_prebuilt_shared", cc.VndkPrebuiltSharedFactory)
ctx.RegisterModuleType("vndk_libraries_txt", cc.VndkLibrariesTxtFactory)
ctx.RegisterModuleType("prebuilt_etc", prebuilt_etc.PrebuiltEtcFactory)
prebuilt_etc.RegisterPrebuiltEtcBuildComponents(ctx)
ctx.RegisterModuleType("platform_compat_config", java.PlatformCompatConfigFactory)
ctx.RegisterModuleType("sh_binary", sh.ShBinaryFactory)
ctx.RegisterModuleType("filegroup", android.FileGroupFactory)
@@ -2272,6 +2272,32 @@ func TestVendorApex_use_vndk_as_stable(t *testing.T) {
ensureListContains(t, requireNativeLibs, ":vndk")
}
func TestVendorApex_withPrebuiltFirmware(t *testing.T) {
ctx, _ := testApex(t, `
apex {
name: "myapex",
key: "myapex.key",
prebuilts: ["myfirmware"],
vendor: true,
}
apex_key {
name: "myapex.key",
public_key: "testkey.avbpubkey",
private_key: "testkey.pem",
}
prebuilt_firmware {
name: "myfirmware",
src: "myfirmware.bin",
filename_from_src: true,
vendor: true,
}
`)
ensureExactContents(t, ctx, "myapex", "android_common_myapex_image", []string{
"firmware/myfirmware.bin",
})
}
func TestAndroidMk_UseVendorRequired(t *testing.T) {
ctx, config := testApex(t, `
apex {