diff options
author | Yong WU <yong.wu@intel.com> | 2014-07-28 21:20:18 +0800 |
---|---|---|
committer | Calin Juravle <calin@google.com> | 2014-08-15 13:22:30 +0100 |
commit | abd76d0a091e283117b8aeb642833b8869ea81bf (patch) | |
tree | 93e0fd173996d717155d9276b216eafde5e9a0a0 /core | |
parent | 1806b1fc25bcffaa005e72a55042031a42b168b1 (diff) | |
download | frameworks_base-abd76d0a091e283117b8aeb642833b8869ea81bf.zip frameworks_base-abd76d0a091e283117b8aeb642833b8869ea81bf.tar.gz frameworks_base-abd76d0a091e283117b8aeb642833b8869ea81bf.tar.bz2 |
Integrate NativeActivity with NativeBridge interfaces
Bug: 16884833
(cherry picked from commit I73aab8e212860ba5aee9444d801806d3da326a41)
Change-Id: I67f037ea81d2a4ede4294afd8b84b7640e534a13
Diffstat (limited to 'core')
-rw-r--r-- | core/jni/Android.mk | 1 | ||||
-rw-r--r-- | core/jni/android_app_NativeActivity.cpp | 26 |
2 files changed, 21 insertions, 6 deletions
diff --git a/core/jni/Android.mk b/core/jni/Android.mk index 480383b..2106d38 100644 --- a/core/jni/Android.mk +++ b/core/jni/Android.mk @@ -246,6 +246,7 @@ LOCAL_SHARED_LIBRARIES := \ libminikin \ libstlport \ libprocessgroup \ + libnativebridge \ ifeq ($(USE_OPENGL_RENDERER),true) LOCAL_SHARED_LIBRARIES += libhwui diff --git a/core/jni/android_app_NativeActivity.cpp b/core/jni/android_app_NativeActivity.cpp index 9c44093..633a207 100644 --- a/core/jni/android_app_NativeActivity.cpp +++ b/core/jni/android_app_NativeActivity.cpp @@ -38,6 +38,8 @@ #include "android_view_InputChannel.h" #include "android_view_KeyEvent.h" +#include "nativebridge/native_bridge.h" + #define LOG_TRACE(...) //#define LOG_TRACE(...) ALOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__) @@ -251,17 +253,29 @@ loadNativeCode_native(JNIEnv* env, jobject clazz, jstring path, jstring funcName const char* pathStr = env->GetStringUTFChars(path, NULL); NativeCode* code = NULL; - + bool needNativeBridge = false; + void* handle = dlopen(pathStr, RTLD_LAZY); - + if (handle == NULL) { + if (NativeBridgeIsSupported(pathStr)) { + handle = NativeBridgeLoadLibrary(pathStr, RTLD_LAZY); + needNativeBridge = true; + } + } env->ReleaseStringUTFChars(path, pathStr); - + if (handle != NULL) { + void* funcPtr = NULL; const char* funcStr = env->GetStringUTFChars(funcName, NULL); - code = new NativeCode(handle, (ANativeActivity_createFunc*) - dlsym(handle, funcStr)); + if (needNativeBridge) { + funcPtr = NativeBridgeGetTrampoline(handle, funcStr, NULL, 0); + } else { + funcPtr = dlsym(handle, funcStr); + } + + code = new NativeCode(handle, (ANativeActivity_createFunc*)funcPtr); env->ReleaseStringUTFChars(funcName, funcStr); - + if (code->createActivityFunc == NULL) { ALOGW("ANativeActivity_onCreate not found"); delete code; |