diff options
| -rw-r--r-- | api/current.txt | 1 | ||||
| -rw-r--r-- | core/java/android/nfc/INfcTag.aidl | 1 | ||||
| -rw-r--r-- | core/java/android/nfc/tech/IsoDep.java | 23 |
3 files changed, 25 insertions, 0 deletions
diff --git a/api/current.txt b/api/current.txt index 95007b5670f1..10377fd8e0a9 100644 --- a/api/current.txt +++ b/api/current.txt @@ -12899,6 +12899,7 @@ package android.nfc.tech { method public byte[] getHistoricalBytes(); method public int getMaxTransceiveLength(); method public int getTimeout(); + method public boolean isExtendedLengthApduSupported(); method public void setTimeout(int); method public byte[] transceive(byte[]) throws java.io.IOException; } diff --git a/core/java/android/nfc/INfcTag.aidl b/core/java/android/nfc/INfcTag.aidl index 2223255ec91a..3ac1dcc272b7 100644 --- a/core/java/android/nfc/INfcTag.aidl +++ b/core/java/android/nfc/INfcTag.aidl @@ -45,4 +45,5 @@ interface INfcTag void resetTimeouts(); boolean canMakeReadOnly(int ndefType); int getMaxTransceiveLength(int technology); + boolean getExtendedLengthApdusSupported(); } diff --git a/core/java/android/nfc/tech/IsoDep.java b/core/java/android/nfc/tech/IsoDep.java index 185987786e43..089b1599ec06 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; + } + } } |