1 // Copyright 2015 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "base/android/base_jni_onload.h" 6 #include "base/android/jni_android.h" 7 #include "base/android/library_loader/library_loader_hooks.h" 8 #include "base/functional/bind.h" 9 #include "testing/android/native_test/native_test_launcher.h" 10 11 namespace { 12 NativeInit()13bool NativeInit() { 14 if (!base::android::OnJNIOnLoadInit()) 15 return false; 16 testing::android::InstallHandlers(); 17 return true; 18 } 19 20 } // namespace 21 22 23 // This is called by the VM when the shared library is first loaded. JNI_OnLoad(JavaVM * vm,void * reserved)24JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { 25 base::android::InitVM(vm); 26 if (!NativeInit()) { 27 return -1; 28 } 29 return JNI_VERSION_1_4; 30 } 31