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

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

Merge "Support for getTimeout() (API)."

parents 33ef62e5 20e62c9f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -44,5 +44,6 @@ interface INfcTag
    Tag rediscover(int nativehandle);

    int setTimeout(int technology, int timeout);
    int getTimeout(int technology);
    void resetTimeouts();
}
+18 −0
Original line number Diff line number Diff line
@@ -100,6 +100,24 @@ public final class IsoDep extends BasicTagTechnology {
        }
    }

    /**
     * Gets the currently set timeout of {@link #transceive} in milliseconds.
     *
     * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission.
     *
     * @return timeout value in milliseconds
     * @hide
     */
    // TODO Unhide for ICS
    public int getTimeout() {
        try {
            return mTag.getTagService().getTimeout(TagTechnology.ISO_DEP);
        } catch (RemoteException e) {
            Log.e(TAG, "NFC service dead", e);
            return 0;
        }
    }

    /**
     * Return the ISO-DEP historical bytes for {@link NfcA} tags.
     * <p>Does not cause any RF activity and does not block.
+18 −0
Original line number Diff line number Diff line
@@ -597,6 +597,24 @@ public final class MifareClassic extends BasicTagTechnology {
        }
    }

    /**
     * Gets the currently set timeout of {@link #transceive} in milliseconds.
     *
     * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission.
     *
     * @return timeout value in milliseconds
     * @hide
     */
    // TODO Unhide for ICS
    public int getTimeout() {
        try {
            return mTag.getTagService().getTimeout(TagTechnology.MIFARE_CLASSIC);
        } catch (RemoteException e) {
            Log.e(TAG, "NFC service dead", e);
            return 0;
        }
    }

    private static void validateSector(int sector) {
        // Do not be too strict on upper bounds checking, since some cards
        // have more addressable memory than they report. For example,
+18 −0
Original line number Diff line number Diff line
@@ -238,6 +238,24 @@ public final class MifareUltralight extends BasicTagTechnology {
        }
    }

    /**
     * Gets the currently set timeout of {@link #transceive} in milliseconds.
     *
     * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission.
     *
     * @return timeout value in milliseconds
     * @hide
     */
    // TODO Unhide for ICS
    public int getTimeout() {
        try {
            return mTag.getTagService().getTimeout(TagTechnology.MIFARE_ULTRALIGHT);
        } catch (RemoteException e) {
            Log.e(TAG, "NFC service dead", e);
            return 0;
        }
    }

    private static void validatePageIndex(int pageIndex) {
        // Do not be too strict on upper bounds checking, since some cards
        // may have more addressable memory than they report.
+18 −0
Original line number Diff line number Diff line
@@ -141,4 +141,22 @@ public final class NfcA extends BasicTagTechnology {
            Log.e(TAG, "NFC service dead", e);
        }
    }

    /**
     * Gets the currently set timeout of {@link #transceive} in milliseconds.
     *
     * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission.
     *
     * @return timeout value in milliseconds
     * @hide
     */
    // TODO Unhide for ICS
    public int getTimeout() {
        try {
            return mTag.getTagService().getTimeout(TagTechnology.NFC_A);
        } catch (RemoteException e) {
            Log.e(TAG, "NFC service dead", e);
            return 0;
        }
    }
}
Loading