2 #include <sys/system_properties.h>
4 #include <android/log.h>
6 #include "NptLogging.h"
8 /*----------------------------------------------------------------------
10 +---------------------------------------------------------------------*/
11 static int android_property_get(const char* name
, char* value
) {
12 static int (*__real_system_property_get
)(const char*, char*) = NULL
;
13 if (__real_system_property_get
== NULL
) {
14 void* handle
= dlopen("libc.so", 0);
16 __android_log_print(ANDROID_LOG_DEBUG
, "Neptune", "Cannot dlopen libc.so: %s", dlerror());
19 __real_system_property_get
= reinterpret_cast<int (*)(const char*, char*)>(
20 dlsym(handle
, "__system_property_get"));
21 if (!__real_system_property_get
) {
22 __android_log_print(ANDROID_LOG_DEBUG
, "Neptune", "Cannot resolve __system_property_get(): %s", dlerror());
26 return (*__real_system_property_get
)(name
, value
);
29 /*----------------------------------------------------------------------
30 | NPT_GetSystemLogConfig
31 +---------------------------------------------------------------------*/
33 NPT_GetSystemLogConfig(NPT_String
& config
)
35 char android_npt_config
[PROP_VALUE_MAX
];
36 android_npt_config
[0] = 0;
37 int prop_len
= android_property_get("persist.neptune_log_config",
40 config
= android_npt_config
;
43 return NPT_ERROR_NO_SUCH_PROPERTY
;