summaryrefslogtreecommitdiffstats
path: root/core/java/android/nfc/tech
diff options
context:
space:
mode:
authorMartijn Coenen <maco@google.com>2012-04-02 15:56:07 -0700
committerMartijn Coenen <maco@google.com>2012-04-04 10:43:06 -0700
commitfa98cf0573b813c8b1a880496d847d0d7183d05d (patch)
tree2b39aabeec8665271907c0da4d6bce26bd019453 /core/java/android/nfc/tech
parent935a15ebed0e347667b9fe11e69b1a79df33569a (diff)
downloadframeworks_base-fa98cf0573b813c8b1a880496d847d0d7183d05d.zip
frameworks_base-fa98cf0573b813c8b1a880496d847d0d7183d05d.tar.gz
frameworks_base-fa98cf0573b813c8b1a880496d847d0d7183d05d.tar.bz2
Add API for querying extended length APDU support.
Bug: 5813943 Change-Id: Iffb415f318e095bde9ed6677b22613d210f8a39c
Diffstat (limited to 'core/java/android/nfc/tech')
-rw-r--r--core/java/android/nfc/tech/IsoDep.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/core/java/android/nfc/tech/IsoDep.java b/core/java/android/nfc/tech/IsoDep.java
index 1859877..089b159 100644
--- a/core/java/android/nfc/tech/IsoDep.java
+++ b/core/java/android/nfc/tech/IsoDep.java
@@ -179,4 +179,27 @@ public final class IsoDep extends BasicTagTechnology {
public int getMaxTransceiveLength() {
return getMaxTransceiveLengthInternal();
}
+
+ /**
+ * <p>Standard APDUs have a 1-byte length field, allowing a maximum of
+ * 255 payload bytes, which results in a maximum APDU length of 261 bytes.
+ *
+ * <p>Extended length APDUs have a 3-byte length field, allowing 65535
+ * payload bytes.
+ *
+ * <p>Some NFC adapters, like the one used in the Nexus S and the Galaxy Nexus
+ * do not support extended length APDUs. They are expected to be well-supported
+ * in the future though. Use this method to check for extended length APDU
+ * support.
+ *
+ * @return whether the NFC adapter on this device supports extended length APDUs.
+ */
+ public boolean isExtendedLengthApduSupported() {
+ try {
+ return mTag.getTagService().getExtendedLengthApdusSupported();
+ } catch (RemoteException e) {
+ Log.e(TAG, "NFC service dead", e);
+ return false;
+ }
+ }
}