Support apps that pass JNI_VERSION_1_1 to GetEnv.
Bug: 10649815
Change-Id: I73b9bef20f7f8fa96cdcb5afdab9592c35ea0f3e
diff --git a/runtime/jni_internal.cc b/runtime/jni_internal.cc
index ceed866..d72ddf6 100644
--- a/runtime/jni_internal.cc
+++ b/runtime/jni_internal.cc
@@ -2953,7 +2953,10 @@
}
static jint GetEnv(JavaVM* vm, void** env, jint version) {
- if (IsBadJniVersion(version)) {
+ // GetEnv always returns a JNIEnv* for the most current supported JNI version,
+ // and unlike other calls that take a JNI version doesn't care if you supply
+ // JNI_VERSION_1_1, which we don't otherwise support.
+ if (IsBadJniVersion(version) && version != JNI_VERSION_1_1) {
LOG(ERROR) << "Bad JNI version passed to GetEnv: " << version;
return JNI_EVERSION;
}