Loading core/jni/android_app_NativeActivity.cpp +90 −84 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ #include "core_jni_helpers.h" #include "ScopedUtfChars.h" #define LOG_TRACE(...) //#define LOG_TRACE(...) ALOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__) Loading Loading @@ -264,23 +265,29 @@ loadNativeCode_native(JNIEnv* env, jobject clazz, jstring path, jstring funcName ALOGD("loadNativeCode_native"); } const char* pathStr = env->GetStringUTFChars(path, NULL); ScopedUtfChars pathStr(env, path); std::unique_ptr<NativeCode> code; bool needNativeBridge = false; void* handle = OpenNativeLibrary(env, sdkVersion, pathStr, classLoader, libraryPath); if (handle == NULL) { if (NativeBridgeIsSupported(pathStr)) { handle = NativeBridgeLoadLibrary(pathStr, RTLD_LAZY); needNativeBridge = true; } bool needs_native_bridge = false; std::string error_msg; void* handle = OpenNativeLibrary(env, sdkVersion, pathStr.c_str(), classLoader, libraryPath, &needs_native_bridge, &error_msg); if (handle == nullptr) { ALOGW("NativeActivity LoadNativeLibrary(\"%s\") failed: %s", pathStr.c_str(), error_msg.c_str()); return 0; } env->ReleaseStringUTFChars(path, pathStr); if (handle != NULL) { void* funcPtr = NULL; const char* funcStr = env->GetStringUTFChars(funcName, NULL); if (needNativeBridge) { if (needs_native_bridge) { funcPtr = NativeBridgeGetTrampoline(handle, funcStr, NULL, 0); } else { funcPtr = dlsym(handle, funcStr); Loading Loading @@ -359,7 +366,6 @@ loadNativeCode_native(JNIEnv* env, jobject clazz, jstring path, jstring funcName if (rawSavedState != NULL) { env->ReleaseByteArrayElements(savedState, rawSavedState, 0); } } return (jlong)code.release(); } Loading Loading
core/jni/android_app_NativeActivity.cpp +90 −84 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ #include "core_jni_helpers.h" #include "ScopedUtfChars.h" #define LOG_TRACE(...) //#define LOG_TRACE(...) ALOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__) Loading Loading @@ -264,23 +265,29 @@ loadNativeCode_native(JNIEnv* env, jobject clazz, jstring path, jstring funcName ALOGD("loadNativeCode_native"); } const char* pathStr = env->GetStringUTFChars(path, NULL); ScopedUtfChars pathStr(env, path); std::unique_ptr<NativeCode> code; bool needNativeBridge = false; void* handle = OpenNativeLibrary(env, sdkVersion, pathStr, classLoader, libraryPath); if (handle == NULL) { if (NativeBridgeIsSupported(pathStr)) { handle = NativeBridgeLoadLibrary(pathStr, RTLD_LAZY); needNativeBridge = true; } bool needs_native_bridge = false; std::string error_msg; void* handle = OpenNativeLibrary(env, sdkVersion, pathStr.c_str(), classLoader, libraryPath, &needs_native_bridge, &error_msg); if (handle == nullptr) { ALOGW("NativeActivity LoadNativeLibrary(\"%s\") failed: %s", pathStr.c_str(), error_msg.c_str()); return 0; } env->ReleaseStringUTFChars(path, pathStr); if (handle != NULL) { void* funcPtr = NULL; const char* funcStr = env->GetStringUTFChars(funcName, NULL); if (needNativeBridge) { if (needs_native_bridge) { funcPtr = NativeBridgeGetTrampoline(handle, funcStr, NULL, 0); } else { funcPtr = dlsym(handle, funcStr); Loading Loading @@ -359,7 +366,6 @@ loadNativeCode_native(JNIEnv* env, jobject clazz, jstring path, jstring funcName if (rawSavedState != NULL) { env->ReleaseByteArrayElements(savedState, rawSavedState, 0); } } return (jlong)code.release(); } Loading