summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Spandan Das <spandandas@google.com> 2024-09-26 00:46:12 +0000
committer Spandan Das <spandandas@google.com> 2024-09-26 00:55:51 +0000
commitd4530d6128aaf009a6566a02cfc65d840c5f837d (patch)
tree829a94b15c7b72e2c47056d5511844b79a489a04
parentfae501cd0196772b76c4874699f95d8d802a5907 (diff)
Explicitly set the bitness of the jni lib required dep
JNI libraries which are not embedded inside android_app are installed by adding the name of the library to `LOCAL_REQUIRED_MODULES` of the app. The bitness resolution is currently missing in build/make/core/soong_app_prebuilt.mk, due to which both variants (if available) gets installed. The second variant is likely unusable anyways, since the .apk does not contain a symlink to the .so file on /system/lib/<libfoo>.so Suffix the bitness of the dependency explicilty so that that extraneous variants do not get installed. Test: go build ./java Test: presubmits Bug: 369678122 Change-Id: I91c1359c6060e4617a2ad1ca50b551ccfe25ee64
-rw-r--r--android/arch.go7
-rw-r--r--java/androidmk.go2
-rw-r--r--java/androidmk_test.go2
3 files changed, 9 insertions, 2 deletions
diff --git a/android/arch.go b/android/arch.go
index 942727ace..d9ecb508d 100644
--- a/android/arch.go
+++ b/android/arch.go
@@ -138,6 +138,13 @@ func (a ArchType) String() string {
return a.Name
}
+func (a ArchType) Bitness() string {
+ if a.Multilib == "lib32" {
+ return "32"
+ }
+ return "64"
+}
+
const COMMON_VARIANT = "common"
var (
diff --git a/java/androidmk.go b/java/androidmk.go
index a1bc90494..0539d25aa 100644
--- a/java/androidmk.go
+++ b/java/androidmk.go
@@ -415,7 +415,7 @@ func (app *AndroidApp) AndroidMkEntries() []android.AndroidMkEntries {
} else {
var names []string
for _, jniLib := range app.jniLibs {
- names = append(names, jniLib.name)
+ names = append(names, jniLib.name+":"+jniLib.target.Arch.ArchType.Bitness())
}
entries.AddStrings("LOCAL_REQUIRED_MODULES", names...)
}
diff --git a/java/androidmk_test.go b/java/androidmk_test.go
index 243a2791e..1d98b180d 100644
--- a/java/androidmk_test.go
+++ b/java/androidmk_test.go
@@ -286,7 +286,7 @@ func TestJniAsRequiredDeps(t *testing.T) {
}{
{
name: "app",
- expected: []string{"libjni"},
+ expected: []string{"libjni:64"},
},
{
name: "app_embedded",