summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartijn Coenen <maco@google.com>2012-10-09 15:38:32 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-10-09 15:38:32 -0700
commitec490fae97254443feacf17a2bdb47b2bce74be0 (patch)
tree4394d69e442137c52896ac716799859c154c741e
parenta9f1c762f3ac37d68b8c504146e851043f03de07 (diff)
parentaccbb8c908d764c5f0b8030480f3e84f0f319ff5 (diff)
downloadpackages_apps_nfc-ec490fae97254443feacf17a2bdb47b2bce74be0.zip
packages_apps_nfc-ec490fae97254443feacf17a2bdb47b2bce74be0.tar.gz
packages_apps_nfc-ec490fae97254443feacf17a2bdb47b2bce74be0.tar.bz2
am accbb8c9: Don\'t return target lost in case of NACK for T2T.
* commit 'accbb8c908d764c5f0b8030480f3e84f0f319ff5': Don't return target lost in case of NACK for T2T.
-rwxr-xr-xnci/jni/NativeNfcTag.cpp26
1 files changed, 12 insertions, 14 deletions
diff --git a/nci/jni/NativeNfcTag.cpp b/nci/jni/NativeNfcTag.cpp
index 8c0426b..0ba7b21 100755
--- a/nci/jni/NativeNfcTag.cpp
+++ b/nci/jni/NativeNfcTag.cpp
@@ -806,6 +806,7 @@ static jbyteArray nativeNfcTag_doTransceive (JNIEnv *e, jobject o, jbyteArray da
bool fNeedToSwitchBack = false;
nfc_jni_native_data *nat = getNative (0, 0);
bool waitOk = false;
+ bool isNack = false;
uint8_t *buf = NULL;
uint32_t bufLen = 0;
jint *targetLost = NULL;
@@ -884,24 +885,21 @@ static jbyteArray nativeNfcTag_doTransceive (JNIEnv *e, jobject o, jbyteArray da
if ((natTag.getProtocol () == NFA_PROTOCOL_T2T) &&
natTag.isT2tNackResponse (sTransceiveData, sTransceiveDataLen))
{
- if (targetLost)
- {
- ALOGD ("%s: t2t nack", __FUNCTION__);
- *targetLost = 1; //causes NFC service to throw TagLostException
- }
- break;
+ isNack = true;
}
if (sTransceiveDataLen)
{
- // marshall data to java for return
- result = e->NewByteArray (sTransceiveDataLen);
- if (result != NULL)
- {
- e->SetByteArrayRegion (result, 0, sTransceiveDataLen, (jbyte *) sTransceiveData);
- }
- else
- ALOGE ("%s: Failed to allocate java byte array", __FUNCTION__);
+ if (!isNack) {
+ // marshall data to java for return
+ result = e->NewByteArray (sTransceiveDataLen);
+ if (result != NULL)
+ {
+ e->SetByteArrayRegion (result, 0, sTransceiveDataLen, (jbyte *) sTransceiveData);
+ }
+ else
+ ALOGE ("%s: Failed to allocate java byte array", __FUNCTION__);
+ } // else a nack is treated as a transceive failure to the upper layers
free (sTransceiveData);
sTransceiveData = NULL;