Loading core/java/android/nfc/NfcAdapter.java +9 −2 Original line number Original line Diff line number Diff line Loading @@ -37,7 +37,6 @@ import android.util.Log; * <p> * <p> * Use the helper {@link #getDefaultAdapter(Context)} to get the default NFC * Use the helper {@link #getDefaultAdapter(Context)} to get the default NFC * adapter for this Android device. * adapter for this Android device. * <p> */ */ public final class NfcAdapter { public final class NfcAdapter { private static final String TAG = "NFC"; private static final String TAG = "NFC"; Loading Loading @@ -437,6 +436,8 @@ public final class NfcAdapter { * the completion of their {@link Activity#onPause} callback to disable foreground dispatch * the completion of their {@link Activity#onPause} callback to disable foreground dispatch * after it has been enabled. * after it has been enabled. * * * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. * * @param activity the Activity to dispatch to * @param activity the Activity to dispatch to * @param intent the PendingIntent to start for the dispatch * @param intent the PendingIntent to start for the dispatch * @param filters the IntentFilters to override dispatching for, or null to always dispatch * @param filters the IntentFilters to override dispatching for, or null to always dispatch Loading Loading @@ -476,6 +477,8 @@ public final class NfcAdapter { * * * <p>This method must be called from the main thread. * <p>This method must be called from the main thread. * * * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. * * @param activity the Activity to disable dispatch to * @param activity the Activity to disable dispatch to * @throws IllegalStateException if the Activity has already been paused * @throws IllegalStateException if the Activity has already been paused */ */ Loading Loading @@ -513,10 +516,12 @@ public final class NfcAdapter { * * * <p>This method must be called from the main thread. * <p>This method must be called from the main thread. * * * <p><em>NOTE</em> While foreground NDEF push is active standard tag dispatch is disabled. * <p class="note"><em>NOTE:</em> While foreground NDEF push is active standard tag dispatch is disabled. * Only the foreground activity may receive tag discovered dispatches via * Only the foreground activity may receive tag discovered dispatches via * {@link #enableForegroundDispatch}. * {@link #enableForegroundDispatch}. * * * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. * * @param activity the foreground Activity * @param activity the foreground Activity * @param msg a NDEF Message to push over P2P * @param msg a NDEF Message to push over P2P * @throws IllegalStateException if the Activity is not currently in the foreground * @throws IllegalStateException if the Activity is not currently in the foreground Loading Loading @@ -548,6 +553,8 @@ public final class NfcAdapter { * * * <p>This method must be called from the main thread. * <p>This method must be called from the main thread. * * * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. * * @param activity the Foreground activity * @param activity the Foreground activity * @throws IllegalStateException if the Activity has already been paused * @throws IllegalStateException if the Activity has already been paused * @throws OperationNotSupportedException if this Android device does not support NDEF push * @throws OperationNotSupportedException if this Android device does not support NDEF push Loading core/java/android/nfc/tech/IsoDep.java +9 −1 Original line number Original line Diff line number Diff line Loading @@ -26,12 +26,15 @@ import java.io.IOException; /** /** * Provides access to ISO-DEP (ISO 14443-4) properties and I/O operations on a {@link Tag}. * Provides access to ISO-DEP (ISO 14443-4) properties and I/O operations on a {@link Tag}. * * * <p>Acquire a {@link IsoDep} object using {@link #get}. * <p>Acquire an {@link IsoDep} object using {@link #get}. * <p>The primary ISO-DEP I/O operation is {@link #transceive}. Applications must * <p>The primary ISO-DEP I/O operation is {@link #transceive}. Applications must * implement their own protocol stack on top of {@link #transceive}. * implement their own protocol stack on top of {@link #transceive}. * <p>Tags that enumerate the {@link IsoDep} technology in {@link Tag#getTechList} * <p>Tags that enumerate the {@link IsoDep} technology in {@link Tag#getTechList} * will also enumerate * will also enumerate * {@link NfcA} or {@link NfcB} (since IsoDep builds on top of either of these). * {@link NfcA} or {@link NfcB} (since IsoDep builds on top of either of these). * * <p class="note"><strong>Note:</strong> Methods that perform I/O operations * require the {@link android.Manifest.permission#NFC} permission. */ */ public final class IsoDep extends BasicTagTechnology { public final class IsoDep extends BasicTagTechnology { private static final String TAG = "NFC"; private static final String TAG = "NFC"; Loading Loading @@ -80,6 +83,9 @@ public final class IsoDep extends BasicTagTechnology { * <p>Setting a longer timeout may be useful when performing * <p>Setting a longer timeout may be useful when performing * transactions that require a long processing time on the tag * transactions that require a long processing time on the tag * such as key generation. * such as key generation. * * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. * * @param timeout timeout value in milliseconds * @param timeout timeout value in milliseconds */ */ public void setTimeout(int timeout) { public void setTimeout(int timeout) { Loading Loading @@ -142,6 +148,8 @@ public final class IsoDep extends BasicTagTechnology { * not be called from the main application thread. A blocked call will be canceled with * not be called from the main application thread. A blocked call will be canceled with * {@link IOException} if {@link #close} is called from another thread. * {@link IOException} if {@link #close} is called from another thread. * * * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. * * @param data command bytes to send, must not be null * @param data command bytes to send, must not be null * @return response bytes received, will not be null * @return response bytes received, will not be null * @throws TagLostException if the tag leaves the field * @throws TagLostException if the tag leaves the field Loading core/java/android/nfc/tech/MifareClassic.java +22 −1 Original line number Original line Diff line number Diff line Loading @@ -55,7 +55,7 @@ import java.nio.ByteOrder; * MIFARE Classic cards that have been formatted according to the * MIFARE Classic cards that have been formatted according to the * MIFARE Application Directory (MAD) specification. * MIFARE Application Directory (MAD) specification. * <li>{@link #KEY_NFC_FORUM} is the well-known key for MIFARE Classic cards that * <li>{@link #KEY_NFC_FORUM} is the well-known key for MIFARE Classic cards that * have been formatted according to the NFC * have been formatted according to the NXP specification for NDEF on MIFARE Classic. * * * <p>Implementation of this class on a Android NFC device is optional. * <p>Implementation of this class on a Android NFC device is optional. * If it is not implemented, then * If it is not implemented, then Loading @@ -64,6 +64,9 @@ import java.nio.ByteOrder; * and {@link Ndef#MIFARE_CLASSIC} NDEF tags will also be supported. In either case, * and {@link Ndef#MIFARE_CLASSIC} NDEF tags will also be supported. In either case, * {@link NfcA} will also be enumerated on the tag, because all MIFARE Classic tags are also * {@link NfcA} will also be enumerated on the tag, because all MIFARE Classic tags are also * {@link NfcA}. * {@link NfcA}. * * <p class="note"><strong>Note:</strong> Methods that perform I/O operations * require the {@link android.Manifest.permission#NFC} permission. */ */ public final class MifareClassic extends BasicTagTechnology { public final class MifareClassic extends BasicTagTechnology { /** /** Loading Loading @@ -319,6 +322,8 @@ public final class MifareClassic extends BasicTagTechnology { * not be called from the main application thread. A blocked call will be canceled with * not be called from the main application thread. A blocked call will be canceled with * {@link IOException} if {@link #close} is called from another thread. * {@link IOException} if {@link #close} is called from another thread. * * * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. * * @param sectorIndex index of sector to authenticate, starting from 0 * @param sectorIndex index of sector to authenticate, starting from 0 * @param key 6-byte authentication key * @param key 6-byte authentication key * @return true on success, false on authentication failure * @return true on success, false on authentication failure Loading @@ -344,6 +349,8 @@ public final class MifareClassic extends BasicTagTechnology { * not be called from the main application thread. A blocked call will be canceled with * not be called from the main application thread. A blocked call will be canceled with * {@link IOException} if {@link #close} is called from another thread. * {@link IOException} if {@link #close} is called from another thread. * * * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. * * @param sectorIndex index of sector to authenticate, starting from 0 * @param sectorIndex index of sector to authenticate, starting from 0 * @param key 6-byte authentication key * @param key 6-byte authentication key * @return true on success, false on authentication failure * @return true on success, false on authentication failure Loading Loading @@ -398,6 +405,8 @@ public final class MifareClassic extends BasicTagTechnology { * not be called from the main application thread. A blocked call will be canceled with * not be called from the main application thread. A blocked call will be canceled with * {@link IOException} if {@link #close} is called from another thread. * {@link IOException} if {@link #close} is called from another thread. * * * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. * * @param blockIndex index of block to read, starting from 0 * @param blockIndex index of block to read, starting from 0 * @return 16 byte block * @return 16 byte block * @throws TagLostException if the tag leaves the field * @throws TagLostException if the tag leaves the field Loading @@ -418,6 +427,8 @@ public final class MifareClassic extends BasicTagTechnology { * not be called from the main application thread. A blocked call will be canceled with * not be called from the main application thread. A blocked call will be canceled with * {@link IOException} if {@link #close} is called from another thread. * {@link IOException} if {@link #close} is called from another thread. * * * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. * * @param blockIndex index of block to write, starting from 0 * @param blockIndex index of block to write, starting from 0 * @param data 16 bytes of data to write * @param data 16 bytes of data to write * @throws TagLostException if the tag leaves the field * @throws TagLostException if the tag leaves the field Loading Loading @@ -445,6 +456,8 @@ public final class MifareClassic extends BasicTagTechnology { * not be called from the main application thread. A blocked call will be canceled with * not be called from the main application thread. A blocked call will be canceled with * {@link IOException} if {@link #close} is called from another thread. * {@link IOException} if {@link #close} is called from another thread. * * * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. * * @param blockIndex index of block to increment, starting from 0 * @param blockIndex index of block to increment, starting from 0 * @param value non-negative to increment by * @param value non-negative to increment by * @throws TagLostException if the tag leaves the field * @throws TagLostException if the tag leaves the field Loading @@ -471,6 +484,8 @@ public final class MifareClassic extends BasicTagTechnology { * not be called from the main application thread. A blocked call will be canceled with * not be called from the main application thread. A blocked call will be canceled with * {@link IOException} if {@link #close} is called from another thread. * {@link IOException} if {@link #close} is called from another thread. * * * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. * * @param blockIndex index of block to decrement, starting from 0 * @param blockIndex index of block to decrement, starting from 0 * @param value non-negative to decrement by * @param value non-negative to decrement by * @throws TagLostException if the tag leaves the field * @throws TagLostException if the tag leaves the field Loading @@ -497,6 +512,8 @@ public final class MifareClassic extends BasicTagTechnology { * not be called from the main application thread. A blocked call will be canceled with * not be called from the main application thread. A blocked call will be canceled with * {@link IOException} if {@link #close} is called from another thread. * {@link IOException} if {@link #close} is called from another thread. * * * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. * * @param blockIndex index of block to copy to * @param blockIndex index of block to copy to * @throws TagLostException if the tag leaves the field * @throws TagLostException if the tag leaves the field * @throws IOException if there is an I/O failure, or the operation is canceled * @throws IOException if there is an I/O failure, or the operation is canceled Loading @@ -517,6 +534,8 @@ public final class MifareClassic extends BasicTagTechnology { * not be called from the main application thread. A blocked call will be canceled with * not be called from the main application thread. A blocked call will be canceled with * {@link IOException} if {@link #close} is called from another thread. * {@link IOException} if {@link #close} is called from another thread. * * * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. * * @param blockIndex index of block to copy from * @param blockIndex index of block to copy from * @throws TagLostException if the tag leaves the field * @throws TagLostException if the tag leaves the field * @throws IOException if there is an I/O failure, or the operation is canceled * @throws IOException if there is an I/O failure, or the operation is canceled Loading @@ -541,6 +560,8 @@ public final class MifareClassic extends BasicTagTechnology { * not be called from the main application thread. A blocked call will be canceled with * not be called from the main application thread. A blocked call will be canceled with * {@link IOException} if {@link #close} is called from another thread. * {@link IOException} if {@link #close} is called from another thread. * * * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. * * @see NfcA#transceive * @see NfcA#transceive */ */ public byte[] transceive(byte[] data) throws IOException { public byte[] transceive(byte[] data) throws IOException { Loading core/java/android/nfc/tech/MifareUltralight.java +9 −0 Original line number Original line Diff line number Diff line Loading @@ -51,6 +51,9 @@ import java.io.IOException; * If it is enumerated, then all {@link MifareUltralight} I/O operations will be supported. * If it is enumerated, then all {@link MifareUltralight} I/O operations will be supported. * In either case, {@link NfcA} will also be enumerated on the tag, * In either case, {@link NfcA} will also be enumerated on the tag, * because all MIFARE Ultralight tags are also {@link NfcA} tags. * because all MIFARE Ultralight tags are also {@link NfcA} tags. * * <p class="note"><strong>Note:</strong> Methods that perform I/O operations * require the {@link android.Manifest.permission#NFC} permission. */ */ public final class MifareUltralight extends BasicTagTechnology { public final class MifareUltralight extends BasicTagTechnology { /** A MIFARE Ultralight compatible tag of unknown type */ /** A MIFARE Ultralight compatible tag of unknown type */ Loading Loading @@ -136,6 +139,8 @@ public final class MifareUltralight extends BasicTagTechnology { * not be called from the main application thread. A blocked call will be canceled with * not be called from the main application thread. A blocked call will be canceled with * {@link IOException} if {@link #close} is called from another thread. * {@link IOException} if {@link #close} is called from another thread. * * * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. * * @param pageOffset index of first page to read, starting from 0 * @param pageOffset index of first page to read, starting from 0 * @return 4 pages (16 bytes) * @return 4 pages (16 bytes) * @throws TagLostException if the tag leaves the field * @throws TagLostException if the tag leaves the field Loading @@ -159,6 +164,8 @@ public final class MifareUltralight extends BasicTagTechnology { * not be called from the main application thread. A blocked call will be canceled with * not be called from the main application thread. A blocked call will be canceled with * {@link IOException} if {@link #close} is called from another thread. * {@link IOException} if {@link #close} is called from another thread. * * * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. * * @param pageOffset index of page to write, starting from 0 * @param pageOffset index of page to write, starting from 0 * @param data 4 bytes to write * @param data 4 bytes to write * @throws TagLostException if the tag leaves the field * @throws TagLostException if the tag leaves the field Loading Loading @@ -187,6 +194,8 @@ public final class MifareUltralight extends BasicTagTechnology { * not be called from the main application thread. A blocked call will be canceled with * not be called from the main application thread. A blocked call will be canceled with * {@link IOException} if {@link #close} is called from another thread. * {@link IOException} if {@link #close} is called from another thread. * * * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. * * @see NfcA#transceive * @see NfcA#transceive */ */ public byte[] transceive(byte[] data) throws IOException { public byte[] transceive(byte[] data) throws IOException { Loading core/java/android/nfc/tech/Ndef.java +7 −4 Original line number Original line Diff line number Diff line Loading @@ -44,7 +44,7 @@ import java.io.IOException; * formatted to contain NDEF data. * formatted to contain NDEF data. * <ul> * <ul> * <li>NFC Forum Type 1 Tag ({@link #NFC_FORUM_TYPE_1}), such as the Innovision Topaz * <li>NFC Forum Type 1 Tag ({@link #NFC_FORUM_TYPE_1}), such as the Innovision Topaz * <li>NFC Forum Type 2 Tag ({@link #NFC_FORUM_TYPE_2}), such as the NXP Mifare Ultralight * <li>NFC Forum Type 2 Tag ({@link #NFC_FORUM_TYPE_2}), such as the NXP MIFARE Ultralight * <li>NFC Forum Type 3 Tag ({@link #NFC_FORUM_TYPE_3}), such as Sony Felica * <li>NFC Forum Type 3 Tag ({@link #NFC_FORUM_TYPE_3}), such as Sony Felica * <li>NFC Forum Type 4 Tag ({@link #NFC_FORUM_TYPE_4}), such as NXP MIFARE Desfire * <li>NFC Forum Type 4 Tag ({@link #NFC_FORUM_TYPE_4}), such as NXP MIFARE Desfire * </ul> * </ul> Loading @@ -66,9 +66,8 @@ import java.io.IOException; * recommended to use NFC Forum Types 1-4 in new deployments of NFC tags * recommended to use NFC Forum Types 1-4 in new deployments of NFC tags * with NDEF payload. Vendor NDEF formats will not work on all Android devices. * with NDEF payload. Vendor NDEF formats will not work on all Android devices. * * * <p class="note"><strong>Note:</strong> * <p class="note"><strong>Note:</strong> Methods that perform I/O operations * Use of this class requires the {@link android.Manifest.permission#NFC} * require the {@link android.Manifest.permission#NFC} permission. * permission. */ */ public final class Ndef extends BasicTagTechnology { public final class Ndef extends BasicTagTechnology { private static final String TAG = "NFC"; private static final String TAG = "NFC"; Loading Loading @@ -284,6 +283,8 @@ public final class Ndef extends BasicTagTechnology { * not be called from the main application thread. A blocked call will be canceled with * not be called from the main application thread. A blocked call will be canceled with * {@link IOException} if {@link #close} is called from another thread. * {@link IOException} if {@link #close} is called from another thread. * * * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. * * @param msg the NDEF Message to write, must not be null * @param msg the NDEF Message to write, must not be null * @throws TagLostException if the tag leaves the field * @throws TagLostException if the tag leaves the field * @throws IOException if there is an I/O failure, or the operation is canceled * @throws IOException if there is an I/O failure, or the operation is canceled Loading Loading @@ -344,6 +345,8 @@ public final class Ndef extends BasicTagTechnology { * not be called from the main application thread. A blocked call will be canceled with * not be called from the main application thread. A blocked call will be canceled with * {@link IOException} if {@link #close} is called from another thread. * {@link IOException} if {@link #close} is called from another thread. * * * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. * * @return true on success, false if it is not possible to make this tag read-only * @return true on success, false if it is not possible to make this tag read-only * @throws TagLostException if the tag leaves the field * @throws TagLostException if the tag leaves the field * @throws IOException if there is an I/O failure, or the operation is canceled * @throws IOException if there is an I/O failure, or the operation is canceled Loading Loading
core/java/android/nfc/NfcAdapter.java +9 −2 Original line number Original line Diff line number Diff line Loading @@ -37,7 +37,6 @@ import android.util.Log; * <p> * <p> * Use the helper {@link #getDefaultAdapter(Context)} to get the default NFC * Use the helper {@link #getDefaultAdapter(Context)} to get the default NFC * adapter for this Android device. * adapter for this Android device. * <p> */ */ public final class NfcAdapter { public final class NfcAdapter { private static final String TAG = "NFC"; private static final String TAG = "NFC"; Loading Loading @@ -437,6 +436,8 @@ public final class NfcAdapter { * the completion of their {@link Activity#onPause} callback to disable foreground dispatch * the completion of their {@link Activity#onPause} callback to disable foreground dispatch * after it has been enabled. * after it has been enabled. * * * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. * * @param activity the Activity to dispatch to * @param activity the Activity to dispatch to * @param intent the PendingIntent to start for the dispatch * @param intent the PendingIntent to start for the dispatch * @param filters the IntentFilters to override dispatching for, or null to always dispatch * @param filters the IntentFilters to override dispatching for, or null to always dispatch Loading Loading @@ -476,6 +477,8 @@ public final class NfcAdapter { * * * <p>This method must be called from the main thread. * <p>This method must be called from the main thread. * * * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. * * @param activity the Activity to disable dispatch to * @param activity the Activity to disable dispatch to * @throws IllegalStateException if the Activity has already been paused * @throws IllegalStateException if the Activity has already been paused */ */ Loading Loading @@ -513,10 +516,12 @@ public final class NfcAdapter { * * * <p>This method must be called from the main thread. * <p>This method must be called from the main thread. * * * <p><em>NOTE</em> While foreground NDEF push is active standard tag dispatch is disabled. * <p class="note"><em>NOTE:</em> While foreground NDEF push is active standard tag dispatch is disabled. * Only the foreground activity may receive tag discovered dispatches via * Only the foreground activity may receive tag discovered dispatches via * {@link #enableForegroundDispatch}. * {@link #enableForegroundDispatch}. * * * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. * * @param activity the foreground Activity * @param activity the foreground Activity * @param msg a NDEF Message to push over P2P * @param msg a NDEF Message to push over P2P * @throws IllegalStateException if the Activity is not currently in the foreground * @throws IllegalStateException if the Activity is not currently in the foreground Loading Loading @@ -548,6 +553,8 @@ public final class NfcAdapter { * * * <p>This method must be called from the main thread. * <p>This method must be called from the main thread. * * * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. * * @param activity the Foreground activity * @param activity the Foreground activity * @throws IllegalStateException if the Activity has already been paused * @throws IllegalStateException if the Activity has already been paused * @throws OperationNotSupportedException if this Android device does not support NDEF push * @throws OperationNotSupportedException if this Android device does not support NDEF push Loading
core/java/android/nfc/tech/IsoDep.java +9 −1 Original line number Original line Diff line number Diff line Loading @@ -26,12 +26,15 @@ import java.io.IOException; /** /** * Provides access to ISO-DEP (ISO 14443-4) properties and I/O operations on a {@link Tag}. * Provides access to ISO-DEP (ISO 14443-4) properties and I/O operations on a {@link Tag}. * * * <p>Acquire a {@link IsoDep} object using {@link #get}. * <p>Acquire an {@link IsoDep} object using {@link #get}. * <p>The primary ISO-DEP I/O operation is {@link #transceive}. Applications must * <p>The primary ISO-DEP I/O operation is {@link #transceive}. Applications must * implement their own protocol stack on top of {@link #transceive}. * implement their own protocol stack on top of {@link #transceive}. * <p>Tags that enumerate the {@link IsoDep} technology in {@link Tag#getTechList} * <p>Tags that enumerate the {@link IsoDep} technology in {@link Tag#getTechList} * will also enumerate * will also enumerate * {@link NfcA} or {@link NfcB} (since IsoDep builds on top of either of these). * {@link NfcA} or {@link NfcB} (since IsoDep builds on top of either of these). * * <p class="note"><strong>Note:</strong> Methods that perform I/O operations * require the {@link android.Manifest.permission#NFC} permission. */ */ public final class IsoDep extends BasicTagTechnology { public final class IsoDep extends BasicTagTechnology { private static final String TAG = "NFC"; private static final String TAG = "NFC"; Loading Loading @@ -80,6 +83,9 @@ public final class IsoDep extends BasicTagTechnology { * <p>Setting a longer timeout may be useful when performing * <p>Setting a longer timeout may be useful when performing * transactions that require a long processing time on the tag * transactions that require a long processing time on the tag * such as key generation. * such as key generation. * * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. * * @param timeout timeout value in milliseconds * @param timeout timeout value in milliseconds */ */ public void setTimeout(int timeout) { public void setTimeout(int timeout) { Loading Loading @@ -142,6 +148,8 @@ public final class IsoDep extends BasicTagTechnology { * not be called from the main application thread. A blocked call will be canceled with * not be called from the main application thread. A blocked call will be canceled with * {@link IOException} if {@link #close} is called from another thread. * {@link IOException} if {@link #close} is called from another thread. * * * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. * * @param data command bytes to send, must not be null * @param data command bytes to send, must not be null * @return response bytes received, will not be null * @return response bytes received, will not be null * @throws TagLostException if the tag leaves the field * @throws TagLostException if the tag leaves the field Loading
core/java/android/nfc/tech/MifareClassic.java +22 −1 Original line number Original line Diff line number Diff line Loading @@ -55,7 +55,7 @@ import java.nio.ByteOrder; * MIFARE Classic cards that have been formatted according to the * MIFARE Classic cards that have been formatted according to the * MIFARE Application Directory (MAD) specification. * MIFARE Application Directory (MAD) specification. * <li>{@link #KEY_NFC_FORUM} is the well-known key for MIFARE Classic cards that * <li>{@link #KEY_NFC_FORUM} is the well-known key for MIFARE Classic cards that * have been formatted according to the NFC * have been formatted according to the NXP specification for NDEF on MIFARE Classic. * * * <p>Implementation of this class on a Android NFC device is optional. * <p>Implementation of this class on a Android NFC device is optional. * If it is not implemented, then * If it is not implemented, then Loading @@ -64,6 +64,9 @@ import java.nio.ByteOrder; * and {@link Ndef#MIFARE_CLASSIC} NDEF tags will also be supported. In either case, * and {@link Ndef#MIFARE_CLASSIC} NDEF tags will also be supported. In either case, * {@link NfcA} will also be enumerated on the tag, because all MIFARE Classic tags are also * {@link NfcA} will also be enumerated on the tag, because all MIFARE Classic tags are also * {@link NfcA}. * {@link NfcA}. * * <p class="note"><strong>Note:</strong> Methods that perform I/O operations * require the {@link android.Manifest.permission#NFC} permission. */ */ public final class MifareClassic extends BasicTagTechnology { public final class MifareClassic extends BasicTagTechnology { /** /** Loading Loading @@ -319,6 +322,8 @@ public final class MifareClassic extends BasicTagTechnology { * not be called from the main application thread. A blocked call will be canceled with * not be called from the main application thread. A blocked call will be canceled with * {@link IOException} if {@link #close} is called from another thread. * {@link IOException} if {@link #close} is called from another thread. * * * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. * * @param sectorIndex index of sector to authenticate, starting from 0 * @param sectorIndex index of sector to authenticate, starting from 0 * @param key 6-byte authentication key * @param key 6-byte authentication key * @return true on success, false on authentication failure * @return true on success, false on authentication failure Loading @@ -344,6 +349,8 @@ public final class MifareClassic extends BasicTagTechnology { * not be called from the main application thread. A blocked call will be canceled with * not be called from the main application thread. A blocked call will be canceled with * {@link IOException} if {@link #close} is called from another thread. * {@link IOException} if {@link #close} is called from another thread. * * * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. * * @param sectorIndex index of sector to authenticate, starting from 0 * @param sectorIndex index of sector to authenticate, starting from 0 * @param key 6-byte authentication key * @param key 6-byte authentication key * @return true on success, false on authentication failure * @return true on success, false on authentication failure Loading Loading @@ -398,6 +405,8 @@ public final class MifareClassic extends BasicTagTechnology { * not be called from the main application thread. A blocked call will be canceled with * not be called from the main application thread. A blocked call will be canceled with * {@link IOException} if {@link #close} is called from another thread. * {@link IOException} if {@link #close} is called from another thread. * * * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. * * @param blockIndex index of block to read, starting from 0 * @param blockIndex index of block to read, starting from 0 * @return 16 byte block * @return 16 byte block * @throws TagLostException if the tag leaves the field * @throws TagLostException if the tag leaves the field Loading @@ -418,6 +427,8 @@ public final class MifareClassic extends BasicTagTechnology { * not be called from the main application thread. A blocked call will be canceled with * not be called from the main application thread. A blocked call will be canceled with * {@link IOException} if {@link #close} is called from another thread. * {@link IOException} if {@link #close} is called from another thread. * * * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. * * @param blockIndex index of block to write, starting from 0 * @param blockIndex index of block to write, starting from 0 * @param data 16 bytes of data to write * @param data 16 bytes of data to write * @throws TagLostException if the tag leaves the field * @throws TagLostException if the tag leaves the field Loading Loading @@ -445,6 +456,8 @@ public final class MifareClassic extends BasicTagTechnology { * not be called from the main application thread. A blocked call will be canceled with * not be called from the main application thread. A blocked call will be canceled with * {@link IOException} if {@link #close} is called from another thread. * {@link IOException} if {@link #close} is called from another thread. * * * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. * * @param blockIndex index of block to increment, starting from 0 * @param blockIndex index of block to increment, starting from 0 * @param value non-negative to increment by * @param value non-negative to increment by * @throws TagLostException if the tag leaves the field * @throws TagLostException if the tag leaves the field Loading @@ -471,6 +484,8 @@ public final class MifareClassic extends BasicTagTechnology { * not be called from the main application thread. A blocked call will be canceled with * not be called from the main application thread. A blocked call will be canceled with * {@link IOException} if {@link #close} is called from another thread. * {@link IOException} if {@link #close} is called from another thread. * * * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. * * @param blockIndex index of block to decrement, starting from 0 * @param blockIndex index of block to decrement, starting from 0 * @param value non-negative to decrement by * @param value non-negative to decrement by * @throws TagLostException if the tag leaves the field * @throws TagLostException if the tag leaves the field Loading @@ -497,6 +512,8 @@ public final class MifareClassic extends BasicTagTechnology { * not be called from the main application thread. A blocked call will be canceled with * not be called from the main application thread. A blocked call will be canceled with * {@link IOException} if {@link #close} is called from another thread. * {@link IOException} if {@link #close} is called from another thread. * * * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. * * @param blockIndex index of block to copy to * @param blockIndex index of block to copy to * @throws TagLostException if the tag leaves the field * @throws TagLostException if the tag leaves the field * @throws IOException if there is an I/O failure, or the operation is canceled * @throws IOException if there is an I/O failure, or the operation is canceled Loading @@ -517,6 +534,8 @@ public final class MifareClassic extends BasicTagTechnology { * not be called from the main application thread. A blocked call will be canceled with * not be called from the main application thread. A blocked call will be canceled with * {@link IOException} if {@link #close} is called from another thread. * {@link IOException} if {@link #close} is called from another thread. * * * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. * * @param blockIndex index of block to copy from * @param blockIndex index of block to copy from * @throws TagLostException if the tag leaves the field * @throws TagLostException if the tag leaves the field * @throws IOException if there is an I/O failure, or the operation is canceled * @throws IOException if there is an I/O failure, or the operation is canceled Loading @@ -541,6 +560,8 @@ public final class MifareClassic extends BasicTagTechnology { * not be called from the main application thread. A blocked call will be canceled with * not be called from the main application thread. A blocked call will be canceled with * {@link IOException} if {@link #close} is called from another thread. * {@link IOException} if {@link #close} is called from another thread. * * * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. * * @see NfcA#transceive * @see NfcA#transceive */ */ public byte[] transceive(byte[] data) throws IOException { public byte[] transceive(byte[] data) throws IOException { Loading
core/java/android/nfc/tech/MifareUltralight.java +9 −0 Original line number Original line Diff line number Diff line Loading @@ -51,6 +51,9 @@ import java.io.IOException; * If it is enumerated, then all {@link MifareUltralight} I/O operations will be supported. * If it is enumerated, then all {@link MifareUltralight} I/O operations will be supported. * In either case, {@link NfcA} will also be enumerated on the tag, * In either case, {@link NfcA} will also be enumerated on the tag, * because all MIFARE Ultralight tags are also {@link NfcA} tags. * because all MIFARE Ultralight tags are also {@link NfcA} tags. * * <p class="note"><strong>Note:</strong> Methods that perform I/O operations * require the {@link android.Manifest.permission#NFC} permission. */ */ public final class MifareUltralight extends BasicTagTechnology { public final class MifareUltralight extends BasicTagTechnology { /** A MIFARE Ultralight compatible tag of unknown type */ /** A MIFARE Ultralight compatible tag of unknown type */ Loading Loading @@ -136,6 +139,8 @@ public final class MifareUltralight extends BasicTagTechnology { * not be called from the main application thread. A blocked call will be canceled with * not be called from the main application thread. A blocked call will be canceled with * {@link IOException} if {@link #close} is called from another thread. * {@link IOException} if {@link #close} is called from another thread. * * * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. * * @param pageOffset index of first page to read, starting from 0 * @param pageOffset index of first page to read, starting from 0 * @return 4 pages (16 bytes) * @return 4 pages (16 bytes) * @throws TagLostException if the tag leaves the field * @throws TagLostException if the tag leaves the field Loading @@ -159,6 +164,8 @@ public final class MifareUltralight extends BasicTagTechnology { * not be called from the main application thread. A blocked call will be canceled with * not be called from the main application thread. A blocked call will be canceled with * {@link IOException} if {@link #close} is called from another thread. * {@link IOException} if {@link #close} is called from another thread. * * * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. * * @param pageOffset index of page to write, starting from 0 * @param pageOffset index of page to write, starting from 0 * @param data 4 bytes to write * @param data 4 bytes to write * @throws TagLostException if the tag leaves the field * @throws TagLostException if the tag leaves the field Loading Loading @@ -187,6 +194,8 @@ public final class MifareUltralight extends BasicTagTechnology { * not be called from the main application thread. A blocked call will be canceled with * not be called from the main application thread. A blocked call will be canceled with * {@link IOException} if {@link #close} is called from another thread. * {@link IOException} if {@link #close} is called from another thread. * * * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. * * @see NfcA#transceive * @see NfcA#transceive */ */ public byte[] transceive(byte[] data) throws IOException { public byte[] transceive(byte[] data) throws IOException { Loading
core/java/android/nfc/tech/Ndef.java +7 −4 Original line number Original line Diff line number Diff line Loading @@ -44,7 +44,7 @@ import java.io.IOException; * formatted to contain NDEF data. * formatted to contain NDEF data. * <ul> * <ul> * <li>NFC Forum Type 1 Tag ({@link #NFC_FORUM_TYPE_1}), such as the Innovision Topaz * <li>NFC Forum Type 1 Tag ({@link #NFC_FORUM_TYPE_1}), such as the Innovision Topaz * <li>NFC Forum Type 2 Tag ({@link #NFC_FORUM_TYPE_2}), such as the NXP Mifare Ultralight * <li>NFC Forum Type 2 Tag ({@link #NFC_FORUM_TYPE_2}), such as the NXP MIFARE Ultralight * <li>NFC Forum Type 3 Tag ({@link #NFC_FORUM_TYPE_3}), such as Sony Felica * <li>NFC Forum Type 3 Tag ({@link #NFC_FORUM_TYPE_3}), such as Sony Felica * <li>NFC Forum Type 4 Tag ({@link #NFC_FORUM_TYPE_4}), such as NXP MIFARE Desfire * <li>NFC Forum Type 4 Tag ({@link #NFC_FORUM_TYPE_4}), such as NXP MIFARE Desfire * </ul> * </ul> Loading @@ -66,9 +66,8 @@ import java.io.IOException; * recommended to use NFC Forum Types 1-4 in new deployments of NFC tags * recommended to use NFC Forum Types 1-4 in new deployments of NFC tags * with NDEF payload. Vendor NDEF formats will not work on all Android devices. * with NDEF payload. Vendor NDEF formats will not work on all Android devices. * * * <p class="note"><strong>Note:</strong> * <p class="note"><strong>Note:</strong> Methods that perform I/O operations * Use of this class requires the {@link android.Manifest.permission#NFC} * require the {@link android.Manifest.permission#NFC} permission. * permission. */ */ public final class Ndef extends BasicTagTechnology { public final class Ndef extends BasicTagTechnology { private static final String TAG = "NFC"; private static final String TAG = "NFC"; Loading Loading @@ -284,6 +283,8 @@ public final class Ndef extends BasicTagTechnology { * not be called from the main application thread. A blocked call will be canceled with * not be called from the main application thread. A blocked call will be canceled with * {@link IOException} if {@link #close} is called from another thread. * {@link IOException} if {@link #close} is called from another thread. * * * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. * * @param msg the NDEF Message to write, must not be null * @param msg the NDEF Message to write, must not be null * @throws TagLostException if the tag leaves the field * @throws TagLostException if the tag leaves the field * @throws IOException if there is an I/O failure, or the operation is canceled * @throws IOException if there is an I/O failure, or the operation is canceled Loading Loading @@ -344,6 +345,8 @@ public final class Ndef extends BasicTagTechnology { * not be called from the main application thread. A blocked call will be canceled with * not be called from the main application thread. A blocked call will be canceled with * {@link IOException} if {@link #close} is called from another thread. * {@link IOException} if {@link #close} is called from another thread. * * * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. * * @return true on success, false if it is not possible to make this tag read-only * @return true on success, false if it is not possible to make this tag read-only * @throws TagLostException if the tag leaves the field * @throws TagLostException if the tag leaves the field * @throws IOException if there is an I/O failure, or the operation is canceled * @throws IOException if there is an I/O failure, or the operation is canceled Loading