aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitry Ivanov <dimitry@google.com>2016-01-06 13:37:17 -0800
committerDimitry Ivanov <dimitry@google.com>2016-01-06 13:38:42 -0800
commit6bc946f3d5e94826037325c943787a4c8e952ede (patch)
tree0519f57f361461e8741dc2bf39fce4ba47643a6b
parentd3014724c9a602dfee9cbcbfe3cb6819d0b33454 (diff)
downloadplatform_libnativehelper-6bc946f3d5e94826037325c943787a4c8e952ede.tar.gz
platform_libnativehelper-6bc946f3d5e94826037325c943787a4c8e952ede.tar.bz2
platform_libnativehelper-6bc946f3d5e94826037325c943787a4c8e952ede.zip
Untie libnativehelper from libcutils
Bug: http://b/26421034 Change-Id: I2a54bd87d6e29dfcab81f30863059188c0175b1a
-rw-r--r--Android.mk2
-rw-r--r--JniInvocation.cpp16
2 files changed, 10 insertions, 8 deletions
diff --git a/Android.mk b/Android.mk
index 568c436..48b97f1 100644
--- a/Android.mk
+++ b/Android.mk
@@ -36,7 +36,7 @@ LOCAL_MODULE := libnativehelper
LOCAL_CLANG := true
LOCAL_CFLAGS := -Werror -fvisibility=protected
LOCAL_C_INCLUDES := libcore/include
-LOCAL_SHARED_LIBRARIES += libcutils libdl
+LOCAL_SHARED_LIBRARIES += libdl
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
include $(BUILD_SHARED_LIBRARY)
diff --git a/JniInvocation.cpp b/JniInvocation.cpp
index 4559b43..a0805ed 100644
--- a/JniInvocation.cpp
+++ b/JniInvocation.cpp
@@ -26,7 +26,7 @@
#include "cutils/log.h"
#ifdef __ANDROID__
-#include "cutils/properties.h"
+#include <sys/system_properties.h>
#endif
JniInvocation* JniInvocation::jni_invocation_ = NULL;
@@ -51,7 +51,6 @@ JniInvocation::~JniInvocation() {
#ifdef __ANDROID__
static const char* kLibrarySystemProperty = "persist.sys.dalvik.vm.lib.2";
static const char* kDebuggableSystemProperty = "ro.debuggable";
-static const char* kDebuggableFallback = "0"; // Not debuggable.
#endif
static const char* kLibraryFallback = "libart.so";
@@ -61,8 +60,8 @@ const char* JniInvocation::GetLibrary(const char* library, char* buffer) {
#ifdef __ANDROID__
const char* default_library;
- char debuggable[PROPERTY_VALUE_MAX];
- property_get(kDebuggableSystemProperty, debuggable, kDebuggableFallback);
+ char debuggable[PROP_VALUE_MAX];
+ __system_property_get(kDebuggableSystemProperty, debuggable);
if (strcmp(debuggable, "1") != 0) {
// Not a debuggable build.
@@ -76,8 +75,11 @@ const char* JniInvocation::GetLibrary(const char* library, char* buffer) {
// Accept the library parameter. For the case it is NULL, load the default
// library from the system property.
if (buffer != NULL) {
- property_get(kLibrarySystemProperty, buffer, kLibraryFallback);
- default_library = buffer;
+ if (__system_property_get(kLibrarySystemProperty, buffer) > 0) {
+ default_library = buffer;
+ } else {
+ default_library = kLibraryFallback;
+ }
} else {
// No buffer given, just use default fallback.
default_library = kLibraryFallback;
@@ -96,7 +98,7 @@ const char* JniInvocation::GetLibrary(const char* library, char* buffer) {
bool JniInvocation::Init(const char* library) {
#ifdef __ANDROID__
- char buffer[PROPERTY_VALUE_MAX];
+ char buffer[PROP_VALUE_MAX];
#else
char* buffer = NULL;
#endif