diff options
author | Nick Pelly <npelly@google.com> | 2011-03-04 17:13:08 -0800 |
---|---|---|
committer | Nick Pelly <npelly@google.com> | 2011-03-07 17:16:09 -0800 |
commit | 0412f53e664083dc5307bbcf18c0002b26180203 (patch) | |
tree | 6f9e42897bfe35ac792d41e01337d40c0784f5a9 /jni/com_android_nfc_NativeNfcSecureElement.cpp | |
parent | 73cc851dcb7d026015f6f91ab9336e5c042b8ac1 (diff) | |
download | packages_apps_nfc-0412f53e664083dc5307bbcf18c0002b26180203.zip packages_apps_nfc-0412f53e664083dc5307bbcf18c0002b26180203.tar.gz packages_apps_nfc-0412f53e664083dc5307bbcf18c0002b26180203.tar.bz2 |
Don't re-use the same JNIEnv across threads.
This caused SE access on eng builds to fail, and
was pretty dangerous on other builds.
Change-Id: Iea8f09559e8da61862cdb24ec0ea5ace91d5bbd1
Diffstat (limited to 'jni/com_android_nfc_NativeNfcSecureElement.cpp')
-rwxr-xr-x | jni/com_android_nfc_NativeNfcSecureElement.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/jni/com_android_nfc_NativeNfcSecureElement.cpp b/jni/com_android_nfc_NativeNfcSecureElement.cpp index b1db0b8..f686279 100755 --- a/jni/com_android_nfc_NativeNfcSecureElement.cpp +++ b/jni/com_android_nfc_NativeNfcSecureElement.cpp @@ -115,6 +115,7 @@ static void com_android_nfc_jni_open_secure_element_notification_callback(void * struct nfc_jni_callback_data * pContextData = (struct nfc_jni_callback_data*)pContext; NFCSTATUS ret; int i; + JNIEnv *e = nfc_get_env(); if(status == NFCSTATUS_DESELECTED) { @@ -136,11 +137,12 @@ static void com_android_nfc_jni_open_secure_element_notification_callback(void * jintArray techList; jintArray handleList; jintArray typeList; - nfc_jni_get_technology_tree(pContextData->e, psRemoteDevList,uNofRemoteDev, &techList, + + nfc_jni_get_technology_tree(e, psRemoteDevList,uNofRemoteDev, &techList, &handleList, &typeList); // TODO: Should use the "connected" technology, for now use the first - if (pContextData->e->GetArrayLength(techList) > 0) { - jint* technologies = pContextData->e->GetIntArrayElements(techList, 0); + if (e->GetArrayLength(techList) > 0) { + jint* technologies = e->GetIntArrayElements(techList, 0); SecureElementTech = technologies[0]; TRACE("Store Secure Element Info\n"); SecureElementInfo = psRemoteDevList->psRemoteDevInfo; @@ -162,12 +164,12 @@ static void com_android_nfc_jni_open_secure_element_notification_callback(void * jintArray techList; jintArray handleList; jintArray typeList; - nfc_jni_get_technology_tree(pContextData->e, psRemoteDevList,uNofRemoteDev, &techList, + nfc_jni_get_technology_tree(e, psRemoteDevList,uNofRemoteDev, &techList, &handleList, &typeList); // TODO: Should use the "connected" technology, for now use the first - if ((techList != NULL) && pContextData->e->GetArrayLength(techList) > 0) { - jint* technologies = pContextData->e->GetIntArrayElements(techList, 0); + if ((techList != NULL) && e->GetArrayLength(techList) > 0) { + jint* technologies = e->GetIntArrayElements(techList, 0); SecureElementTech = technologies[0]; TRACE("Store Secure Element Info\n"); SecureElementInfo = psRemoteDevList->psRemoteDevInfo; @@ -212,8 +214,6 @@ static jint com_android_nfc_NativeNfcSecureElement_doOpenSecureElementConnection goto clean_and_return; } - cb_data.e = e; - /* Registery */ registry_info.MifareUL = TRUE; registry_info.MifareStd = TRUE; |