*/
#define LOG_TAG "libnb"
+#define LOG_NDEBUG 1
#include <dlfcn.h>
#include <cutils/log.h>
#include <cutils/properties.h>
#include "nativebridge/native_bridge.h"
-#define DBG 0
-#if DBG
-#define LOGV ALOGD
-#else
-#define LOGV ALOGV
-#endif
-
namespace android {
static void *native_handle = nullptr;
if (!native_handle) {
native_handle = dlopen(libnb, RTLD_LAZY);
if (!native_handle) {
- ALOGE("Unable to open %s", libnb);
+ ALOGE("Unable to open %s: %s", libnb, dlerror());
return nullptr;
}
}
const char *app_code_cache_dir,
const char *isa)
{
- LOGV("enter native_bridge2_initialize %s %s", app_code_cache_dir, isa);
+ ALOGV("enter native_bridge2_initialize %s %s", app_code_cache_dir, isa);
if (is_native_bridge_enabled()) {
if (NativeBridgeCallbacks *cb = get_callbacks()) {
return cb->initialize(art_cbs, app_code_cache_dir, isa);
static void *native_bridge2_loadLibrary(const char *libpath, int flag)
{
- LOGV("enter native_bridge2_loadLibrary %s", libpath);
+ ALOGV("enter native_bridge2_loadLibrary %s", libpath);
NativeBridgeCallbacks *cb = get_callbacks();
return cb ? cb->loadLibrary(libpath, flag) : nullptr;
}
static void *native_bridge2_getTrampoline(void *handle, const char *name,
const char* shorty, uint32_t len)
{
- LOGV("enter native_bridge2_getTrampoline %s", name);
+ ALOGV("enter native_bridge2_getTrampoline %s", name);
NativeBridgeCallbacks *cb = get_callbacks();
return cb ? cb->getTrampoline(handle, name, shorty, len) : nullptr;
}
static bool native_bridge2_isSupported(const char *libpath)
{
- LOGV("enter native_bridge2_isSupported %s", libpath);
+ ALOGV("enter native_bridge2_isSupported %s", libpath);
NativeBridgeCallbacks *cb = get_callbacks();
return cb ? cb->isSupported(libpath) : false;
}
static const struct NativeBridgeRuntimeValues *native_bridge2_getAppEnv(const char *abi)
{
- LOGV("enter native_bridge2_getAppEnv %s", abi);
+ ALOGV("enter native_bridge2_getAppEnv %s", abi);
NativeBridgeCallbacks *cb = get_callbacks();
return cb ? cb->getAppEnv(abi) : nullptr;
}
static bool native_bridge2_isCompatibleWith(uint32_t version)
{
static uint32_t my_version = 0;
- LOGV("enter native_bridge2_isCompatibleWith %u", version);
+ ALOGV("enter native_bridge2_isCompatibleWith %u", version);
if (my_version == 0 && is_native_bridge_enabled()) {
if (NativeBridgeCallbacks *cb = get_callbacks()) {
my_version = cb->version;
static NativeBridgeSignalHandlerFn native_bridge2_getSignalHandler(int signal)
{
- LOGV("enter native_bridge2_getSignalHandler %d", signal);
+ ALOGV("enter native_bridge2_getSignalHandler %d", signal);
NativeBridgeCallbacks *cb = get_callbacks();
return cb ? cb->getSignalHandler(signal) : nullptr;
}
static int native_bridge3_unloadLibrary(void *handle)
{
- LOGV("enter native_bridge3_unloadLibrary %p", handle);
+ ALOGV("enter native_bridge3_unloadLibrary %p", handle);
NativeBridgeCallbacks *cb = get_callbacks();
return cb ? cb->unloadLibrary(handle) : -1;
}
static const char *native_bridge3_getError()
{
- LOGV("enter native_bridge3_getError");
+ ALOGV("enter native_bridge3_getError");
NativeBridgeCallbacks *cb = get_callbacks();
return cb ? cb->getError() : "unknown";
}
static bool native_bridge3_isPathSupported(const char *path)
{
- LOGV("enter native_bridge3_isPathSupported %s", path);
+ ALOGV("enter native_bridge3_isPathSupported %s", path);
NativeBridgeCallbacks *cb = get_callbacks();
return cb && cb->isPathSupported(path);
}
static bool native_bridge3_initAnonymousNamespace(const char *public_ns_sonames,
const char *anon_ns_library_path)
{
- LOGV("enter native_bridge3_initAnonymousNamespace %s, %s", public_ns_sonames, anon_ns_library_path);
+ ALOGV("enter native_bridge3_initAnonymousNamespace %s, %s", public_ns_sonames, anon_ns_library_path);
NativeBridgeCallbacks *cb = get_callbacks();
return cb && cb->initAnonymousNamespace(public_ns_sonames, anon_ns_library_path);
}
const char *permitted_when_isolated_path,
native_bridge_namespace_t *parent_ns)
{
- LOGV("enter native_bridge3_createNamespace %s, %s, %s, %s", name, ld_library_path, default_library_path, permitted_when_isolated_path);
+ ALOGV("enter native_bridge3_createNamespace %s, %s, %s, %s", name, ld_library_path, default_library_path, permitted_when_isolated_path);
NativeBridgeCallbacks *cb = get_callbacks();
return cb ? cb->createNamespace(name, ld_library_path, default_library_path, type, permitted_when_isolated_path, parent_ns) : nullptr;
}
native_bridge_namespace_t *to,
const char *shared_libs_soname)
{
- LOGV("enter native_bridge3_linkNamespaces %s", shared_libs_soname);
+ ALOGV("enter native_bridge3_linkNamespaces %s", shared_libs_soname);
NativeBridgeCallbacks *cb = get_callbacks();
return cb && cb->linkNamespaces(from, to, shared_libs_soname);
}
int flag,
native_bridge_namespace_t *ns)
{
- LOGV("enter native_bridge3_loadLibraryExt %s, %d, %p", libpath, flag, ns);
+ ALOGV("enter native_bridge3_loadLibraryExt %s, %d, %p", libpath, flag, ns);
NativeBridgeCallbacks *cb = get_callbacks();
void *result = cb ? cb->loadLibraryExt(libpath, flag, ns) : nullptr;
// void *result = cb ? cb->loadLibrary(libpath, flag) : nullptr;
- LOGV("native_bridge3_loadLibraryExt: %p", result);
+ ALOGV("native_bridge3_loadLibraryExt: %p", result);
return result;
}
static native_bridge_namespace_t *native_bridge4_getVendorNamespace()
{
- LOGV("enter native_bridge4_getVendorNamespace");
+ ALOGV("enter native_bridge4_getVendorNamespace");
NativeBridgeCallbacks *cb = get_callbacks();
return cb ? cb->getVendorNamespace() : nullptr;
}