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

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

Merge "Implement Felica timeout handling (API)."

parents 081977e4 a924973f
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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();
}
+1 −0
Original line number Diff line number Diff line
@@ -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);
+0 −10
Original line number Diff line number Diff line
@@ -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.
+25 −0
Original line number Diff line number Diff line
@@ -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;

@@ -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 */
@@ -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);
        }
    }
}