ART: Update for split native bridge initialization

Change-Id: I0b93da93251c6b4638de786bf98cf99df07c3fc2
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 9b24bec..0edf116 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -143,8 +143,7 @@
       target_sdk_version_(0),
       implicit_null_checks_(false),
       implicit_so_checks_(false),
-      implicit_suspend_checks_(false),
-      native_bridge_art_callbacks_({GetMethodShorty, GetNativeMethodCount, GetNativeMethods}) {
+      implicit_suspend_checks_(false) {
 }
 
 Runtime::~Runtime() {
@@ -418,18 +417,23 @@
 
   Thread::FinishStartup();
 
+  system_class_loader_ = CreateSystemClassLoader();
+
   if (is_zygote_) {
     if (!InitZygote()) {
       return false;
     }
   } else {
-    DidForkFromZygote(NativeBridgeAction::kInitialize);
+    bool have_native_bridge = !native_bridge_library_filename_.empty();
+    if (have_native_bridge) {
+      PreInitializeNativeBridge(".");
+    }
+    DidForkFromZygote(self->GetJniEnv(), have_native_bridge ? NativeBridgeAction::kInitialize :
+        NativeBridgeAction::kUnload, GetInstructionSetString(kRuntimeISA));
   }
 
   StartDaemonThreads();
 
-  system_class_loader_ = CreateSystemClassLoader();
-
   {
     ScopedObjectAccess soa(self);
     self->GetJniEnv()->locals.AssertEmpty();
@@ -501,16 +505,16 @@
 #endif
 }
 
-void Runtime::DidForkFromZygote(NativeBridgeAction action) {
+void Runtime::DidForkFromZygote(JNIEnv* env, NativeBridgeAction action, const char* isa) {
   is_zygote_ = false;
 
   switch (action) {
     case NativeBridgeAction::kUnload:
-      android::UnloadNativeBridge();
+      UnloadNativeBridge();
       break;
 
     case NativeBridgeAction::kInitialize:
-      android::InitializeNativeBridge();
+      InitializeNativeBridge(env, isa);
       break;
   }
 
@@ -870,10 +874,7 @@
   //   DidForkFromZygote(kInitialize) -> try to initialize any native bridge given.
   //   No-op wrt native bridge.
   native_bridge_library_filename_ = options->native_bridge_library_filename_;
-  android::LoadNativeBridge(native_bridge_library_filename_.c_str(), &native_bridge_art_callbacks_);
-  VLOG(startup) << "Runtime::Setup native bridge library: "
-                << (native_bridge_library_filename_.empty() ?
-                    "(empty)" : native_bridge_library_filename_);
+  LoadNativeBridge(native_bridge_library_filename_);
 
   VLOG(startup) << "Runtime::Init exiting";
   return true;