Add binder32bit to vndk_prebuilt module

For a vndk_prebuilt module that was built with 32 bit binder, add
"binder32bit: true" to its Android.bp module.
This will add .binder32 suffix to the name.

Bug: 74362637
Bug: 80450527
Test: m -j vndk_snapshot_package
Change-Id: I81049adbf5e67fe5e63d5ea3a8b027aaf6eb355b
This commit is contained in:
Justin Yun 2018-06-08 15:08:40 +09:00
parent 30485c920c
commit 3e2323d202
1 changed files with 22 additions and 3 deletions

View File

@ -22,6 +22,7 @@ import (
var ( var (
vndkSuffix = ".vndk." vndkSuffix = ".vndk."
binder32Suffix = ".binder32"
) )
// Creates vndk prebuilts that include the VNDK version. // Creates vndk prebuilts that include the VNDK version.
@ -53,6 +54,10 @@ type vndkPrebuiltProperties struct {
// Target arch name of the snapshot (e.g. 'arm64' for variant 'aosp_arm64_ab') // Target arch name of the snapshot (e.g. 'arm64' for variant 'aosp_arm64_ab')
Target_arch *string Target_arch *string
// If the prebuilt snapshot lib is built with 32 bit binder, this must be set to true.
// The lib with 64 bit binder does not need to set this property.
Binder32bit *bool
// Prebuilt files for each arch. // Prebuilt files for each arch.
Srcs []string `android:"arch_variant"` Srcs []string `android:"arch_variant"`
} }
@ -67,10 +72,14 @@ func (p *vndkPrebuiltLibraryDecorator) Name(name string) string {
} }
func (p *vndkPrebuiltLibraryDecorator) NameSuffix() string { func (p *vndkPrebuiltLibraryDecorator) NameSuffix() string {
suffix := p.version()
if p.arch() != "" { if p.arch() != "" {
return vndkSuffix + p.version() + "." + p.arch() suffix += "." + p.arch()
} }
return vndkSuffix + p.version() if Bool(p.properties.Binder32bit) {
suffix += binder32Suffix
}
return vndkSuffix + suffix
} }
func (p *vndkPrebuiltLibraryDecorator) version() string { func (p *vndkPrebuiltLibraryDecorator) version() string {
@ -81,6 +90,13 @@ func (p *vndkPrebuiltLibraryDecorator) arch() string {
return String(p.properties.Target_arch) return String(p.properties.Target_arch)
} }
func (p *vndkPrebuiltLibraryDecorator) binderBit() string {
if Bool(p.properties.Binder32bit) {
return "32"
}
return "64"
}
func (p *vndkPrebuiltLibraryDecorator) linkerFlags(ctx ModuleContext, flags Flags) Flags { func (p *vndkPrebuiltLibraryDecorator) linkerFlags(ctx ModuleContext, flags Flags) Flags {
p.libraryDecorator.libName = strings.TrimSuffix(ctx.ModuleName(), p.NameSuffix()) p.libraryDecorator.libName = strings.TrimSuffix(ctx.ModuleName(), p.NameSuffix())
return p.libraryDecorator.linkerFlags(ctx, flags) return p.libraryDecorator.linkerFlags(ctx, flags)
@ -114,6 +130,9 @@ func (p *vndkPrebuiltLibraryDecorator) install(ctx ModuleContext, file android.P
if len(arches) == 0 || arches[0].ArchType.String() != p.arch() { if len(arches) == 0 || arches[0].ArchType.String() != p.arch() {
return return
} }
if ctx.DeviceConfig().BinderBitness() != p.binderBit() {
return
}
if p.shared() { if p.shared() {
if ctx.isVndkSp() { if ctx.isVndkSp() {
p.baseInstaller.subDir = "vndk-sp-" + p.version() p.baseInstaller.subDir = "vndk-sp-" + p.version()