This is an automated email from the ASF dual-hosted git repository.

kyork pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-weex.git


The following commit(s) were added to refs/heads/master by this push:
     new 1e40e9c  * [Android] Move initialization of PlatformBridge to 
JNI_Load(#2715)
1e40e9c is described below

commit 1e40e9ced014bfa2dfa976fc073751f89c4248a2
Author: Xu Jiacheng <[email protected]>
AuthorDate: Tue Jul 16 19:41:16 2019 +0800

    * [Android] Move initialization of PlatformBridge to JNI_Load(#2715)
---
 weex_core/Source/android/utils/jni_load.cc  | 6 +++++-
 weex_core/Source/android/wrap/wx_bridge.cpp | 4 +---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/weex_core/Source/android/utils/jni_load.cc 
b/weex_core/Source/android/utils/jni_load.cc
index a016cc5..58129c3 100644
--- a/weex_core/Source/android/utils/jni_load.cc
+++ b/weex_core/Source/android/utils/jni_load.cc
@@ -18,6 +18,9 @@
  */
 
 #include <jni.h>
+#include "core/bridge/platform_bridge.h"
+#include "android/bridge/platform/android_bridge.h"
+#include "core/manager/weex_core_manager.h"
 #include "android/utils/so_utils.h"
 #include "android/wrap/content_box_measurement_impl_android.h"
 #include "android/wrap/hash_set.h"
@@ -51,7 +54,8 @@ jint JNI_OnLoad(JavaVM *vm, void *reserved) {
     WeexCore::SoUtils::Init(env);
     WeexCore::WMLBridge::RegisterJNIUtils(env);
   }
-
+  PlatformBridge* bridge = new AndroidBridgeInSimple;
+  WeexCoreManager::Instance()->set_platform_bridge(bridge);
   return result ? JNI_VERSION_1_4 : JNI_FALSE;
 }
 
diff --git a/weex_core/Source/android/wrap/wx_bridge.cpp 
b/weex_core/Source/android/wrap/wx_bridge.cpp
index 8e7f708..0ac8277 100644
--- a/weex_core/Source/android/wrap/wx_bridge.cpp
+++ b/weex_core/Source/android/wrap/wx_bridge.cpp
@@ -298,9 +298,7 @@ static jint InitFramework(JNIEnv* env, jobject object, 
jstring script,
             ->platform_side()
             ->ReportNativeInitStatus(status_code, error_msg);
       });
-  // Init platform bridge
-  PlatformBridge* bridge = new AndroidBridgeInSimple;
-  WeexCoreManager::Instance()->set_platform_bridge(bridge);
+  PlatformBridge* bridge = WeexCoreManager::Instance()->getPlatformBridge();
   // Init params
   std::vector<INIT_FRAMEWORK_PARAMS*> params_vector = initFromParam(
       env, params, [](const char* status_code, const char* error_msg) {

Reply via email to