Merge "Final final final Gingerbread MR API changes." into gingerbread
This commit is contained in:
94
api/10.xml
94
api/10.xml
@ -100906,7 +100906,7 @@
|
|||||||
visibility="public"
|
visibility="public"
|
||||||
>
|
>
|
||||||
</field>
|
</field>
|
||||||
<field name="ACTION_TECHNOLOGY_DISCOVERED"
|
<field name="ACTION_TECH_DISCOVERED"
|
||||||
type="java.lang.String"
|
type="java.lang.String"
|
||||||
transient="false"
|
transient="false"
|
||||||
volatile="false"
|
volatile="false"
|
||||||
@ -100975,29 +100975,12 @@
|
|||||||
extends="java.lang.Object"
|
extends="java.lang.Object"
|
||||||
abstract="false"
|
abstract="false"
|
||||||
static="false"
|
static="false"
|
||||||
final="false"
|
final="true"
|
||||||
deprecated="not deprecated"
|
deprecated="not deprecated"
|
||||||
visibility="public"
|
visibility="public"
|
||||||
>
|
>
|
||||||
<implements name="android.os.Parcelable">
|
<implements name="android.os.Parcelable">
|
||||||
</implements>
|
</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="techList" type="int[]">
|
|
||||||
</parameter>
|
|
||||||
<parameter name="techListExtras" type="android.os.Bundle[]">
|
|
||||||
</parameter>
|
|
||||||
</method>
|
|
||||||
<method name="describeContents"
|
<method name="describeContents"
|
||||||
return="int"
|
return="int"
|
||||||
abstract="false"
|
abstract="false"
|
||||||
@ -101145,19 +101128,6 @@
|
|||||||
visibility="public"
|
visibility="public"
|
||||||
>
|
>
|
||||||
</method>
|
</method>
|
||||||
<method name="reconnect"
|
|
||||||
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>
|
|
||||||
</class>
|
</class>
|
||||||
<class name="IsoDep"
|
<class name="IsoDep"
|
||||||
extends="android.nfc.tech.BasicTagTechnology"
|
extends="android.nfc.tech.BasicTagTechnology"
|
||||||
@ -101745,7 +101715,7 @@
|
|||||||
deprecated="not deprecated"
|
deprecated="not deprecated"
|
||||||
visibility="public"
|
visibility="public"
|
||||||
>
|
>
|
||||||
<method name="canMakeReadonly"
|
<method name="canMakeReadOnly"
|
||||||
return="boolean"
|
return="boolean"
|
||||||
abstract="false"
|
abstract="false"
|
||||||
native="false"
|
native="false"
|
||||||
@ -101807,7 +101777,7 @@
|
|||||||
</exception>
|
</exception>
|
||||||
</method>
|
</method>
|
||||||
<method name="getType"
|
<method name="getType"
|
||||||
return="int"
|
return="java.lang.String"
|
||||||
abstract="false"
|
abstract="false"
|
||||||
native="false"
|
native="false"
|
||||||
synchronized="false"
|
synchronized="false"
|
||||||
@ -101828,7 +101798,7 @@
|
|||||||
visibility="public"
|
visibility="public"
|
||||||
>
|
>
|
||||||
</method>
|
</method>
|
||||||
<method name="makeReadonly"
|
<method name="makeReadOnly"
|
||||||
return="boolean"
|
return="boolean"
|
||||||
abstract="false"
|
abstract="false"
|
||||||
native="false"
|
native="false"
|
||||||
@ -101859,10 +101829,10 @@
|
|||||||
</exception>
|
</exception>
|
||||||
</method>
|
</method>
|
||||||
<field name="MIFARE_CLASSIC"
|
<field name="MIFARE_CLASSIC"
|
||||||
type="int"
|
type="java.lang.String"
|
||||||
transient="false"
|
transient="false"
|
||||||
volatile="false"
|
volatile="false"
|
||||||
value="101"
|
value=""com.nxp.ndef.mifareclassic""
|
||||||
static="true"
|
static="true"
|
||||||
final="true"
|
final="true"
|
||||||
deprecated="not deprecated"
|
deprecated="not deprecated"
|
||||||
@ -101870,10 +101840,10 @@
|
|||||||
>
|
>
|
||||||
</field>
|
</field>
|
||||||
<field name="NFC_FORUM_TYPE_1"
|
<field name="NFC_FORUM_TYPE_1"
|
||||||
type="int"
|
type="java.lang.String"
|
||||||
transient="false"
|
transient="false"
|
||||||
volatile="false"
|
volatile="false"
|
||||||
value="1"
|
value=""org.nfcforum.ndef.type1""
|
||||||
static="true"
|
static="true"
|
||||||
final="true"
|
final="true"
|
||||||
deprecated="not deprecated"
|
deprecated="not deprecated"
|
||||||
@ -101881,10 +101851,10 @@
|
|||||||
>
|
>
|
||||||
</field>
|
</field>
|
||||||
<field name="NFC_FORUM_TYPE_2"
|
<field name="NFC_FORUM_TYPE_2"
|
||||||
type="int"
|
type="java.lang.String"
|
||||||
transient="false"
|
transient="false"
|
||||||
volatile="false"
|
volatile="false"
|
||||||
value="2"
|
value=""org.nfcforum.ndef.type2""
|
||||||
static="true"
|
static="true"
|
||||||
final="true"
|
final="true"
|
||||||
deprecated="not deprecated"
|
deprecated="not deprecated"
|
||||||
@ -101892,10 +101862,10 @@
|
|||||||
>
|
>
|
||||||
</field>
|
</field>
|
||||||
<field name="NFC_FORUM_TYPE_3"
|
<field name="NFC_FORUM_TYPE_3"
|
||||||
type="int"
|
type="java.lang.String"
|
||||||
transient="false"
|
transient="false"
|
||||||
volatile="false"
|
volatile="false"
|
||||||
value="3"
|
value=""org.nfcforum.ndef.type3""
|
||||||
static="true"
|
static="true"
|
||||||
final="true"
|
final="true"
|
||||||
deprecated="not deprecated"
|
deprecated="not deprecated"
|
||||||
@ -101903,21 +101873,10 @@
|
|||||||
>
|
>
|
||||||
</field>
|
</field>
|
||||||
<field name="NFC_FORUM_TYPE_4"
|
<field name="NFC_FORUM_TYPE_4"
|
||||||
type="int"
|
type="java.lang.String"
|
||||||
transient="false"
|
transient="false"
|
||||||
volatile="false"
|
volatile="false"
|
||||||
value="4"
|
value=""org.nfcforum.ndef.type4""
|
||||||
static="true"
|
|
||||||
final="true"
|
|
||||||
deprecated="not deprecated"
|
|
||||||
visibility="public"
|
|
||||||
>
|
|
||||||
</field>
|
|
||||||
<field name="OTHER"
|
|
||||||
type="int"
|
|
||||||
transient="false"
|
|
||||||
volatile="false"
|
|
||||||
value="-1"
|
|
||||||
static="true"
|
static="true"
|
||||||
final="true"
|
final="true"
|
||||||
deprecated="not deprecated"
|
deprecated="not deprecated"
|
||||||
@ -101950,6 +101909,23 @@
|
|||||||
<exception name="IOException" type="java.io.IOException">
|
<exception name="IOException" type="java.io.IOException">
|
||||||
</exception>
|
</exception>
|
||||||
</method>
|
</method>
|
||||||
|
<method name="formatReadOnly"
|
||||||
|
return="void"
|
||||||
|
abstract="false"
|
||||||
|
native="false"
|
||||||
|
synchronized="false"
|
||||||
|
static="false"
|
||||||
|
final="false"
|
||||||
|
deprecated="not deprecated"
|
||||||
|
visibility="public"
|
||||||
|
>
|
||||||
|
<parameter name="firstMessage" type="android.nfc.NdefMessage">
|
||||||
|
</parameter>
|
||||||
|
<exception name="FormatException" type="android.nfc.FormatException">
|
||||||
|
</exception>
|
||||||
|
<exception name="IOException" type="java.io.IOException">
|
||||||
|
</exception>
|
||||||
|
</method>
|
||||||
<method name="get"
|
<method name="get"
|
||||||
return="android.nfc.tech.NdefFormatable"
|
return="android.nfc.tech.NdefFormatable"
|
||||||
abstract="false"
|
abstract="false"
|
||||||
@ -102246,8 +102222,8 @@
|
|||||||
visibility="public"
|
visibility="public"
|
||||||
>
|
>
|
||||||
</method>
|
</method>
|
||||||
<method name="reconnect"
|
<method name="isConnected"
|
||||||
return="void"
|
return="boolean"
|
||||||
abstract="true"
|
abstract="true"
|
||||||
native="false"
|
native="false"
|
||||||
synchronized="false"
|
synchronized="false"
|
||||||
@ -102256,8 +102232,6 @@
|
|||||||
deprecated="not deprecated"
|
deprecated="not deprecated"
|
||||||
visibility="public"
|
visibility="public"
|
||||||
>
|
>
|
||||||
<exception name="IOException" type="java.io.IOException">
|
|
||||||
</exception>
|
|
||||||
</method>
|
</method>
|
||||||
</interface>
|
</interface>
|
||||||
</package>
|
</package>
|
||||||
|
@ -100906,7 +100906,7 @@
|
|||||||
visibility="public"
|
visibility="public"
|
||||||
>
|
>
|
||||||
</field>
|
</field>
|
||||||
<field name="ACTION_TECHNOLOGY_DISCOVERED"
|
<field name="ACTION_TECH_DISCOVERED"
|
||||||
type="java.lang.String"
|
type="java.lang.String"
|
||||||
transient="false"
|
transient="false"
|
||||||
volatile="false"
|
volatile="false"
|
||||||
@ -100975,29 +100975,12 @@
|
|||||||
extends="java.lang.Object"
|
extends="java.lang.Object"
|
||||||
abstract="false"
|
abstract="false"
|
||||||
static="false"
|
static="false"
|
||||||
final="false"
|
final="true"
|
||||||
deprecated="not deprecated"
|
deprecated="not deprecated"
|
||||||
visibility="public"
|
visibility="public"
|
||||||
>
|
>
|
||||||
<implements name="android.os.Parcelable">
|
<implements name="android.os.Parcelable">
|
||||||
</implements>
|
</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="techList" type="int[]">
|
|
||||||
</parameter>
|
|
||||||
<parameter name="techListExtras" type="android.os.Bundle[]">
|
|
||||||
</parameter>
|
|
||||||
</method>
|
|
||||||
<method name="describeContents"
|
<method name="describeContents"
|
||||||
return="int"
|
return="int"
|
||||||
abstract="false"
|
abstract="false"
|
||||||
@ -101145,19 +101128,6 @@
|
|||||||
visibility="public"
|
visibility="public"
|
||||||
>
|
>
|
||||||
</method>
|
</method>
|
||||||
<method name="reconnect"
|
|
||||||
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>
|
|
||||||
</class>
|
</class>
|
||||||
<class name="IsoDep"
|
<class name="IsoDep"
|
||||||
extends="android.nfc.tech.BasicTagTechnology"
|
extends="android.nfc.tech.BasicTagTechnology"
|
||||||
@ -101745,7 +101715,7 @@
|
|||||||
deprecated="not deprecated"
|
deprecated="not deprecated"
|
||||||
visibility="public"
|
visibility="public"
|
||||||
>
|
>
|
||||||
<method name="canMakeReadonly"
|
<method name="canMakeReadOnly"
|
||||||
return="boolean"
|
return="boolean"
|
||||||
abstract="false"
|
abstract="false"
|
||||||
native="false"
|
native="false"
|
||||||
@ -101807,7 +101777,7 @@
|
|||||||
</exception>
|
</exception>
|
||||||
</method>
|
</method>
|
||||||
<method name="getType"
|
<method name="getType"
|
||||||
return="int"
|
return="java.lang.String"
|
||||||
abstract="false"
|
abstract="false"
|
||||||
native="false"
|
native="false"
|
||||||
synchronized="false"
|
synchronized="false"
|
||||||
@ -101828,7 +101798,7 @@
|
|||||||
visibility="public"
|
visibility="public"
|
||||||
>
|
>
|
||||||
</method>
|
</method>
|
||||||
<method name="makeReadonly"
|
<method name="makeReadOnly"
|
||||||
return="boolean"
|
return="boolean"
|
||||||
abstract="false"
|
abstract="false"
|
||||||
native="false"
|
native="false"
|
||||||
@ -101859,10 +101829,10 @@
|
|||||||
</exception>
|
</exception>
|
||||||
</method>
|
</method>
|
||||||
<field name="MIFARE_CLASSIC"
|
<field name="MIFARE_CLASSIC"
|
||||||
type="int"
|
type="java.lang.String"
|
||||||
transient="false"
|
transient="false"
|
||||||
volatile="false"
|
volatile="false"
|
||||||
value="101"
|
value=""com.nxp.ndef.mifareclassic""
|
||||||
static="true"
|
static="true"
|
||||||
final="true"
|
final="true"
|
||||||
deprecated="not deprecated"
|
deprecated="not deprecated"
|
||||||
@ -101870,10 +101840,10 @@
|
|||||||
>
|
>
|
||||||
</field>
|
</field>
|
||||||
<field name="NFC_FORUM_TYPE_1"
|
<field name="NFC_FORUM_TYPE_1"
|
||||||
type="int"
|
type="java.lang.String"
|
||||||
transient="false"
|
transient="false"
|
||||||
volatile="false"
|
volatile="false"
|
||||||
value="1"
|
value=""org.nfcforum.ndef.type1""
|
||||||
static="true"
|
static="true"
|
||||||
final="true"
|
final="true"
|
||||||
deprecated="not deprecated"
|
deprecated="not deprecated"
|
||||||
@ -101881,10 +101851,10 @@
|
|||||||
>
|
>
|
||||||
</field>
|
</field>
|
||||||
<field name="NFC_FORUM_TYPE_2"
|
<field name="NFC_FORUM_TYPE_2"
|
||||||
type="int"
|
type="java.lang.String"
|
||||||
transient="false"
|
transient="false"
|
||||||
volatile="false"
|
volatile="false"
|
||||||
value="2"
|
value=""org.nfcforum.ndef.type2""
|
||||||
static="true"
|
static="true"
|
||||||
final="true"
|
final="true"
|
||||||
deprecated="not deprecated"
|
deprecated="not deprecated"
|
||||||
@ -101892,10 +101862,10 @@
|
|||||||
>
|
>
|
||||||
</field>
|
</field>
|
||||||
<field name="NFC_FORUM_TYPE_3"
|
<field name="NFC_FORUM_TYPE_3"
|
||||||
type="int"
|
type="java.lang.String"
|
||||||
transient="false"
|
transient="false"
|
||||||
volatile="false"
|
volatile="false"
|
||||||
value="3"
|
value=""org.nfcforum.ndef.type3""
|
||||||
static="true"
|
static="true"
|
||||||
final="true"
|
final="true"
|
||||||
deprecated="not deprecated"
|
deprecated="not deprecated"
|
||||||
@ -101903,21 +101873,10 @@
|
|||||||
>
|
>
|
||||||
</field>
|
</field>
|
||||||
<field name="NFC_FORUM_TYPE_4"
|
<field name="NFC_FORUM_TYPE_4"
|
||||||
type="int"
|
type="java.lang.String"
|
||||||
transient="false"
|
transient="false"
|
||||||
volatile="false"
|
volatile="false"
|
||||||
value="4"
|
value=""org.nfcforum.ndef.type4""
|
||||||
static="true"
|
|
||||||
final="true"
|
|
||||||
deprecated="not deprecated"
|
|
||||||
visibility="public"
|
|
||||||
>
|
|
||||||
</field>
|
|
||||||
<field name="OTHER"
|
|
||||||
type="int"
|
|
||||||
transient="false"
|
|
||||||
volatile="false"
|
|
||||||
value="-1"
|
|
||||||
static="true"
|
static="true"
|
||||||
final="true"
|
final="true"
|
||||||
deprecated="not deprecated"
|
deprecated="not deprecated"
|
||||||
@ -101950,6 +101909,23 @@
|
|||||||
<exception name="IOException" type="java.io.IOException">
|
<exception name="IOException" type="java.io.IOException">
|
||||||
</exception>
|
</exception>
|
||||||
</method>
|
</method>
|
||||||
|
<method name="formatReadOnly"
|
||||||
|
return="void"
|
||||||
|
abstract="false"
|
||||||
|
native="false"
|
||||||
|
synchronized="false"
|
||||||
|
static="false"
|
||||||
|
final="false"
|
||||||
|
deprecated="not deprecated"
|
||||||
|
visibility="public"
|
||||||
|
>
|
||||||
|
<parameter name="firstMessage" type="android.nfc.NdefMessage">
|
||||||
|
</parameter>
|
||||||
|
<exception name="FormatException" type="android.nfc.FormatException">
|
||||||
|
</exception>
|
||||||
|
<exception name="IOException" type="java.io.IOException">
|
||||||
|
</exception>
|
||||||
|
</method>
|
||||||
<method name="get"
|
<method name="get"
|
||||||
return="android.nfc.tech.NdefFormatable"
|
return="android.nfc.tech.NdefFormatable"
|
||||||
abstract="false"
|
abstract="false"
|
||||||
@ -102246,8 +102222,8 @@
|
|||||||
visibility="public"
|
visibility="public"
|
||||||
>
|
>
|
||||||
</method>
|
</method>
|
||||||
<method name="reconnect"
|
<method name="isConnected"
|
||||||
return="void"
|
return="boolean"
|
||||||
abstract="true"
|
abstract="true"
|
||||||
native="false"
|
native="false"
|
||||||
synchronized="false"
|
synchronized="false"
|
||||||
@ -102256,8 +102232,6 @@
|
|||||||
deprecated="not deprecated"
|
deprecated="not deprecated"
|
||||||
visibility="public"
|
visibility="public"
|
||||||
>
|
>
|
||||||
<exception name="IOException" type="java.io.IOException">
|
|
||||||
</exception>
|
|
||||||
</method>
|
</method>
|
||||||
</interface>
|
</interface>
|
||||||
</package>
|
</package>
|
||||||
|
@ -44,10 +44,10 @@ public final class NfcAdapter {
|
|||||||
/**
|
/**
|
||||||
* Intent to start an activity when a tag with NDEF payload is discovered.
|
* Intent to start an activity when a tag with NDEF payload is discovered.
|
||||||
* If the tag has and NDEF payload this intent is started before
|
* If the tag has and NDEF payload this intent is started before
|
||||||
* {@link #ACTION_TECHNOLOGY_DISCOVERED}.
|
* {@link #ACTION_TECH_DISCOVERED}.
|
||||||
*
|
*
|
||||||
* If any activities respond to this intent neither
|
* If any activities respond to this intent neither
|
||||||
* {@link #ACTION_TECHNOLOGY_DISCOVERED} or {@link #ACTION_TAG_DISCOVERED} will be started.
|
* {@link #ACTION_TECH_DISCOVERED} or {@link #ACTION_TAG_DISCOVERED} will be started.
|
||||||
*/
|
*/
|
||||||
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
|
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
|
||||||
public static final String ACTION_NDEF_DISCOVERED = "android.nfc.action.NDEF_DISCOVERED";
|
public static final String ACTION_NDEF_DISCOVERED = "android.nfc.action.NDEF_DISCOVERED";
|
||||||
@ -63,7 +63,7 @@ public final class NfcAdapter {
|
|||||||
* If any activities respond to this intent {@link #ACTION_TAG_DISCOVERED} will not be started.
|
* If any activities respond to this intent {@link #ACTION_TAG_DISCOVERED} will not be started.
|
||||||
*/
|
*/
|
||||||
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
|
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
|
||||||
public static final String ACTION_TECHNOLOGY_DISCOVERED = "android.nfc.action.TECH_DISCOVERED";
|
public static final String ACTION_TECH_DISCOVERED = "android.nfc.action.TECH_DISCOVERED";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Intent to start an activity when a tag is discovered.
|
* Intent to start an activity when a tag is discovered.
|
||||||
|
@ -55,7 +55,7 @@ import java.util.Arrays;
|
|||||||
* not cause any further RF activity or block. Note however that arrays passed to 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.
|
* returned by this class are *not* cloned, so be careful not to modify them.
|
||||||
*/
|
*/
|
||||||
public class Tag implements Parcelable {
|
public final class Tag implements Parcelable {
|
||||||
/*package*/ final byte[] mId;
|
/*package*/ final byte[] mId;
|
||||||
/*package*/ final int[] mTechList;
|
/*package*/ final int[] mTechList;
|
||||||
/*package*/ final String[] mTechStringList;
|
/*package*/ final String[] mTechStringList;
|
||||||
@ -93,6 +93,7 @@ public class Tag implements Parcelable {
|
|||||||
* @param id The tag identifier, can be null
|
* @param id The tag identifier, can be null
|
||||||
* @param techList must not be null
|
* @param techList must not be null
|
||||||
* @return freshly constructed tag
|
* @return freshly constructed tag
|
||||||
|
* @hide
|
||||||
*/
|
*/
|
||||||
public static Tag createMockTag(byte[] id, int[] techList, Bundle[] techListExtras) {
|
public static Tag createMockTag(byte[] id, int[] techList, Bundle[] techListExtras) {
|
||||||
// set serviceHandle to 0 to indicate mock tag
|
// set serviceHandle to 0 to indicate mock tag
|
||||||
|
@ -53,15 +53,7 @@ import java.io.IOException;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Helper to indicate if {@link #connect} has succeeded.
|
|
||||||
* <p>
|
|
||||||
* Does not cause RF activity, and does not block.
|
|
||||||
* @return true if {@link #connect} has completed successfully and the {@link Tag} is believed
|
|
||||||
* to be within range. Applications must still handle {@link java.io.IOException}
|
|
||||||
* while using methods that require a connection in case the connection is lost after this
|
|
||||||
* method returns.
|
|
||||||
*/
|
|
||||||
public boolean isConnected() {
|
public boolean isConnected() {
|
||||||
if (!mIsConnected) {
|
if (!mIsConnected) {
|
||||||
return false;
|
return false;
|
||||||
@ -94,6 +86,7 @@ import java.io.IOException;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
@Override
|
@Override
|
||||||
public void reconnect() throws IOException {
|
public void reconnect() throws IOException {
|
||||||
if (!mIsConnected) {
|
if (!mIsConnected) {
|
||||||
|
@ -61,12 +61,31 @@ public final class Ndef extends BasicTagTechnology {
|
|||||||
/** @hide */
|
/** @hide */
|
||||||
public static final String EXTRA_NDEF_TYPE = "ndeftype";
|
public static final String EXTRA_NDEF_TYPE = "ndeftype";
|
||||||
|
|
||||||
public static final int OTHER = -1;
|
/** @hide */
|
||||||
public static final int NFC_FORUM_TYPE_1 = 1;
|
public static final int TYPE_OTHER = -1;
|
||||||
public static final int NFC_FORUM_TYPE_2 = 2;
|
/** @hide */
|
||||||
public static final int NFC_FORUM_TYPE_3 = 3;
|
public static final int TYPE_1 = 1;
|
||||||
public static final int NFC_FORUM_TYPE_4 = 4;
|
/** @hide */
|
||||||
public static final int MIFARE_CLASSIC = 101;
|
public static final int TYPE_2 = 2;
|
||||||
|
/** @hide */
|
||||||
|
public static final int TYPE_3 = 3;
|
||||||
|
/** @hide */
|
||||||
|
public static final int TYPE_4 = 4;
|
||||||
|
/** @hide */
|
||||||
|
public static final int TYPE_MIFARE_CLASSIC = 101;
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public static final String UNKNOWN = "android.ndef.unknown";
|
||||||
|
|
||||||
|
public static final String NFC_FORUM_TYPE_1 = "org.nfcforum.ndef.type1";
|
||||||
|
|
||||||
|
public static final String NFC_FORUM_TYPE_2 = "org.nfcforum.ndef.type2";
|
||||||
|
|
||||||
|
public static final String NFC_FORUM_TYPE_3 = "org.nfcforum.ndef.type3";
|
||||||
|
|
||||||
|
public static final String NFC_FORUM_TYPE_4 = "org.nfcforum.ndef.type4";
|
||||||
|
|
||||||
|
public static final String MIFARE_CLASSIC = "com.nxp.ndef.mifareclassic";
|
||||||
|
|
||||||
private final int mMaxNdefSize;
|
private final int mMaxNdefSize;
|
||||||
private final int mCardState;
|
private final int mCardState;
|
||||||
@ -118,18 +137,27 @@ public final class Ndef extends BasicTagTechnology {
|
|||||||
* Get NDEF tag type.
|
* Get NDEF tag type.
|
||||||
* <p>Returns one of {@link #NFC_FORUM_TYPE_1}, {@link #NFC_FORUM_TYPE_2},
|
* <p>Returns one of {@link #NFC_FORUM_TYPE_1}, {@link #NFC_FORUM_TYPE_2},
|
||||||
* {@link #NFC_FORUM_TYPE_3}, {@link #NFC_FORUM_TYPE_4},
|
* {@link #NFC_FORUM_TYPE_3}, {@link #NFC_FORUM_TYPE_4},
|
||||||
* {@link #MIFARE_CLASSIC} or {@link #OTHER}.
|
* {@link #MIFARE_CLASSIC} or another NDEF tag type that is not yet in the
|
||||||
* <p>Platforms of this API revision will always return one of the above
|
* Android API.
|
||||||
* values. Platforms at future API revisions may return other values, which
|
|
||||||
* can be treated as {@link #OTHER} by applications targeting this API.
|
|
||||||
* <p>Android devices with NFC support must always correctly enumerate
|
* <p>Android devices with NFC support must always correctly enumerate
|
||||||
* NFC Forum tag types, and may optionally enumerate
|
* NFC Forum tag types, and may optionally enumerate
|
||||||
* {@link #MIFARE_CLASSIC} since it requires proprietary technology.
|
* {@link #MIFARE_CLASSIC} since it requires proprietary technology.
|
||||||
* Devices that cannot enumerate {@link #MIFARE_CLASSIC} will use
|
|
||||||
* {@link #OTHER} instead.
|
|
||||||
*/
|
*/
|
||||||
public int getType() {
|
public String getType() {
|
||||||
return mNdefType;
|
switch (mNdefType) {
|
||||||
|
case TYPE_1:
|
||||||
|
return NFC_FORUM_TYPE_1;
|
||||||
|
case TYPE_2:
|
||||||
|
return NFC_FORUM_TYPE_2;
|
||||||
|
case TYPE_3:
|
||||||
|
return NFC_FORUM_TYPE_3;
|
||||||
|
case TYPE_4:
|
||||||
|
return NFC_FORUM_TYPE_4;
|
||||||
|
case TYPE_MIFARE_CLASSIC:
|
||||||
|
return MIFARE_CLASSIC;
|
||||||
|
default:
|
||||||
|
return UNKNOWN;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -217,10 +245,10 @@ public final class Ndef extends BasicTagTechnology {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether a tag can be made read-only with
|
* Indicates whether a tag can be made read-only with
|
||||||
* {@link #makeReadonly()}
|
* {@link #makeReadOnly()}
|
||||||
*/
|
*/
|
||||||
public boolean canMakeReadonly() {
|
public boolean canMakeReadOnly() {
|
||||||
if (mNdefType == NFC_FORUM_TYPE_1 || mNdefType == NFC_FORUM_TYPE_2) {
|
if (mNdefType == TYPE_1 || mNdefType == TYPE_2) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -234,7 +262,7 @@ public final class Ndef extends BasicTagTechnology {
|
|||||||
* This is a one-way process and can not be reverted!
|
* This is a one-way process and can not be reverted!
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public boolean makeReadonly() throws IOException {
|
public boolean makeReadOnly() throws IOException {
|
||||||
checkConnected();
|
checkConnected();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -65,8 +65,25 @@ public final class NdefFormatable extends BasicTagTechnology {
|
|||||||
/**
|
/**
|
||||||
* Formats a tag as NDEF, if possible. You may supply a first
|
* Formats a tag as NDEF, if possible. You may supply a first
|
||||||
* NdefMessage to be written on the tag.
|
* NdefMessage to be written on the tag.
|
||||||
|
* <p>Either all steps succeed, or an IOException is thrown if any one step
|
||||||
|
* fails.
|
||||||
*/
|
*/
|
||||||
public void format(NdefMessage firstMessage) throws IOException, FormatException {
|
public void format(NdefMessage firstMessage) throws IOException, FormatException {
|
||||||
|
format(firstMessage, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Formats a tag as NDEF, if possible. You may supply a first
|
||||||
|
* NdefMessage to be written on the tag.
|
||||||
|
* <p>Either all steps succeed, or an IOException is thrown if any one step
|
||||||
|
* fails.
|
||||||
|
*/
|
||||||
|
public void formatReadOnly(NdefMessage firstMessage) throws IOException, FormatException {
|
||||||
|
format(firstMessage, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*package*/ void format(NdefMessage firstMessage, boolean makeReadOnly) throws IOException,
|
||||||
|
FormatException {
|
||||||
checkConnected();
|
checkConnected();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -101,6 +118,21 @@ public final class NdefFormatable extends BasicTagTechnology {
|
|||||||
} else {
|
} else {
|
||||||
throw new IOException();
|
throw new IOException();
|
||||||
}
|
}
|
||||||
|
// optionally make read-only
|
||||||
|
if (makeReadOnly) {
|
||||||
|
errorCode = tagService.ndefMakeReadOnly(serviceHandle);
|
||||||
|
switch (errorCode) {
|
||||||
|
case ErrorCodes.SUCCESS:
|
||||||
|
break;
|
||||||
|
case ErrorCodes.ERROR_IO:
|
||||||
|
throw new IOException();
|
||||||
|
case ErrorCodes.ERROR_INVALID_PARAM:
|
||||||
|
throw new IOException();
|
||||||
|
default:
|
||||||
|
// Should not happen
|
||||||
|
throw new IOException();
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Log.e(TAG, "NFC service dead", e);
|
Log.e(TAG, "NFC service dead", e);
|
||||||
}
|
}
|
||||||
|
@ -121,6 +121,7 @@ public interface TagTechnology extends Closeable {
|
|||||||
* @see #connect()
|
* @see #connect()
|
||||||
* @see #close()
|
* @see #close()
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
|
* @hide
|
||||||
*/
|
*/
|
||||||
public void reconnect() throws IOException;
|
public void reconnect() throws IOException;
|
||||||
|
|
||||||
@ -137,4 +138,15 @@ public interface TagTechnology extends Closeable {
|
|||||||
* @see #reconnect()
|
* @see #reconnect()
|
||||||
*/
|
*/
|
||||||
public void close() throws IOException;
|
public void close() throws IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper to indicate if {@link #connect} has succeeded.
|
||||||
|
* <p>
|
||||||
|
* Does not cause RF activity, and does not block.
|
||||||
|
* @return true if {@link #connect} has completed successfully and the {@link Tag} is believed
|
||||||
|
* to be within range. Applications must still handle {@link java.io.IOException}
|
||||||
|
* while using methods that require a connection in case the connection is lost after this
|
||||||
|
* method returns.
|
||||||
|
*/
|
||||||
|
public boolean isConnected();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user