If CheckJNI is enabled don't allow app workarounds
Change-Id: I030231d2b1ebcabb5c3922ea91230b40998711ba
diff --git a/runtime/native/dalvik_system_VMRuntime.cc b/runtime/native/dalvik_system_VMRuntime.cc
index 5fb53df..b0f67c4 100644
--- a/runtime/native/dalvik_system_VMRuntime.cc
+++ b/runtime/native/dalvik_system_VMRuntime.cc
@@ -131,10 +131,6 @@
return env->NewStringUTF(kIsDebugBuild ? "libartd.so" : "libart.so");
}
-static void DisableCheckJniCallback(Thread* t, void*) {
- t->GetJniEnv()->SetCheckJniEnabled(false);
-}
-
static void VMRuntime_setTargetSdkVersion(JNIEnv* env, jobject, jint targetSdkVersion) {
// This is the target SDK version of the app we're about to run.
// Note that targetSdkVersion may be CUR_DEVELOPMENT (10000).
@@ -143,17 +139,13 @@
Runtime* runtime = Runtime::Current();
JavaVMExt* vm = runtime->GetJavaVM();
if (vm->check_jni) {
- LOG(WARNING) << "Turning off CheckJNI so we can turn on JNI app bug workarounds...";
- Thread* self = static_cast<JNIEnvExt*>(env)->self;
- MutexLock mu(self, *Locks::thread_list_lock_);
- vm->SetCheckJniEnabled(false);
- runtime->GetThreadList()->ForEach(DisableCheckJniCallback, NULL);
+ LOG(INFO) << "CheckJNI enabled: not enabling JNI app bug workarounds.";
+ } else {
+ LOG(INFO) << "Turning on JNI app bug workarounds for target SDK version "
+ << targetSdkVersion << "...";
+
+ vm->work_around_app_jni_bugs = true;
}
-
- LOG(INFO) << "Turning on JNI app bug workarounds for target SDK version "
- << targetSdkVersion << "...";
-
- vm->work_around_app_jni_bugs = true;
}
}