Index: base/android/java/src/org/chromium/base/JNIUtils.java |
diff --git a/base/android/java/src/org/chromium/base/JNIUtils.java b/base/android/java/src/org/chromium/base/JNIUtils.java |
index f971b5e03cebd984bcd14066947c40a475f2afe4..51c4bfa130d7187ae768ff2a07a07dbc8853ee11 100644 |
--- a/base/android/java/src/org/chromium/base/JNIUtils.java |
+++ b/base/android/java/src/org/chromium/base/JNIUtils.java |
@@ -4,6 +4,7 @@ |
package org.chromium.base; |
+import org.chromium.base.JniRegistrationType.JniRegistrationTypeEnum; |
import org.chromium.base.annotations.CalledByNative; |
import org.chromium.base.annotations.MainDex; |
@@ -12,6 +13,9 @@ import org.chromium.base.annotations.MainDex; |
*/ |
@MainDex |
public class JNIUtils { |
+ @JniRegistrationTypeEnum |
+ private static int sJniRegistrationType = JniRegistrationType.ALL_JNI_REGISTRATION; |
+ |
/** |
* This returns a ClassLoader that is capable of loading Chromium Java code. Such a ClassLoader |
* is needed for the few cases where the JNI mechanism is unable to automatically determine the |
@@ -21,4 +25,23 @@ public class JNIUtils { |
public static Object getClassLoader() { |
return JNIUtils.class.getClassLoader(); |
} |
+ |
+ /** |
+ * @return the type of JNI registration to perform when the native libraries are loaded. |
+ */ |
+ @JniRegistrationTypeEnum |
+ @CalledByNative |
+ public static int getJniRegistrationType() { |
+ return sJniRegistrationType; |
+ } |
+ |
+ /** |
+ * Set the JNI registration type so that native side can register the correct JNI methods. |
+ * Must be called before the native library is loaded. |
+ * @param jniRegistrationType the type of JNI registration to perform when loading native |
+ * libraries. |
+ */ |
+ public static void setJniRegistrationType(@JniRegistrationTypeEnum int jniRegistrationType) { |
+ sJniRegistrationType = jniRegistrationType; |
+ } |
} |