diff options
Diffstat (limited to 'nci')
-rwxr-xr-x | nci/jni/NfcTag.cpp | 20 | ||||
-rwxr-xr-x | nci/src/com/android/nfc/dhimpl/NativeNfcTag.java | 9 |
2 files changed, 28 insertions, 1 deletions
diff --git a/nci/jni/NfcTag.cpp b/nci/jni/NfcTag.cpp index 5af2b79e..e161e7f3 100755 --- a/nci/jni/NfcTag.cpp +++ b/nci/jni/NfcTag.cpp @@ -36,6 +36,7 @@ using android::base::StringPrintf; extern bool nfc_debug_enabled; static void deleteglobaldata(JNIEnv* e); static jobjectArray sTechPollBytes; +static jobjectArray gtechActBytes; static int sLastSelectedTagId = 0; /******************************************************************************* @@ -558,6 +559,9 @@ static void deleteglobaldata(JNIEnv* e) { if (sTechPollBytes != NULL) { e->DeleteGlobalRef(sTechPollBytes); } + if (gtechActBytes != NULL) { + e->DeleteGlobalRef(gtechActBytes); + } DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: exit", fn); } @@ -814,7 +818,16 @@ void NfcTag::fillNativeNfcTagMembers4(JNIEnv* e, jclass tag_cls, jobject tag, e->SetObjectArrayElement(techActBytes.get(), i, actBytes.get()); } } - + jobject gtechActBytesObject; + if (mTechListTail == 0) { + gtechActBytes = + reinterpret_cast<jobjectArray>(e->NewGlobalRef(techActBytes.get())); + } else { + for (int j = 0; j < mTechListTail; j++) { + gtechActBytesObject = e->GetObjectArrayElement(gtechActBytes, j); + e->SetObjectArrayElement(techActBytes.get(), j, gtechActBytesObject); + } + } for (int i = mTechListTail; i < mNumTechList; i++) { DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: index=%d", fn, i); if (NFC_PROTOCOL_T1T == mTechLibNfcTypes[i] || @@ -922,6 +935,11 @@ void NfcTag::fillNativeNfcTagMembers4(JNIEnv* e, jclass tag_cls, jobject tag, } e->SetObjectArrayElement(techActBytes.get(), i, actBytes.get()); } // for: every technology in the array of current selected tag + if (gtechActBytes != NULL && mTechListTail != 0) { + e->DeleteGlobalRef(gtechActBytes); + gtechActBytes = + reinterpret_cast<jobjectArray>(e->NewGlobalRef(techActBytes.get())); + } jfieldID f = e->GetFieldID(tag_cls, "mTechActBytes", "[[B"); e->SetObjectField(tag, f, techActBytes.get()); } diff --git a/nci/src/com/android/nfc/dhimpl/NativeNfcTag.java b/nci/src/com/android/nfc/dhimpl/NativeNfcTag.java index 117bf3ae..2b400344 100755 --- a/nci/src/com/android/nfc/dhimpl/NativeNfcTag.java +++ b/nci/src/com/android/nfc/dhimpl/NativeNfcTag.java @@ -743,6 +743,15 @@ public class NativeNfcTag implements TagEndpoint { break; } + case TagTechnology.MIFARE_CLASSIC: { + byte[] actBytes = mTechActBytes[i]; + if ((actBytes != null) && (actBytes.length > 0)) { + extras.putShort(NfcA.EXTRA_SAK, (short) (actBytes[0] & (short) 0xFF)); + } + extras.putByteArray(NfcA.EXTRA_ATQA, mTechPollBytes[i]); + break; + } + case TagTechnology.NFC_BARCODE: { // hard code this for now, this is the only valid type extras.putInt(NfcBarcode.EXTRA_BARCODE_TYPE, NfcBarcode.TYPE_KOVIO); |