am 508e768d
: Merge "Integrate NativeActivity with NativeBridge interfaces"
* commit '508e768d956384d09c755c43c019559ebd481f2c': Integrate NativeActivity with NativeBridge interfaces
This commit is contained in:
@ -209,7 +209,8 @@ LOCAL_SHARED_LIBRARIES := \
|
|||||||
libjpeg \
|
libjpeg \
|
||||||
libusbhost \
|
libusbhost \
|
||||||
libharfbuzz_ng \
|
libharfbuzz_ng \
|
||||||
libz
|
libz \
|
||||||
|
libnativebridge
|
||||||
|
|
||||||
ifeq ($(USE_OPENGL_RENDERER),true)
|
ifeq ($(USE_OPENGL_RENDERER),true)
|
||||||
LOCAL_SHARED_LIBRARIES += libhwui
|
LOCAL_SHARED_LIBRARIES += libhwui
|
||||||
|
@ -38,6 +38,8 @@
|
|||||||
#include "android_view_InputChannel.h"
|
#include "android_view_InputChannel.h"
|
||||||
#include "android_view_KeyEvent.h"
|
#include "android_view_KeyEvent.h"
|
||||||
|
|
||||||
|
#include "nativebridge/native_bridge.h"
|
||||||
|
|
||||||
#define LOG_TRACE(...)
|
#define LOG_TRACE(...)
|
||||||
//#define LOG_TRACE(...) ALOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__)
|
//#define LOG_TRACE(...) ALOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__)
|
||||||
|
|
||||||
@ -251,15 +253,27 @@ loadNativeCode_native(JNIEnv* env, jobject clazz, jstring path, jstring funcName
|
|||||||
|
|
||||||
const char* pathStr = env->GetStringUTFChars(path, NULL);
|
const char* pathStr = env->GetStringUTFChars(path, NULL);
|
||||||
NativeCode* code = NULL;
|
NativeCode* code = NULL;
|
||||||
|
bool needNativeBridge = false;
|
||||||
|
|
||||||
void* handle = dlopen(pathStr, RTLD_LAZY);
|
void* handle = dlopen(pathStr, RTLD_LAZY);
|
||||||
|
if (handle == NULL) {
|
||||||
|
if (NativeBridgeIsSupported(pathStr)) {
|
||||||
|
handle = NativeBridgeLoadLibrary(pathStr, RTLD_LAZY);
|
||||||
|
needNativeBridge = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
env->ReleaseStringUTFChars(path, pathStr);
|
env->ReleaseStringUTFChars(path, pathStr);
|
||||||
|
|
||||||
if (handle != NULL) {
|
if (handle != NULL) {
|
||||||
|
void* funcPtr = NULL;
|
||||||
const char* funcStr = env->GetStringUTFChars(funcName, NULL);
|
const char* funcStr = env->GetStringUTFChars(funcName, NULL);
|
||||||
code = new NativeCode(handle, (ANativeActivity_createFunc*)
|
if (needNativeBridge) {
|
||||||
dlsym(handle, funcStr));
|
funcPtr = NativeBridgeGetTrampoline(handle, funcStr, NULL, 0);
|
||||||
|
} else {
|
||||||
|
funcPtr = dlsym(handle, funcStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
code = new NativeCode(handle, (ANativeActivity_createFunc*)funcPtr);
|
||||||
env->ReleaseStringUTFChars(funcName, funcStr);
|
env->ReleaseStringUTFChars(funcName, funcStr);
|
||||||
|
|
||||||
if (code->createActivityFunc == NULL) {
|
if (code->createActivityFunc == NULL) {
|
||||||
|
Reference in New Issue
Block a user