aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-05-10 07:06:31 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-05-10 07:06:31 +0000
commit6a6ab549e88f01f7087ad41af46bd2bf343afce3 (patch)
tree29b826ccd84c9eca867f4c759b61e13c8af303af
parent8d12a28b67e8ba839839899aafde9970f9747a02 (diff)
parentb6c56c54561204cef723ca45ffb92a70dcd7d5b1 (diff)
downloadlibnativehelper-6a6ab549e88f01f7087ad41af46bd2bf343afce3.tar.gz
Change-Id: Id468a73f5e6a4d4ab3361495e772c363e1308c88
-rw-r--r--Android.bp6
-rw-r--r--JniInvocation.c22
-rw-r--r--tests/Android.bp4
-rw-r--r--tests_mts/Android.bp2
4 files changed, 28 insertions, 6 deletions
diff --git a/Android.bp b/Android.bp
index 9fd039e..91ac351 100644
--- a/Android.bp
+++ b/Android.bp
@@ -53,6 +53,7 @@ cc_library_headers {
"//apex_available:platform",
"//apex_available:anyapex",
],
+ ramdisk_available: true,
// recovery_available currently required for libchrome (https://r.android.com/799940).
recovery_available: true,
visibility: ["//visibility:public"],
@@ -196,13 +197,12 @@ cc_library {
"//cts:__subpackages__",
"//external/perfetto:__subpackages__",
"//frameworks/base/packages/Connectivity/tests/integration:__pkg__",
+ "//frameworks/base/packages/ConnectivityT:__subpackages__", // TODO: remove after code move
"//frameworks/base/packages/Tethering:__subpackages__",
"//frameworks/libs/net/common/native/bpfmapjni",
"//frameworks/libs/net/common/native/bpfutiljni",
"//libcore:__subpackages__",
- "//packages/modules/Connectivity/service",
- "//packages/modules/Connectivity/tests:__subpackages__",
- "//packages/modules/Connectivity/Tethering:__subpackages__",
+ "//packages/modules/Connectivity:__subpackages__",
"//packages/modules/ExtServices:__subpackages__",
"//packages/modules/NetworkStack:__subpackages__",
":__subpackages__",
diff --git a/JniInvocation.c b/JniInvocation.c
index 9cfb084..7effddb 100644
--- a/JniInvocation.c
+++ b/JniInvocation.c
@@ -23,14 +23,25 @@
#include <sys/system_properties.h>
#endif
+#include <errno.h>
#include <jni.h>
#include <stdbool.h>
#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
#include "DlHelp.h"
// Name the default library providing the JNI Invocation API.
static const char* kDefaultJniInvocationLibrary = "libart.so";
+static const char* kDebugJniInvocationLibrary = "libartd.so";
+#if defined(__LP64__)
+#define LIB_DIR "lib64"
+#else
+#define LIB_DIR "lib"
+#endif
+static const char* kDebugJniInvocationLibraryPath = "/apex/com.android.art/" LIB_DIR "/libartd.so";
struct JniInvocationImpl {
// Name of library providing JNI_ method implementations.
@@ -118,10 +129,21 @@ const char* JniInvocationGetLibraryWith(const char* library,
if (library != NULL) {
return library;
}
+
+ // If the debug library is installed, use it.
+ // TODO(b/216099383): Do this in the test harness instead.
+ struct stat st;
+ if (stat(kDebugJniInvocationLibraryPath, &st) == 0) {
+ return kDebugJniInvocationLibrary;
+ } else if (errno != ENOENT) {
+ ALOGW("Failed to stat %s: %s", kDebugJniInvocationLibraryPath, strerror(errno));
+ }
+
// Choose the system_preferred_library (if provided).
if (system_preferred_library != NULL) {
return system_preferred_library;
}
+
}
return kDefaultJniInvocationLibrary;
}
diff --git a/tests/Android.bp b/tests/Android.bp
index caf8131..99ec108 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -61,7 +61,7 @@ cc_defaults {
cc_test {
name: "libnativehelper_tests",
defaults: ["libnativehelper_test_defaults"],
- test_suites: ["device-tests"],
+ test_suites: ["general-tests"],
srcs: [
"scoped_local_frame_test.cpp",
"scoped_local_ref_test.cpp",
@@ -75,7 +75,7 @@ cc_test {
cc_test {
name: "libnativehelper_lazy_tests",
defaults: ["libnativehelper_test_defaults"],
- test_suites: ["device-tests"],
+ test_suites: ["general-tests"],
srcs: ["libnativehelper_lazy_test.cpp"],
shared_libs: ["liblog"],
static_libs: ["libnativehelper_lazy"],
diff --git a/tests_mts/Android.bp b/tests_mts/Android.bp
index 6496983..9483a62 100644
--- a/tests_mts/Android.bp
+++ b/tests_mts/Android.bp
@@ -34,7 +34,7 @@ java_defaults {
sdk_version: "test_current",
srcs: ["src/com/android/art/libnativehelper/JniHelpTest.java"],
test_suites: [
- "device-tests",
+ "general-tests",
"mts",
],
}