dalvik
Revision | d288f74190feb0605b7903a09b0c08cf015d8b7c (tree) |
---|---|
Time | 2013-09-07 07:20:04 |
Author | Elliott Hughes <enh@goog...> |
Commiter | Elliott Hughes |
Support apps that pass JNI_VERSION_1_1 to GetEnv.
Bug: 10649815
(cherry picked from commit 89ee8af81cfe231ed3cd21b050ec16fbcf419683)
Change-Id: If28fab8c87222a9d182398a4deca167a8ca5c677
@@ -2904,7 +2904,9 @@ static jint DetachCurrentThread(JavaVM* vm) { | ||
2904 | 2904 | static jint GetEnv(JavaVM* vm, void** env, jint version) { |
2905 | 2905 | Thread* self = dvmThreadSelf(); |
2906 | 2906 | |
2907 | - if (dvmIsBadJniVersion(version)) { | |
2907 | + // GetEnv also accepts JNI_VERSION_1_1, but always returns a JNIEnv* | |
2908 | + // corresponding to the most current supported JNI version. | |
2909 | + if (dvmIsBadJniVersion(version) && version != JNI_VERSION_1_1) { | |
2908 | 2910 | ALOGE("Bad JNI version passed to GetEnv: %d", version); |
2909 | 2911 | return JNI_EVERSION; |
2910 | 2912 | } |