Merge "Support apps that pass JNI_VERSION_1_1 to GetEnv."
diff --git a/vm/Jni.cpp b/vm/Jni.cpp
index 4ada075..0e77fab 100644
--- a/vm/Jni.cpp
+++ b/vm/Jni.cpp
@@ -2904,7 +2904,9 @@
static jint GetEnv(JavaVM* vm, void** env, jint version) {
Thread* self = dvmThreadSelf();
- if (dvmIsBadJniVersion(version)) {
+ // GetEnv also accepts JNI_VERSION_1_1, but always returns a JNIEnv*
+ // corresponding to the most current supported JNI version.
+ if (dvmIsBadJniVersion(version) && version != JNI_VERSION_1_1) {
ALOGE("Bad JNI version passed to GetEnv: %d", version);
return JNI_EVERSION;
}