Index: base/android/linker/linker_jni.cc |
diff --git a/base/android/linker/linker_jni.cc b/base/android/linker/linker_jni.cc |
index 79dd20103e7add06b2b30dd0550193682cbb7d50..e330a27f29ba7cfd2a60ddb60e7761a830855e54 100644 |
--- a/base/android/linker/linker_jni.cc |
+++ b/base/android/linker/linker_jni.cc |
@@ -574,6 +574,19 @@ jlong GetRandomBaseLoadAddress(JNIEnv* env, jclass clazz, jlong bytes) { |
return static_cast<jlong>(reinterpret_cast<uintptr_t>(address)); |
} |
+// Test whether the device supports memory mapping APK files with executable |
+// permissions. |
+// |
+// |env| is the current JNI environment handle and is ignored here. |
+// |clazz| is the static class handle for org.chromium.base.Linker, |
+// and is ignored here. |
+// |apkfile_name| is the filename of the APK. |
+// Returns true if supported. |
+jboolean TestLoadFromApk(JNIEnv* env, jclass clazz, jstring apkfile_name) { |
+ String apkfile_name_str(env, apkfile_name); |
+ return crazy_linker_test_load_from_apk(apkfile_name_str.c_str()); |
+} |
+ |
const JNINativeMethod kNativeMethods[] = { |
{"nativeLoadLibrary", |
"(" |
@@ -623,7 +636,13 @@ const JNINativeMethod kNativeMethods[] = { |
"J" |
")" |
"J", |
- reinterpret_cast<void*>(&GetRandomBaseLoadAddress)}, }; |
+ reinterpret_cast<void*>(&GetRandomBaseLoadAddress)}, |
+ {"nativeTestLoadFromApk", |
+ "(" |
+ "Ljava/lang/String;" |
+ ")" |
+ "Z", |
+ reinterpret_cast<void*>(&TestLoadFromApk)}, }; |
} // namespace |