1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "android_webview/common/aw_version_info_values.h"
6 #include "android_webview/lib/main/webview_jni_onload.h"
7 #include "base/android/jni_android.h"
8 #include "base/android/library_loader/library_loader_hooks.h"
10 // This is called by the VM when the shared library is first loaded.
11 // Most of the initialization is done in LibraryLoadedOnMainThread(), not here.
12 JNI_EXPORT jint
JNI_OnLoad(JavaVM
* vm
, void* reserved
) {
13 // WebView uses native JNI exports; disable manual JNI registration because
14 // we don't have a good way to detect the JNI registrations which is called,
15 // outside of OnJNIOnLoadRegisterJNI code path.
16 base::android::DisableManualJniRegistration();
18 base::android::SetVersionNumber(PRODUCT_VERSION
);
20 if (base::android::IsManualJniRegistrationDisabled()) {
21 base::android::InitVM(vm
);
23 if (android_webview::OnJNIOnLoadRegisterJNI(vm
))
27 if (!android_webview::OnJNIOnLoadInit()) {
30 return JNI_VERSION_1_4
;