Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(859)

Unified Diff: base/android/linker/linker_jni.cc

Issue 643803003: Add UMA for testing whether device supports memory mapping APK files with executable permissions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698