diff options
author | George Chang <georgekgchang@google.com> | 2022-03-14 16:42:10 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2022-03-14 16:42:10 +0000 |
commit | f3558d4059472da398408ede274841d836796509 (patch) | |
tree | 03f6fd37a27c0f8c9717bac6393de41dd04ee083 /nci | |
parent | ef01875944a9ebf9545172b714c859b8baf43a64 (diff) | |
parent | ccfe51091ec4c8911e6ed6b595192f23662917b1 (diff) | |
download | Nfc-f3558d4059472da398408ede274841d836796509.tar.gz |
Merge "Added system property to skip ndef read"
Diffstat (limited to 'nci')
-rwxr-xr-x | nci/src/com/android/nfc/dhimpl/NativeNfcTag.java | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/nci/src/com/android/nfc/dhimpl/NativeNfcTag.java b/nci/src/com/android/nfc/dhimpl/NativeNfcTag.java index 155d47b9..700f0999 100755 --- a/nci/src/com/android/nfc/dhimpl/NativeNfcTag.java +++ b/nci/src/com/android/nfc/dhimpl/NativeNfcTag.java @@ -852,4 +852,47 @@ public class NativeNfcTag implements TagEndpoint { return ndefMsg; } + + @Override + public void findNdef() { + int[] technologies = getTechList(); + int[] handles = mTechHandles; + int currHandle = 0; + + 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); + } + } + } } |