Supports VNDK APEX with different versions

Older VNDK libraries are provided as vndk_prebuilt_shared modules. Those
are added to corresponding VNDK APEX as dependencies.

With VNDK APEX installed, VNDK libs are unnecessary. By the way, since
there can be vendor modules which depend on VNDK libs, Make targets are
still emitted with UNINSTALLABLE=true.

Android.mk has additional modules for vndk libraries which are named
with apex name as suffices. For example, if libfoo is a vndk library,
then libfoo.vendor is its vendor variant and it would be in
/system/lib/vndk. But with vndk apex, it has additional
libfoo.com.android.vndk.current variant.

Bug: 141451661
Bug: 139772411
Test: m (soong tests)
Test: boot with aosp_arm64 system image on Q vendor device
Change-Id: I269c28a4d4c4e2f1518bd51df558438fe5316774
This commit is contained in:
Jooyung Han
2019-10-07 15:34:50 +09:00
parent e04b73f100
commit 394951da73
6 changed files with 291 additions and 98 deletions

View File

@@ -93,6 +93,11 @@ func (c *Module) AndroidMk() android.AndroidMkData {
fmt.Fprintln(w, "LOCAL_USE_VNDK := true")
if c.isVndk() && !c.static() {
fmt.Fprintln(w, "LOCAL_SOONG_VNDK_VERSION := "+c.vndkVersion())
// VNDK libraries available to vendor are not installed because
// they are packaged in VNDK APEX and installed by APEX packages (apex/apex.go)
if !c.isVndkExt() {
fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := true")
}
}
}
},

View File

@@ -488,15 +488,6 @@ func (c *Module) RelativeInstallPath() string {
return ""
}
// IsVndkOnSystem returns true if a module is supposed to be a vndk library provided by system to vendor
func (c *Module) IsVndkOnSystem() bool {
if linker, ok := c.linker.(libraryInterface); ok {
return linker.shared() && c.isVndk() && c.useVndk() && !c.isVndkExt()
}
return false
}
func (c *Module) VndkVersion() string {
return c.vndkVersion()
}

View File

@@ -307,6 +307,31 @@ func processVndkLibrary(mctx android.BottomUpMutatorContext, m *Module) {
}
}
func IsForVndkApex(mctx android.BottomUpMutatorContext, m *Module) bool {
if !m.Enabled() {
return false
}
if m.Target().NativeBridge == android.NativeBridgeEnabled {
return false
}
// prebuilt vndk modules should match with device
// TODO(b/142675459): Use enabled: to select target device in vndk_prebuilt_shared
// When b/142675459 is landed, remove following check
if p, ok := m.linker.(*vndkPrebuiltLibraryDecorator); ok && !p.matchesWithDevice(mctx.DeviceConfig()) {
return false
}
if lib, ok := m.linker.(libraryInterface); ok {
useCoreVariant := m.vndkVersion() == mctx.DeviceConfig().PlatformVndkVersion() &&
mctx.DeviceConfig().VndkUseCoreVariant() &&
!inList(m.BaseModuleName(), config.VndkMustUseVendorVariantList)
return lib.shared() && m.useVndk() && m.isVndk() && !m.isVndkExt() && !useCoreVariant
}
return false
}
// gather list of vndk-core, vndk-sp, and ll-ndk libs
func VndkMutator(mctx android.BottomUpMutatorContext) {
m, ok := mctx.Module().(*Module)

View File

@@ -130,13 +130,7 @@ func (p *vndkPrebuiltLibraryDecorator) singleSourcePath(ctx ModuleContext) andro
func (p *vndkPrebuiltLibraryDecorator) link(ctx ModuleContext,
flags Flags, deps PathDeps, objs Objects) android.Path {
arches := ctx.DeviceConfig().Arches()
if len(arches) == 0 || arches[0].ArchType.String() != p.arch() {
ctx.Module().SkipInstall()
return nil
}
if ctx.DeviceConfig().BinderBitness() != p.binderBit() {
if !p.matchesWithDevice(ctx.DeviceConfig()) {
ctx.Module().SkipInstall()
return nil
}
@@ -153,6 +147,20 @@ func (p *vndkPrebuiltLibraryDecorator) link(ctx ModuleContext,
return nil
}
func (p *vndkPrebuiltLibraryDecorator) matchesWithDevice(config android.DeviceConfig) bool {
arches := config.Arches()
if len(arches) == 0 || arches[0].ArchType.String() != p.arch() {
return false
}
if config.BinderBitness() != p.binderBit() {
return false
}
if len(p.properties.Srcs) == 0 {
return false
}
return true
}
func (p *vndkPrebuiltLibraryDecorator) nativeCoverage() bool {
return false
}