Add apex.use_vndk_as_stable property

Vendor APEXes(in general, APEXes for non-system partitions) which is
supposed to be tied to a specific VNDK version can set this new property
so that it excludes VNDK libs and use them from VNDK APEX (provided by
system parition).

For these APEXes to use VNDK libs from VNDK APEX, linkerconfig should
link "vndk" linker namespace to the namespaces of these APEXes.

Bug: 159195575
Test: m (soong test added)
Change-Id: If90650973239ef7aab0ff084488bda57d9b0364e
This commit is contained in:
Jooyung Han
2020-07-22 15:54:47 +09:00
parent 41b4d79dab
commit df78e216a8
2 changed files with 78 additions and 2 deletions

View File

@@ -2203,6 +2203,55 @@ func TestVendorApex(t *testing.T) {
ensureContains(t, androidMk, `LOCAL_MODULE_PATH := /tmp/target/product/test_device/vendor/apex`)
}
func TestVendorApex_use_vndk_as_stable(t *testing.T) {
ctx, _ := testApex(t, `
apex {
name: "myapex",
key: "myapex.key",
binaries: ["mybin"],
vendor: true,
use_vndk_as_stable: true,
}
apex_key {
name: "myapex.key",
public_key: "testkey.avbpubkey",
private_key: "testkey.pem",
}
cc_binary {
name: "mybin",
vendor: true,
shared_libs: ["libvndk", "libvendor"],
}
cc_library {
name: "libvndk",
vndk: {
enabled: true,
},
vendor_available: true,
}
cc_library {
name: "libvendor",
vendor: true,
}
`)
vendorVariant := "android_vendor.VER_arm64_armv8-a"
ldRule := ctx.ModuleForTests("mybin", vendorVariant+"_myapex").Rule("ld")
libs := names(ldRule.Args["libFlags"])
// VNDK libs(libvndk/libc++) as they are
ensureListContains(t, libs, buildDir+"/.intermediates/libvndk/"+vendorVariant+"_shared/libvndk.so")
ensureListContains(t, libs, buildDir+"/.intermediates/libc++/"+vendorVariant+"_shared/libc++.so")
// non-stable Vendor libs as APEX variants
ensureListContains(t, libs, buildDir+"/.intermediates/libvendor/"+vendorVariant+"_shared_myapex/libvendor.so")
// VNDK libs are not included when use_vndk_as_stable: true
ensureExactContents(t, ctx, "myapex", "android_common_myapex_image", []string{
"bin/mybin",
"lib64/libvendor.so",
})
}
func TestAndroidMk_UseVendorRequired(t *testing.T) {
ctx, config := testApex(t, `
apex {