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
diff --git a/cc/vndk_prebuilt.go b/cc/vndk_prebuilt.go
index 9c9545d..849bb3f 100644
--- a/cc/vndk_prebuilt.go
+++ b/cc/vndk_prebuilt.go
@@ -21,7 +21,8 @@
 )
 
 var (
-	vndkSuffix = ".vndk."
+	vndkSuffix     = ".vndk."
+	binder32Suffix = ".binder32"
 )
 
 // Creates vndk prebuilts that include the VNDK version.
@@ -53,6 +54,10 @@
 	// 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) NameSuffix() string {
+	suffix := p.version()
 	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 {
@@ -81,6 +90,13 @@
 	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 @@
 	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()