Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 30bd284c authored by Martijn Coenen's avatar Martijn Coenen Committed by Android (Google) Code Review
Browse files

Merge "Add API for querying extended length APDU support."

parents 1899b731 fa98cf05
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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;
  }
+1 −0
Original line number Diff line number Diff line
@@ -45,4 +45,5 @@ interface INfcTag
    void resetTimeouts();
    boolean canMakeReadOnly(int ndefType);
    int getMaxTransceiveLength(int technology);
    boolean getExtendedLengthApdusSupported();
}
+23 −0
Original line number Diff line number Diff line
@@ -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;
        }
    }
}