Loading core/java/android/nfc/INfcTag.aidl +2 −1 Original line number Diff line number Diff line Loading @@ -42,5 +42,6 @@ interface INfcTag int formatNdef(int nativeHandle, in byte[] key); void setIsoDepTimeout(int timeout); void resetIsoDepTimeout(); void setFelicaTimeout(int timeout); void resetTimeouts(); } core/java/android/nfc/tech/BasicTagTechnology.java +1 −0 Original line number Diff line number Diff line Loading @@ -119,6 +119,7 @@ import java.io.IOException; /* Note that we don't want to physically disconnect the tag, * but just reconnect to it to reset its state */ mTag.getTagService().resetTimeouts(); mTag.getTagService().reconnect(mTag.getServiceHandle()); } catch (RemoteException e) { Log.e(TAG, "NFC service dead", e); Loading core/java/android/nfc/tech/IsoDep.java +0 −10 Original line number Diff line number Diff line Loading @@ -96,16 +96,6 @@ public final class IsoDep extends BasicTagTechnology { } } @Override public void close() throws IOException { try { mTag.getTagService().resetIsoDepTimeout(); } catch (RemoteException e) { Log.e(TAG, "NFC service dead", e); } super.close(); } /** * Return the ISO-DEP historical bytes for {@link NfcA} tags. * <p>Does not cause any RF activity and does not block. Loading core/java/android/nfc/tech/NfcF.java +25 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package android.nfc.tech; import android.nfc.Tag; import android.os.Bundle; import android.os.RemoteException; import android.util.Log; import java.io.IOException; Loading @@ -33,6 +34,8 @@ import java.io.IOException; * require the {@link android.Manifest.permission#NFC} permission. */ public final class NfcF extends BasicTagTechnology { private static final String TAG = "NFC"; /** @hide */ public static final String EXTRA_SC = "systemcode"; /** @hide */ Loading Loading @@ -111,4 +114,26 @@ public final class NfcF extends BasicTagTechnology { public byte[] transceive(byte[] data) throws IOException { return transceive(data, true); } /** * Set the timeout of {@link #transceive} in milliseconds. * <p>The timeout only applies to NfcF {@link #transceive}, and is * reset to a default value when {@link #close} is called. * <p>Setting a longer timeout may be useful when performing * transactions that require a long processing time on the tag * such as key generation. * * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. * * @param timeout timeout value in milliseconds * @hide */ // TODO Unhide for ICS public void setTimeout(int timeout) { try { mTag.getTagService().setFelicaTimeout(timeout); } catch (RemoteException e) { Log.e(TAG, "NFC service dead", e); } } } Loading
core/java/android/nfc/INfcTag.aidl +2 −1 Original line number Diff line number Diff line Loading @@ -42,5 +42,6 @@ interface INfcTag int formatNdef(int nativeHandle, in byte[] key); void setIsoDepTimeout(int timeout); void resetIsoDepTimeout(); void setFelicaTimeout(int timeout); void resetTimeouts(); }
core/java/android/nfc/tech/BasicTagTechnology.java +1 −0 Original line number Diff line number Diff line Loading @@ -119,6 +119,7 @@ import java.io.IOException; /* Note that we don't want to physically disconnect the tag, * but just reconnect to it to reset its state */ mTag.getTagService().resetTimeouts(); mTag.getTagService().reconnect(mTag.getServiceHandle()); } catch (RemoteException e) { Log.e(TAG, "NFC service dead", e); Loading
core/java/android/nfc/tech/IsoDep.java +0 −10 Original line number Diff line number Diff line Loading @@ -96,16 +96,6 @@ public final class IsoDep extends BasicTagTechnology { } } @Override public void close() throws IOException { try { mTag.getTagService().resetIsoDepTimeout(); } catch (RemoteException e) { Log.e(TAG, "NFC service dead", e); } super.close(); } /** * Return the ISO-DEP historical bytes for {@link NfcA} tags. * <p>Does not cause any RF activity and does not block. Loading
core/java/android/nfc/tech/NfcF.java +25 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package android.nfc.tech; import android.nfc.Tag; import android.os.Bundle; import android.os.RemoteException; import android.util.Log; import java.io.IOException; Loading @@ -33,6 +34,8 @@ import java.io.IOException; * require the {@link android.Manifest.permission#NFC} permission. */ public final class NfcF extends BasicTagTechnology { private static final String TAG = "NFC"; /** @hide */ public static final String EXTRA_SC = "systemcode"; /** @hide */ Loading Loading @@ -111,4 +114,26 @@ public final class NfcF extends BasicTagTechnology { public byte[] transceive(byte[] data) throws IOException { return transceive(data, true); } /** * Set the timeout of {@link #transceive} in milliseconds. * <p>The timeout only applies to NfcF {@link #transceive}, and is * reset to a default value when {@link #close} is called. * <p>Setting a longer timeout may be useful when performing * transactions that require a long processing time on the tag * such as key generation. * * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. * * @param timeout timeout value in milliseconds * @hide */ // TODO Unhide for ICS public void setTimeout(int timeout) { try { mTag.getTagService().setFelicaTimeout(timeout); } catch (RemoteException e) { Log.e(TAG, "NFC service dead", e); } } }