Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 30f93826 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Add binder32bit to vndk_prebuilt module"

parents 6a25de47 3e2323d2
Loading
Loading
Loading
Loading
+22 −3
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import (

var (
	vndkSuffix     = ".vndk."
	binder32Suffix = ".binder32"
)

// 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 *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.
	Srcs []string `android:"arch_variant"`
}
@@ -67,10 +72,14 @@ func (p *vndkPrebuiltLibraryDecorator) Name(name string) string {
}

func (p *vndkPrebuiltLibraryDecorator) NameSuffix() string {
	suffix := p.version()
	if p.arch() != "" {
		return vndkSuffix + p.version() + "." + p.arch()
		suffix += "." + p.arch()
	}
	if Bool(p.properties.Binder32bit) {
		suffix += binder32Suffix
	}
	return vndkSuffix + p.version()
	return vndkSuffix + suffix
}

func (p *vndkPrebuiltLibraryDecorator) version() string {
@@ -81,6 +90,13 @@ func (p *vndkPrebuiltLibraryDecorator) arch() string {
	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 {
	p.libraryDecorator.libName = strings.TrimSuffix(ctx.ModuleName(), p.NameSuffix())
	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() {
		return
	}
	if ctx.DeviceConfig().BinderBitness() != p.binderBit() {
		return
	}
	if p.shared() {
		if ctx.isVndkSp() {
			p.baseInstaller.subDir = "vndk-sp-" + p.version()