This is an immutable data class. */ -public class NdefMessage implements Parcelable { +public final class NdefMessage implements Parcelable { private static final byte FLAG_MB = (byte) 0x80; private static final byte FLAG_ME = (byte) 0x40; @@ -69,9 +69,9 @@ public class NdefMessage implements Parcelable { * Returns a byte array representation of this entire NDEF message. */ public byte[] toByteArray() { - //TODO(nxp): do not return null - //TODO(nxp): allocate the byte array once, copy each record once - //TODO(nxp): process MB and ME flags outside loop + //TODO: do not return null + //TODO: allocate the byte array once, copy each record once + //TODO: process MB and ME flags outside loop if ((mRecords == null) || (mRecords.length == 0)) return null; diff --git a/core/java/android/nfc/NdefRecord.java b/core/java/android/nfc/NdefRecord.java index 557e44da6f61d..746d3df146338 100644 --- a/core/java/android/nfc/NdefRecord.java +++ b/core/java/android/nfc/NdefRecord.java @@ -35,7 +35,7 @@ import java.lang.UnsupportedOperationException; * large. *
This is an immutable data class. */ -public class NdefRecord implements Parcelable { +public final class NdefRecord implements Parcelable { /** * Indicates no type, id, or payload is associated with this NDEF Record. *
diff --git a/core/java/android/nfc/NdefTag.java b/core/java/android/nfc/NdefTag.java index 0626edb1c5ca4..eb9d0dc92a04f 100644 --- a/core/java/android/nfc/NdefTag.java +++ b/core/java/android/nfc/NdefTag.java @@ -35,6 +35,7 @@ import android.os.Parcelable; * time and calls on this class will retrieve those read-only properties, and * not cause any further RF activity or block. Note however that arrays passed to and * returned by this class are *not* cloned, so be careful not to modify them. + * @hide */ public class NdefTag extends Tag implements Parcelable { /** diff --git a/core/java/android/nfc/NdefTagConnection.java b/core/java/android/nfc/NdefTagConnection.java index 27fa25c01df08..aafdbfd945772 100644 --- a/core/java/android/nfc/NdefTagConnection.java +++ b/core/java/android/nfc/NdefTagConnection.java @@ -28,6 +28,7 @@ import android.util.Log; *
Note: * Use of this class requires the {@link android.Manifest.permission#NFC} * permission. + * @hide */ public class NdefTagConnection extends RawTagConnection { public static final int NDEF_MODE_READ_ONCE = 1; diff --git a/core/java/android/nfc/NfcAdapter.java b/core/java/android/nfc/NfcAdapter.java index a093d121bcd87..cf80fafec08f2 100644 --- a/core/java/android/nfc/NfcAdapter.java +++ b/core/java/android/nfc/NfcAdapter.java @@ -31,38 +31,30 @@ import android.util.Log; * Use the static {@link #getDefaultAdapter} method to get the default NFC * Adapter for this Android device. Most Android devices will have only one NFC * Adapter, and {@link #getDefaultAdapter} returns the singleton object. - *
- * {@link NfcAdapter} can be used to create {@link RawTagConnection} or - * {@link NdefTagConnection} connections to modify or perform low level access - * to NFC Tags. - *
- * Note: Some methods require the - * {@link android.Manifest.permission#NFC} permission. */ public final class NfcAdapter { /** - * Intent to start an activity when a non-NDEF tag is discovered. - * TODO(npelly) finalize decision on using CATEGORY or DATA URI to provide a - * hint for applications to filter the tag type. - * TODO(npelly) probably combine these two intents since tags aren't that simple + * Intent to start an activity when a tag is discovered. */ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_TAG_DISCOVERED = "android.nfc.action.TAG_DISCOVERED"; /** - * Intent to start an activity when a NDEF tag is discovered. TODO(npelly) - * finalize decision on using CATEGORY or DATA URI to provide a hint for - * applications to filter the tag type. - */ - @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) - public static final String ACTION_NDEF_TAG_DISCOVERED = - "android.nfc.action.NDEF_TAG_DISCOVERED"; - - /** - * Mandatory Tag extra for the ACTION_TAG and ACTION_NDEF_TAG intents. + * Mandatory Tag extra for the ACTION_TAG intents. + * @hide */ public static final String EXTRA_TAG = "android.nfc.extra.TAG"; + /** + * Optional NdefMessage[] extra for the ACTION_TAG intents. + */ + public static final String EXTRA_NDEF_MESSAGES = "android.nfc.extra.NDEF_MESSAGES"; + + /** + * Optional byte[] extra for the tag identifier. + */ + public static final String EXTRA_ID = "android.nfc.extra.ID"; + /** * Broadcast Action: a transaction with a secure element has been detected. *
@@ -324,6 +316,7 @@ public final class NfcAdapter { *
Requires {@link android.Manifest.permission#NFC} permission. * * @param message NDEF message to make public + * @hide */ public void setLocalNdefMessage(NdefMessage message) { try { @@ -338,6 +331,7 @@ public final class NfcAdapter { *
Requires {@link android.Manifest.permission#NFC} permission. * * @return NDEF Message that is publicly readable + * @hide */ public NdefMessage getLocalNdefMessage() { try { @@ -351,6 +345,7 @@ public final class NfcAdapter { /** * Create a raw tag connection to the default Target *
Requires {@link android.Manifest.permission#NFC} permission. + * @hide */ public RawTagConnection createRawTagConnection(Tag tag) { if (tag.mServiceHandle == 0) { @@ -367,6 +362,7 @@ public final class NfcAdapter { /** * Create a raw tag connection to the specified Target *
Requires {@link android.Manifest.permission#NFC} permission. + * @hide */ public RawTagConnection createRawTagConnection(Tag tag, String target) { if (tag.mServiceHandle == 0) { @@ -383,6 +379,7 @@ public final class NfcAdapter { /** * Create an NDEF tag connection to the default Target *
Requires {@link android.Manifest.permission#NFC} permission. + * @hide */ public NdefTagConnection createNdefTagConnection(NdefTag tag) { if (tag.mServiceHandle == 0) { @@ -399,6 +396,7 @@ public final class NfcAdapter { /** * Create an NDEF tag connection to the specified Target *
Requires {@link android.Manifest.permission#NFC} permission. + * @hide */ public NdefTagConnection createNdefTagConnection(NdefTag tag, String target) { if (tag.mServiceHandle == 0) { diff --git a/core/java/android/nfc/RawTagConnection.java b/core/java/android/nfc/RawTagConnection.java index 24072e5341a1b..bfdaa77143a83 100644 --- a/core/java/android/nfc/RawTagConnection.java +++ b/core/java/android/nfc/RawTagConnection.java @@ -32,6 +32,7 @@ import android.util.Log; *
Note: * Use of this class requires the {@link android.Manifest.permission#NFC} * permission. + * @hide */ public class RawTagConnection { diff --git a/core/java/android/nfc/Tag.java b/core/java/android/nfc/Tag.java index dc6e798e189e9..5d0b04cbccf3a 100644 --- a/core/java/android/nfc/Tag.java +++ b/core/java/android/nfc/Tag.java @@ -41,6 +41,7 @@ import android.os.Parcelable; * time and calls on this class will retrieve those read-only properties, and * not cause any further RF activity or block. Note however that arrays passed to and * returned by this class are *not* cloned, so be careful not to modify them. + * @hide */ public class Tag implements Parcelable { /** @@ -156,6 +157,7 @@ public class Tag implements Parcelable { * from SENSF_RES * * @return poll bytes, or null if they do not exist for this Tag technology + * @hide */ public byte[] getPollBytes() { return mPollBytes; @@ -172,6 +174,7 @@ public class Tag implements Parcelable { *
JIS_X_6319_4: null *
ISO15693: response flags (1 byte), DSFID (1 byte): null * @return activation bytes, or null if they do not exist for this Tag technology + * @hide */ public byte[] getActivationBytes() { return mActivationBytes; diff --git a/core/java/android/nfc/package.html b/core/java/android/nfc/package.html index 8754cb9732c9b..b054d1cc41796 100644 --- a/core/java/android/nfc/package.html +++ b/core/java/android/nfc/package.html @@ -1,30 +1,18 @@
-Provides access to Near Field Communication (NFC) functionality, allowing applications to connect -to NFC tags, then transmit and recieving data. A "tag" may actually be another device that appears -as a tag. +Provides access to Near Field Communication (NFC) functionality, allowing applications to read +NDEF message in NFC tags. A "tag" may actually be another device that appears as a tag.Here's a summary of the classes: