am 4bf4b491: Merge "Hide some NFC API\'s." into gingerbread

* commit '4bf4b491be3fbd0f71bb87749a0e31f817b91e08':
  Hide some NFC API's.
This commit is contained in:
Nick Pelly
2010-10-29 08:15:48 -07:00
committed by Android Git Automerger
11 changed files with 40 additions and 654 deletions

View File

@ -101853,7 +101853,7 @@
extends="java.lang.Object"
abstract="false"
static="false"
final="false"
final="true"
deprecated="not deprecated"
visibility="public"
>
@ -101944,7 +101944,7 @@
extends="java.lang.Object"
abstract="false"
static="false"
final="false"
final="true"
deprecated="not deprecated"
visibility="public"
>
@ -102224,273 +102224,6 @@
>
</field>
</class>
<class name="NdefTag"
extends="android.nfc.Tag"
abstract="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<implements name="android.os.Parcelable">
</implements>
<method name="createMockNdefTag"
return="android.nfc.NdefTag"
abstract="false"
native="false"
synchronized="false"
static="true"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="id" type="byte[]">
</parameter>
<parameter name="rawTargets" type="java.lang.String[]">
</parameter>
<parameter name="pollBytes" type="byte[]">
</parameter>
<parameter name="activationBytes" type="byte[]">
</parameter>
<parameter name="ndefTargets" type="java.lang.String[]">
</parameter>
<parameter name="messages" type="android.nfc.NdefMessage[][]">
</parameter>
</method>
<method name="getNdefMessages"
return="android.nfc.NdefMessage[]"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="getNdefMessages"
return="android.nfc.NdefMessage[]"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="target" type="java.lang.String">
</parameter>
</method>
<method name="getNdefTargets"
return="java.lang.String[]"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<field name="CREATOR"
type="android.os.Parcelable.Creator"
transient="false"
volatile="false"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="TARGET_MIFARE_CLASSIC"
type="java.lang.String"
transient="false"
volatile="false"
value="&quot;type_mifare_classic&quot;"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="TARGET_OTHER"
type="java.lang.String"
transient="false"
volatile="false"
value="&quot;other&quot;"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="TARGET_TYPE_1"
type="java.lang.String"
transient="false"
volatile="false"
value="&quot;type_1&quot;"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="TARGET_TYPE_2"
type="java.lang.String"
transient="false"
volatile="false"
value="&quot;type_2&quot;"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="TARGET_TYPE_3"
type="java.lang.String"
transient="false"
volatile="false"
value="&quot;type_3&quot;"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="TARGET_TYPE_4"
type="java.lang.String"
transient="false"
volatile="false"
value="&quot;type_4&quot;"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
</class>
<class name="NdefTagConnection"
extends="android.nfc.RawTagConnection"
abstract="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<method name="getModeHint"
return="int"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<exception name="IOException" type="java.io.IOException">
</exception>
</method>
<method name="makeReadOnly"
return="boolean"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<exception name="IOException" type="java.io.IOException">
</exception>
</method>
<method name="readNdefMessages"
return="android.nfc.NdefMessage[]"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<exception name="FormatException" type="android.nfc.FormatException">
</exception>
<exception name="IOException" type="java.io.IOException">
</exception>
</method>
<method name="writeNdefMessage"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="message" type="android.nfc.NdefMessage">
</parameter>
<exception name="FormatException" type="android.nfc.FormatException">
</exception>
<exception name="IOException" type="java.io.IOException">
</exception>
</method>
<field name="NDEF_MODE_READ_ONCE"
type="int"
transient="false"
volatile="false"
value="1"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="NDEF_MODE_READ_ONLY"
type="int"
transient="false"
volatile="false"
value="2"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="NDEF_MODE_UNKNOWN"
type="int"
transient="false"
volatile="false"
value="5"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="NDEF_MODE_WRITE_MANY"
type="int"
transient="false"
volatile="false"
value="4"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="NDEF_MODE_WRITE_ONCE"
type="int"
transient="false"
volatile="false"
value="3"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
</class>
<class name="NfcAdapter"
extends="java.lang.Object"
abstract="false"
@ -102499,62 +102232,6 @@
deprecated="not deprecated"
visibility="public"
>
<method name="createNdefTagConnection"
return="android.nfc.NdefTagConnection"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="tag" type="android.nfc.NdefTag">
</parameter>
</method>
<method name="createNdefTagConnection"
return="android.nfc.NdefTagConnection"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="tag" type="android.nfc.NdefTag">
</parameter>
<parameter name="target" type="java.lang.String">
</parameter>
</method>
<method name="createRawTagConnection"
return="android.nfc.RawTagConnection"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="tag" type="android.nfc.Tag">
</parameter>
</method>
<method name="createRawTagConnection"
return="android.nfc.RawTagConnection"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="tag" type="android.nfc.Tag">
</parameter>
<parameter name="target" type="java.lang.String">
</parameter>
</method>
<method name="getDefaultAdapter"
return="android.nfc.NfcAdapter"
abstract="false"
@ -102566,17 +102243,6 @@
visibility="public"
>
</method>
<method name="getLocalNdefMessage"
return="android.nfc.NdefMessage"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="isEnabled"
return="boolean"
abstract="false"
@ -102588,30 +102254,6 @@
visibility="public"
>
</method>
<method name="setLocalNdefMessage"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="message" type="android.nfc.NdefMessage">
</parameter>
</method>
<field name="ACTION_NDEF_TAG_DISCOVERED"
type="java.lang.String"
transient="false"
volatile="false"
value="&quot;android.nfc.action.NDEF_TAG_DISCOVERED&quot;"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="ACTION_TAG_DISCOVERED"
type="java.lang.String"
transient="false"
@ -102623,268 +102265,22 @@
visibility="public"
>
</field>
<field name="EXTRA_TAG"
<field name="EXTRA_ID"
type="java.lang.String"
transient="false"
volatile="false"
value="&quot;android.nfc.extra.TAG&quot;"
value="&quot;android.nfc.extra.ID&quot;"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
</class>
<class name="RawTagConnection"
extends="java.lang.Object"
abstract="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<method name="close"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="connect"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<exception name="IOException" type="java.io.IOException">
</exception>
</method>
<method name="getTag"
return="android.nfc.Tag"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="getTagTarget"
return="java.lang.String"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="isConnected"
return="boolean"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="transceive"
return="byte[]"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="data" type="byte[]">
</parameter>
<exception name="IOException" type="java.io.IOException">
</exception>
</method>
</class>
<class name="Tag"
extends="java.lang.Object"
abstract="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<implements name="android.os.Parcelable">
</implements>
<method name="createMockTag"
return="android.nfc.Tag"
abstract="false"
native="false"
synchronized="false"
static="true"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="id" type="byte[]">
</parameter>
<parameter name="rawTargets" type="java.lang.String[]">
</parameter>
<parameter name="pollBytes" type="byte[]">
</parameter>
<parameter name="activationBytes" type="byte[]">
</parameter>
</method>
<method name="describeContents"
return="int"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="getActivationBytes"
return="byte[]"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="getId"
return="byte[]"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="getPollBytes"
return="byte[]"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="getRawTargets"
return="java.lang.String[]"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="writeToParcel"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="dest" type="android.os.Parcel">
</parameter>
<parameter name="flags" type="int">
</parameter>
</method>
<field name="CREATOR"
type="android.os.Parcelable.Creator"
transient="false"
volatile="false"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="TARGET_ISO_14443_3A"
<field name="EXTRA_NDEF_MESSAGES"
type="java.lang.String"
transient="false"
volatile="false"
value="&quot;iso14443_3a&quot;"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="TARGET_ISO_14443_3B"
type="java.lang.String"
transient="false"
volatile="false"
value="&quot;iso14443_3b&quot;"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="TARGET_ISO_14443_4"
type="java.lang.String"
transient="false"
volatile="false"
value="&quot;iso14443_4&quot;"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="TARGET_ISO_15693"
type="java.lang.String"
transient="false"
volatile="false"
value="&quot;iso15693&quot;"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="TARGET_JIS_X_6319_4"
type="java.lang.String"
transient="false"
volatile="false"
value="&quot;jis_x_6319_4&quot;"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="TARGET_OTHER"
type="java.lang.String"
transient="false"
volatile="false"
value="&quot;other&quot;"
value="&quot;android.nfc.extra.NDEF_MESSAGES&quot;"
static="true"
final="true"
deprecated="not deprecated"

View File

@ -16,7 +16,6 @@
package android.nfc;
//TODO(npelly) javadoc or consider alternatives
public class FormatException extends Exception {
public FormatException() {
super();

View File

@ -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;

View File

@ -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>

View File

@ -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 {
/**

View File

@ -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;

View File

@ -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.
* <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.
*/
@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.
* <p>
@ -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) {

View File

@ -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 {

View File

@ -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;

View File

@ -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>

View File

@ -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" />