diff options
author | Nick Pelly <npelly@google.com> | 2010-10-28 16:47:31 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-10-28 16:47:31 -0700 |
commit | 4bf4b491be3fbd0f71bb87749a0e31f817b91e08 (patch) | |
tree | 408976361af93fa5436bc65515f0725fa9c32843 /core | |
parent | c9fa90f94b664589d584bb433e748e2b01b368c9 (diff) | |
parent | 11b075e218b9921a953eeebe73fcd1a8a81f764b (diff) | |
download | frameworks_base-4bf4b491be3fbd0f71bb87749a0e31f817b91e08.zip frameworks_base-4bf4b491be3fbd0f71bb87749a0e31f817b91e08.tar.gz frameworks_base-4bf4b491be3fbd0f71bb87749a0e31f817b91e08.tar.bz2 |
Merge "Hide some NFC API's." into gingerbread
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/nfc/FormatException.java | 1 | ||||
-rw-r--r-- | core/java/android/nfc/NdefMessage.java | 8 | ||||
-rw-r--r-- | core/java/android/nfc/NdefRecord.java | 2 | ||||
-rw-r--r-- | core/java/android/nfc/NdefTag.java | 1 | ||||
-rw-r--r-- | core/java/android/nfc/NdefTagConnection.java | 1 | ||||
-rw-r--r-- | core/java/android/nfc/NfcAdapter.java | 36 | ||||
-rw-r--r-- | core/java/android/nfc/RawTagConnection.java | 1 | ||||
-rw-r--r-- | core/java/android/nfc/Tag.java | 3 | ||||
-rw-r--r-- | core/java/android/nfc/package.html | 20 | ||||
-rw-r--r-- | core/res/AndroidManifest.xml | 1 |
10 files changed, 32 insertions, 42 deletions
diff --git a/core/java/android/nfc/FormatException.java b/core/java/android/nfc/FormatException.java index 21a7c3b..7045a03 100644 --- a/core/java/android/nfc/FormatException.java +++ b/core/java/android/nfc/FormatException.java @@ -16,7 +16,6 @@ package android.nfc; -//TODO(npelly) javadoc or consider alternatives public class FormatException extends Exception { public FormatException() { super(); diff --git a/core/java/android/nfc/NdefMessage.java b/core/java/android/nfc/NdefMessage.java index feca94e..d107b54 100644 --- a/core/java/android/nfc/NdefMessage.java +++ b/core/java/android/nfc/NdefMessage.java @@ -28,7 +28,7 @@ import android.os.Parcelable; * message always contains zero or more NDEF records.</p> * <p>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 557e44d..746d3df 100644 --- a/core/java/android/nfc/NdefRecord.java +++ b/core/java/android/nfc/NdefRecord.java @@ -35,7 +35,7 @@ import java.lang.UnsupportedOperationException; * large. * <p>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. * <p> diff --git a/core/java/android/nfc/NdefTag.java b/core/java/android/nfc/NdefTag.java index 0626edb..eb9d0dc 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 27fa25c..aafdbfd 100644 --- a/core/java/android/nfc/NdefTagConnection.java +++ b/core/java/android/nfc/NdefTagConnection.java @@ -28,6 +28,7 @@ import android.util.Log; * <p class="note"><strong>Note:</strong> * 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 a093d12..cf80faf 100644 --- a/core/java/android/nfc/NfcAdapter.java +++ b/core/java/android/nfc/NfcAdapter.java @@ -31,37 +31,29 @@ 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. - * <p> - * {@link NfcAdapter} can be used to create {@link RawTagConnection} or - * {@link NdefTagConnection} connections to modify or perform low level access - * to NFC Tags. - * <p class="note"> - * <strong>Note:</strong> 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. + * Mandatory Tag extra for the ACTION_TAG intents. + * @hide */ - @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) - public static final String ACTION_NDEF_TAG_DISCOVERED = - "android.nfc.action.NDEF_TAG_DISCOVERED"; + public static final String EXTRA_TAG = "android.nfc.extra.TAG"; /** - * Mandatory Tag extra for the ACTION_TAG and ACTION_NDEF_TAG intents. + * Optional NdefMessage[] extra for the ACTION_TAG intents. */ - public static final String EXTRA_TAG = "android.nfc.extra.TAG"; + 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 { * <p>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 { * <p>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 * <p>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 * <p>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 * <p>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 * <p>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 24072e5..bfdaa77 100644 --- a/core/java/android/nfc/RawTagConnection.java +++ b/core/java/android/nfc/RawTagConnection.java @@ -32,6 +32,7 @@ import android.util.Log; * <p class="note"><strong>Note:</strong> * 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 dc6e798..5d0b04c 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 { * <p>JIS_X_6319_4: null * <p>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 8754cb9..b054d1c 100644 --- a/core/java/android/nfc/package.html +++ b/core/java/android/nfc/package.html @@ -1,30 +1,18 @@ <HTML> <BODY> -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. <p>Here's a summary of the classes:</p> <dl> <dt>{@link android.nfc.NfcAdapter}</dt> <dd>This represents the device's NFC adapter, which is your entry-point to performing NFC -operations. Once you acquire an instance with {@link android.nfc.NfcAdapter#getDefaultAdapter}, you -can create connections to tags.</dd> - <dt>{@link android.nfc.NdefTag} and {@link android.nfc.Tag}</dt> - <dd>These objects represent a tag. A tag is a thing that the NFC-enabled device can -communicate with when within range. Usually, you'll work with {@link android.nfc.NdefTag}, which -represents a tag that's compliant with the NFC Data Exchange Format (NDEF); a {@link -android.nfc.Tag} represents a generalized tag. Note that {@link android.nfc.NdefTag} extends -{@link android.nfc.Tag}.</dd> - <dt>{@link android.nfc.NdefTagConnection} and {@link android.nfc.RawTagConnection}</dt> - <dd>These objects represent a connection to a tag, respective to the type of tag connected -(either {@link android.nfc.NdefTag} or {@link android.nfc.Tag}). Note that {@link -android.nfc.NdefTagConnection} extends {@link android.nfc.RawTagConnection}.</dd> +operations. You can acquire an instance with {@link android.nfc.NfcAdapter#getDefaultAdapter}.</dd> <dt>{@link android.nfc.NdefMessage}</dt> <dd>Represents an NDEF data message, which is the standard format in which "records" carrying data are transmitted between devices and tags. Your application can receive these -messages from an {@link android.nfc.NdefTagConnection}.</dd> +messages from an {@link android.nfc.NfcAdapter#ACTION_TAG_DISCOVERED} intent.</dd> <dt>{@link android.nfc.NdefRecord}</dt> <dd>Represents a record, which is delivered in a {@link android.nfc.NdefMessage} and describes the type of data being shared and carries the data itself.</dd> diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index a22c827..07a48e7 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -86,7 +86,6 @@ <protected-broadcast android:name="android.hardware.action.USB_DISCONNECTED" /> <protected-broadcast android:name="android.hardware.action.USB_STATE" /> - <protected-broadcast android:name="android.nfc.action.NDEF_TAG_DISCOVERED" /> <protected-broadcast android:name="android.nfc.action.TAG_DISCOVERED" /> <protected-broadcast android:name="android.nfc.action.LLCP_LINK_STATE_CHANGED" /> <protected-broadcast android:name="android.nfc.action.TRANSACTION_DETECTED" /> |