diff options
Diffstat (limited to 'nci')
-rw-r--r-- | nci/jni/NativeLlcpServiceSocket.cpp | 3 | ||||
-rw-r--r-- | nci/jni/NativeNfcManager.cpp | 3 | ||||
-rw-r--r-- | nci/jni/NativeNfcTag.cpp | 5 | ||||
-rwxr-xr-x[-rw-r--r--] | nci/jni/RoutingManager.cpp | 2 | ||||
-rw-r--r-- | nci/jni/extns/pn54x/src/mifare/phFriNfc_MifareStdMap.cpp | 3 | ||||
-rwxr-xr-x | nci/src/com/android/nfc/dhimpl/NativeNfcTag.java | 70 |
6 files changed, 74 insertions, 12 deletions
diff --git a/nci/jni/NativeLlcpServiceSocket.cpp b/nci/jni/NativeLlcpServiceSocket.cpp index 76ffeea5..1000deef 100644 --- a/nci/jni/NativeLlcpServiceSocket.cpp +++ b/nci/jni/NativeLlcpServiceSocket.cpp @@ -119,7 +119,8 @@ static jboolean nativeLlcpServiceSocket_doClose(JNIEnv* e, jobject o) { stat = PeerToPeer::getInstance().deregisterServer(jniServerHandle); - DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: exit", __func__); + DLOG_IF(INFO, nfc_debug_enabled) + << StringPrintf("%s: exit Status=0x%X", __func__, stat); return JNI_TRUE; } diff --git a/nci/jni/NativeNfcManager.cpp b/nci/jni/NativeNfcManager.cpp index a7f9869b..55a27b1f 100644 --- a/nci/jni/NativeNfcManager.cpp +++ b/nci/jni/NativeNfcManager.cpp @@ -1437,7 +1437,8 @@ void nfcManager_disableDiscovery(JNIEnv* e, jobject o) { if (!PowerSwitch::getInstance().setModeOff(PowerSwitch::DISCOVERY)) PowerSwitch::getInstance().setLevel(PowerSwitch::LOW_POWER); TheEnd: - DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: exit", __func__); + DLOG_IF(INFO, nfc_debug_enabled) + << StringPrintf("%s: exit: Status = 0x%X", __func__, status); } /******************************************************************************* diff --git a/nci/jni/NativeNfcTag.cpp b/nci/jni/NativeNfcTag.cpp index 5d20d36e..a99dc941 100644 --- a/nci/jni/NativeNfcTag.cpp +++ b/nci/jni/NativeNfcTag.cpp @@ -315,7 +315,8 @@ static jbyteArray nativeNfcTag_doRead(JNIEnv* e, jobject) { } sReadDataLen = 0; - DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: exit", __func__); + DLOG_IF(INFO, nfc_debug_enabled) + << StringPrintf("%s: exit: Status = 0x%X", __func__, status); return buf; } @@ -1636,6 +1637,8 @@ static jboolean nativeNfcTag_doNdefFormat(JNIEnv* e, jobject o, jbyteArray) { if (sCurrentConnectedTargetProtocol == NFA_PROTOCOL_ISO_DEP) { int retCode = NFCSTATUS_SUCCESS; retCode = nativeNfcTag_doReconnect(e, o); + DLOG_IF(INFO, nfc_debug_enabled) + << StringPrintf("%s Status = 0x%X", __func__, retCode); } DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: exit", __func__); return (status == NFA_STATUS_OK) ? JNI_TRUE : JNI_FALSE; diff --git a/nci/jni/RoutingManager.cpp b/nci/jni/RoutingManager.cpp index 0e0630f4..0887e7c0 100644..100755 --- a/nci/jni/RoutingManager.cpp +++ b/nci/jni/RoutingManager.cpp @@ -654,6 +654,8 @@ void RoutingManager::updateDefaultRoute() { << fn << ": Succeed to register system code"; } else { LOG(ERROR) << fn << ": Fail to register system code"; + // still support SCBR routing for other NFCEEs + mIsScbrSupported = true; } // Register zero lengthy Aid for default Aid Routing diff --git a/nci/jni/extns/pn54x/src/mifare/phFriNfc_MifareStdMap.cpp b/nci/jni/extns/pn54x/src/mifare/phFriNfc_MifareStdMap.cpp index 5fcf693b..05d3258b 100644 --- a/nci/jni/extns/pn54x/src/mifare/phFriNfc_MifareStdMap.cpp +++ b/nci/jni/extns/pn54x/src/mifare/phFriNfc_MifareStdMap.cpp @@ -320,7 +320,7 @@ NFCSTATUS phFriNfc_MifareStdMap_H_Reset(phFriNfc_NdefMap_t* NdefMap) { ******************************************************************************/ NFCSTATUS phFriNfc_MifareStdMap_ChkNdef(phFriNfc_NdefMap_t* NdefMap) { NFCSTATUS status = NFCSTATUS_PENDING; - uint8_t atq, sak; + uint8_t sak; if (NdefMap == NULL) { status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP, NFCSTATUS_INVALID_PARAMETER); @@ -331,7 +331,6 @@ NFCSTATUS phFriNfc_MifareStdMap_ChkNdef(phFriNfc_NdefMap_t* NdefMap) { /* Get the Select Response and Sense Response to get the exact Card Type either Mifare 1k or 4k */ sak = NdefMap->psRemoteDevInfo->RemoteDevInfo.Iso14443A_Info.Sak; - atq = NdefMap->psRemoteDevInfo->RemoteDevInfo.Iso14443A_Info.AtqA[0]; if (0x08 == (sak & 0x18)) { /* Total Number of Blocks in Mifare 1k Card */ diff --git a/nci/src/com/android/nfc/dhimpl/NativeNfcTag.java b/nci/src/com/android/nfc/dhimpl/NativeNfcTag.java index 671ea2b2..117bf3ae 100755 --- a/nci/src/com/android/nfc/dhimpl/NativeNfcTag.java +++ b/nci/src/com/android/nfc/dhimpl/NativeNfcTag.java @@ -17,9 +17,6 @@ package com.android.nfc.dhimpl; import android.annotation.Nullable; -import com.android.nfc.DeviceHost; -import com.android.nfc.DeviceHost.TagEndpoint; - import android.nfc.FormatException; import android.nfc.NdefMessage; import android.nfc.tech.IsoDep; @@ -28,13 +25,16 @@ import android.nfc.tech.MifareUltralight; import android.nfc.tech.Ndef; import android.nfc.tech.NfcA; import android.nfc.tech.NfcB; +import android.nfc.tech.NfcBarcode; import android.nfc.tech.NfcF; import android.nfc.tech.NfcV; -import android.nfc.tech.NfcBarcode; import android.nfc.tech.TagTechnology; import android.os.Bundle; import android.util.Log; +import com.android.nfc.DeviceHost; +import com.android.nfc.DeviceHost.TagEndpoint; + /** * Native interface to the NFC tag functions */ @@ -50,6 +50,8 @@ public class NativeNfcTag implements TagEndpoint { private byte[][] mTechPollBytes; private byte[][] mTechActBytes; private byte[] mUid; + // Based on flag send T2T tag classification request + private boolean mClassifyT2T = true; // mConnectedHandle stores the *real* libnfc handle // that we're connected to. @@ -284,6 +286,7 @@ public class NativeNfcTag implements TagEndpoint { mConnectedTechIndex = -1; mConnectedHandle = -1; + mClassifyT2T = true; return result; } @@ -339,9 +342,16 @@ public class NativeNfcTag implements TagEndpoint { } return status; } + @Override public synchronized boolean checkNdef(int[] ndefinfo) { - return checkNdefWithStatus(ndefinfo) == 0; + boolean status = false; + if (hasTech(TagTechnology.NDEF)) { + status = true; + } else { + status = checkNdefWithStatus(ndefinfo) == 0; + } + return status; } private native byte[] doRead(); @@ -726,8 +736,10 @@ public class NativeNfcTag implements TagEndpoint { } case TagTechnology.MIFARE_ULTRALIGHT: { - boolean isUlc = isUltralightC(); - extras.putBoolean(MifareUltralight.EXTRA_IS_UL_C, isUlc); + if (mClassifyT2T) { + boolean isUlc = isUltralightC(); + extras.putBoolean(MifareUltralight.EXTRA_IS_UL_C, isUlc); + } break; } @@ -845,4 +857,48 @@ public class NativeNfcTag implements TagEndpoint { return ndefMsg; } + + @Override + public void findNdef() { + int[] technologies = getTechList(); + int[] handles = mTechHandles; + int currHandle = 0; + mClassifyT2T = !hasTech(TagTechnology.MIFARE_ULTRALIGHT); + + for (int techIndex = 0; techIndex < technologies.length; techIndex++) { + if (currHandle != handles[techIndex]) { + currHandle = handles[techIndex]; + int status = connectWithStatus(technologies[techIndex]); + if (status != 0) { + Log.d(TAG, "Connect Failed - status = " + status); + if (status == STATUS_CODE_TARGET_LOST) { + break; + } + continue; // try next handle + } + + int[] ndefinfo = new int[2]; + status = checkNdefWithStatus(ndefinfo); + if (status != 0) { + Log.d(TAG, "findNdef: Check NDEF Failed - status = " + + status); + if (status == STATUS_CODE_TARGET_LOST) { + break; + } + continue; // try next handle + } else { + int supportedNdefLength = ndefinfo[0]; + int cardState = ndefinfo[1]; + addNdefTechnology(null, + getConnectedHandle(), + getConnectedLibNfcType(), + getConnectedTechnology(), + supportedNdefLength, cardState); + break; + } + } else { + Log.d(TAG, "findNdef: Duplicate techIndex = " + techIndex); + } + } + } } |