Loading api/current.xml +129 −137 Original line number Original line Diff line number Diff line Loading @@ -100871,21 +100871,6 @@ visibility="public" visibility="public" > > </method> </method> <method name="getTechnology" return="android.nfc.technology.TagTechnology" 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="tech" type="int"> </parameter> </method> <method name="isEnabled" <method name="isEnabled" return="boolean" return="boolean" abstract="false" abstract="false" Loading Loading @@ -101098,7 +101083,7 @@ </constructor> </constructor> </class> </class> </package> </package> <package name="android.nfc.technology" <package name="android.nfc.tech" > > <class name="BasicTagTechnology" <class name="BasicTagTechnology" extends="java.lang.Object" extends="java.lang.Object" Loading @@ -101108,7 +101093,7 @@ deprecated="not deprecated" deprecated="not deprecated" visibility="" visibility="" > > <implements name="android.nfc.technology.TagTechnology"> <implements name="android.nfc.tech.TagTechnology"> </implements> </implements> <method name="close" <method name="close" return="void" return="void" Loading Loading @@ -101182,13 +101167,26 @@ </method> </method> </class> </class> <class name="IsoDep" <class name="IsoDep" extends="android.nfc.technology.BasicTagTechnology" extends="android.nfc.tech.BasicTagTechnology" abstract="false" abstract="false" static="false" static="false" final="true" final="true" deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <method name="get" return="android.nfc.tech.IsoDep" abstract="false" native="false" synchronized="false" static="true" final="false" deprecated="not deprecated" visibility="public" > <parameter name="tag" type="android.nfc.Tag"> </parameter> </method> <method name="getHiLayerResponse" <method name="getHiLayerResponse" return="byte[]" return="byte[]" abstract="false" abstract="false" Loading Loading @@ -101241,7 +101239,7 @@ </method> </method> </class> </class> <class name="MifareClassic" <class name="MifareClassic" extends="android.nfc.technology.BasicTagTechnology" extends="android.nfc.tech.BasicTagTechnology" abstract="false" abstract="false" static="false" static="false" final="true" final="true" Loading Loading @@ -101301,6 +101299,19 @@ <exception name="IOException" type="java.io.IOException"> <exception name="IOException" type="java.io.IOException"> </exception> </exception> </method> </method> <method name="get" return="android.nfc.tech.MifareClassic" abstract="false" native="false" synchronized="false" static="true" final="false" deprecated="not deprecated" visibility="public" > <parameter name="tag" type="android.nfc.Tag"> </parameter> </method> <method name="getBlockCount" <method name="getBlockCount" return="int" return="int" abstract="false" abstract="false" Loading Loading @@ -101644,13 +101655,26 @@ </field> </field> </class> </class> <class name="MifareUltralight" <class name="MifareUltralight" extends="android.nfc.technology.BasicTagTechnology" extends="android.nfc.tech.BasicTagTechnology" abstract="false" abstract="false" static="false" static="false" final="true" final="true" deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <method name="get" return="android.nfc.tech.MifareUltralight" abstract="false" native="false" synchronized="false" static="true" final="false" deprecated="not deprecated" visibility="public" > <parameter name="tag" type="android.nfc.Tag"> </parameter> </method> <method name="getType" <method name="getType" return="int" return="int" abstract="false" abstract="false" Loading Loading @@ -101744,7 +101768,7 @@ </field> </field> </class> </class> <class name="Ndef" <class name="Ndef" extends="android.nfc.technology.BasicTagTechnology" extends="android.nfc.tech.BasicTagTechnology" abstract="false" abstract="false" static="false" static="false" final="true" final="true" Loading @@ -101762,6 +101786,19 @@ visibility="public" visibility="public" > > </method> </method> <method name="get" return="android.nfc.tech.Ndef" abstract="false" native="false" synchronized="false" static="true" final="false" deprecated="not deprecated" visibility="public" > <parameter name="tag" type="android.nfc.Tag"> </parameter> </method> <method name="getCachedNdefMessage" <method name="getCachedNdefMessage" return="android.nfc.NdefMessage" return="android.nfc.NdefMessage" abstract="false" abstract="false" Loading Loading @@ -101855,7 +101892,7 @@ type="int" type="int" transient="false" transient="false" volatile="false" volatile="false" value="105" value="101" static="true" static="true" final="true" final="true" deprecated="not deprecated" deprecated="not deprecated" Loading Loading @@ -101919,7 +101956,7 @@ </field> </field> </class> </class> <class name="NdefFormatable" <class name="NdefFormatable" extends="android.nfc.technology.BasicTagTechnology" extends="android.nfc.tech.BasicTagTechnology" abstract="false" abstract="false" static="false" static="false" final="true" final="true" Loading @@ -101943,15 +101980,41 @@ <exception name="IOException" type="java.io.IOException"> <exception name="IOException" type="java.io.IOException"> </exception> </exception> </method> </method> <method name="get" return="android.nfc.tech.NdefFormatable" abstract="false" native="false" synchronized="false" static="true" final="false" deprecated="not deprecated" visibility="public" > <parameter name="tag" type="android.nfc.Tag"> </parameter> </method> </class> </class> <class name="NfcA" <class name="NfcA" extends="android.nfc.technology.BasicTagTechnology" extends="android.nfc.tech.BasicTagTechnology" abstract="false" abstract="false" static="false" static="false" final="true" final="true" deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <method name="get" return="android.nfc.tech.NfcA" abstract="false" native="false" synchronized="false" static="true" final="false" deprecated="not deprecated" visibility="public" > <parameter name="tag" type="android.nfc.Tag"> </parameter> </method> <method name="getAtqa" <method name="getAtqa" return="byte[]" return="byte[]" abstract="false" abstract="false" Loading Loading @@ -101991,13 +102054,26 @@ </method> </method> </class> </class> <class name="NfcB" <class name="NfcB" extends="android.nfc.technology.BasicTagTechnology" extends="android.nfc.tech.BasicTagTechnology" abstract="false" abstract="false" static="false" static="false" final="true" final="true" deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <method name="get" return="android.nfc.tech.NfcB" abstract="false" native="false" synchronized="false" static="true" final="false" deprecated="not deprecated" visibility="public" > <parameter name="tag" type="android.nfc.Tag"> </parameter> </method> <method name="getApplicationData" <method name="getApplicationData" return="byte[]" return="byte[]" abstract="false" abstract="false" Loading Loading @@ -102037,13 +102113,26 @@ </method> </method> </class> </class> <class name="NfcF" <class name="NfcF" extends="android.nfc.technology.BasicTagTechnology" extends="android.nfc.tech.BasicTagTechnology" abstract="false" abstract="false" static="false" static="false" final="true" final="true" deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <method name="get" return="android.nfc.tech.NfcF" abstract="false" native="false" synchronized="false" static="true" final="false" deprecated="not deprecated" visibility="public" > <parameter name="tag" type="android.nfc.Tag"> </parameter> </method> <method name="getManufacturer" <method name="getManufacturer" return="byte[]" return="byte[]" abstract="false" abstract="false" Loading Loading @@ -102083,13 +102172,26 @@ </method> </method> </class> </class> <class name="NfcV" <class name="NfcV" extends="android.nfc.technology.BasicTagTechnology" extends="android.nfc.tech.BasicTagTechnology" abstract="false" abstract="false" static="false" static="false" final="true" final="true" deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <method name="get" return="android.nfc.tech.NfcV" abstract="false" native="false" synchronized="false" static="true" final="false" deprecated="not deprecated" visibility="public" > <parameter name="tag" type="android.nfc.Tag"> </parameter> </method> <method name="getDsfId" <method name="getDsfId" return="byte" return="byte" abstract="false" abstract="false" Loading Loading @@ -102170,17 +102272,6 @@ visibility="public" visibility="public" > > </method> </method> <method name="getTechnologyId" return="int" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="reconnect" <method name="reconnect" return="void" return="void" abstract="true" abstract="true" Loading @@ -102194,105 +102285,6 @@ <exception name="IOException" type="java.io.IOException"> <exception name="IOException" type="java.io.IOException"> </exception> </exception> </method> </method> <field name="ISO_DEP" type="int" transient="false" volatile="false" value="3" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="MIFARE_CLASSIC" type="int" transient="false" volatile="false" value="8" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="MIFARE_ULTRALIGHT" type="int" transient="false" volatile="false" value="9" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="NDEF" type="int" transient="false" volatile="false" value="6" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="NDEF_FORMATABLE" type="int" transient="false" volatile="false" value="7" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="NFC_A" type="int" transient="false" volatile="false" value="1" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="NFC_B" type="int" transient="false" volatile="false" value="2" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="NFC_F" type="int" transient="false" volatile="false" value="4" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="NFC_V" type="int" transient="false" volatile="false" value="5" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> </interface> </interface> </package> </package> <package name="android.opengl" <package name="android.opengl" core/java/android/nfc/NfcAdapter.java +1 −11 Original line number Original line Diff line number Diff line Loading @@ -26,7 +26,7 @@ import android.content.Context; import android.content.IntentFilter; import android.content.IntentFilter; import android.content.pm.IPackageManager; import android.content.pm.IPackageManager; import android.content.pm.PackageManager; import android.content.pm.PackageManager; import android.nfc.technology.TagTechnology; import android.nfc.tech.TagTechnology; import android.os.IBinder; import android.os.IBinder; import android.os.RemoteException; import android.os.RemoteException; import android.os.ServiceManager; import android.os.ServiceManager; Loading Loading @@ -531,16 +531,6 @@ public final class NfcAdapter { } } } } /** * Retrieve a TagTechnology object used to interact with a Tag that is * in field. * <p> * @return TagTechnology object, or null if not present */ public TagTechnology getTechnology(Tag tag, int tech) { return tag.getTechnology(NfcAdapter.this, tech); } /** /** * Set the NDEF Message that this NFC adapter should appear as to Tag * Set the NDEF Message that this NFC adapter should appear as to Tag * readers. * readers. Loading core/java/android/nfc/NfcSecureElement.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -16,7 +16,7 @@ package android.nfc; package android.nfc; import android.nfc.technology.TagTechnology; import android.nfc.tech.TagTechnology; import android.os.RemoteException; import android.os.RemoteException; import android.util.Log; import android.util.Log; Loading core/java/android/nfc/Tag.java +28 −57 Original line number Original line Diff line number Diff line Loading @@ -16,20 +16,10 @@ package android.nfc; package android.nfc; import android.nfc.technology.IsoDep; import android.nfc.tech.TagTechnology; import android.nfc.technology.MifareClassic; import android.nfc.technology.MifareUltralight; import android.nfc.technology.NfcV; import android.nfc.technology.Ndef; import android.nfc.technology.NdefFormatable; import android.nfc.technology.NfcA; import android.nfc.technology.NfcB; import android.nfc.technology.NfcF; import android.nfc.technology.TagTechnology; import android.os.Bundle; import android.os.Bundle; import android.os.Parcel; import android.os.Parcel; import android.os.Parcelable; import android.os.Parcelable; import android.os.RemoteException; import java.util.Arrays; import java.util.Arrays; Loading @@ -44,8 +34,8 @@ import java.util.Arrays; * {@link Tag} objects are passed to applications via the {@link NfcAdapter#EXTRA_TAG} extra * {@link Tag} objects are passed to applications via the {@link NfcAdapter#EXTRA_TAG} extra * in {@link NfcAdapter#ACTION_TAG_DISCOVERED} intents. A {@link Tag} object is immutable * in {@link NfcAdapter#ACTION_TAG_DISCOVERED} intents. A {@link Tag} object is immutable * and represents the state of the tag at the time of discovery. It can be * and represents the state of the tag at the time of discovery. It can be * directly queried for its UID and Type, or used to create a {@link TagTechnology} * directly queried for its UID and Type, or used to create a {@link TagTechnology} using the * (with {@link NfcAdapter#getTechnology}). * static <code>get()</code> methods on the varios tech classes. * <p> * <p> * A {@link Tag} can be used to create a {@link TagTechnology} only while the tag is in * A {@link Tag} can be used to create a {@link TagTechnology} only while the tag is in * range. If it is removed and then returned to range, then the most recent * range. If it is removed and then returned to range, then the most recent Loading @@ -61,6 +51,7 @@ public class Tag implements Parcelable { /*package*/ final int[] mTechList; /*package*/ final int[] mTechList; /*package*/ final Bundle[] mTechExtras; /*package*/ final Bundle[] mTechExtras; /*package*/ final int mServiceHandle; // for use by NFC service, 0 indicates a mock /*package*/ final int mServiceHandle; // for use by NFC service, 0 indicates a mock /*package*/ final INfcTag mTagService; /*package*/ int mConnectedTechnology; /*package*/ int mConnectedTechnology; Loading @@ -68,7 +59,8 @@ public class Tag implements Parcelable { * Hidden constructor to be used by NFC service and internal classes. * Hidden constructor to be used by NFC service and internal classes. * @hide * @hide */ */ public Tag(byte[] id, int[] techList, Bundle[] techListExtras, int serviceHandle) { public Tag(byte[] id, int[] techList, Bundle[] techListExtras, int serviceHandle, INfcTag tagService) { if (techList == null) { if (techList == null) { throw new IllegalArgumentException("rawTargets cannot be null"); throw new IllegalArgumentException("rawTargets cannot be null"); } } Loading @@ -77,15 +69,15 @@ public class Tag implements Parcelable { // Ensure mTechExtras is as long as mTechList // Ensure mTechExtras is as long as mTechList mTechExtras = Arrays.copyOf(techListExtras, techList.length); mTechExtras = Arrays.copyOf(techListExtras, techList.length); mServiceHandle = serviceHandle; mServiceHandle = serviceHandle; mTagService = tagService; mConnectedTechnology = -1; mConnectedTechnology = -1; } } /** /** * Construct a mock Tag. * Construct a mock Tag. * <p>This is an application constructed tag, so NfcAdapter methods on this * <p>This is an application constructed tag, so NfcAdapter methods on this Tag may fail * Tag such as {@link NfcAdapter#getTechnology} may fail with * with {@link IllegalArgumentException} since it does not represent a physical Tag. * {@link IllegalArgumentException} since it does not represent a physical Tag. * <p>This constructor might be useful for mock testing. * <p>This constructor might be useful for mock testing. * @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 Loading @@ -93,7 +85,7 @@ public class Tag implements Parcelable { */ */ 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 return new Tag(id, techList, techListExtras, 0); return new Tag(id, techList, techListExtras, 0, null); } } /** /** Loading Loading @@ -127,7 +119,16 @@ public class Tag implements Parcelable { return Arrays.copyOf(mTechList, mTechList.length); return Arrays.copyOf(mTechList, mTechList.length); } } /*package*/ TagTechnology getTechnology(NfcAdapter adapter, int tech) { /** @hide */ public boolean hasTech(int techType) { for (int tech : mTechList) { if (tech == techType) return true; } return false; } /** @hide */ public Bundle getTechExtras(int tech) { int pos = -1; int pos = -1; for (int idx = 0; idx < mTechList.length; idx++) { for (int idx = 0; idx < mTechList.length; idx++) { if (mTechList[idx] == tech) { if (mTechList[idx] == tech) { Loading @@ -139,44 +140,12 @@ public class Tag implements Parcelable { return null; return null; } } Bundle extras = mTechExtras[pos]; return mTechExtras[pos]; try { switch (tech) { case TagTechnology.NFC_A: { return new NfcA(adapter, this, extras); } case TagTechnology.NFC_B: { return new NfcB(adapter, this, extras); } case TagTechnology.ISO_DEP: { return new IsoDep(adapter, this, extras); } case TagTechnology.NFC_V: { return new NfcV(adapter, this, extras); } case TagTechnology.NDEF: { return new Ndef(adapter, this, tech, extras); } case TagTechnology.NDEF_FORMATABLE: { return new NdefFormatable(adapter, this, tech, extras); } case TagTechnology.NFC_F: { return new NfcF(adapter, this, extras); } case TagTechnology.MIFARE_CLASSIC: { return new MifareClassic(adapter, this, extras); } case TagTechnology.MIFARE_ULTRALIGHT: { return new MifareUltralight(adapter, this, extras); } } default: { /** @hide */ throw new UnsupportedOperationException("Tech " + tech + " not supported"); public INfcTag getTagService() { } return mTagService; } } catch (RemoteException e) { return null; } } } @Override @Override Loading Loading @@ -223,6 +192,7 @@ public class Tag implements Parcelable { dest.writeIntArray(mTechList); dest.writeIntArray(mTechList); dest.writeTypedArray(mTechExtras, 0); dest.writeTypedArray(mTechExtras, 0); dest.writeInt(mServiceHandle); dest.writeInt(mServiceHandle); dest.writeStrongBinder(mTagService.asBinder()); } } public static final Parcelable.Creator<Tag> CREATOR = public static final Parcelable.Creator<Tag> CREATOR = Loading @@ -235,8 +205,9 @@ public class Tag implements Parcelable { in.readIntArray(techList); in.readIntArray(techList); Bundle[] techExtras = in.createTypedArray(Bundle.CREATOR); Bundle[] techExtras = in.createTypedArray(Bundle.CREATOR); int serviceHandle = in.readInt(); int serviceHandle = in.readInt(); INfcTag tagService = INfcTag.Stub.asInterface(in.readStrongBinder()); return new Tag(id, techList, techExtras, serviceHandle); return new Tag(id, techList, techExtras, serviceHandle, tagService); } } @Override @Override Loading core/java/android/nfc/technology/BasicTagTechnology.java→core/java/android/nfc/tech/BasicTagTechnology.java +13 −22 Original line number Original line Diff line number Diff line Loading @@ -14,20 +14,17 @@ * limitations under the License. * limitations under the License. */ */ package android.nfc.technology; package android.nfc.tech; import java.io.IOException; import android.nfc.INfcAdapter; import android.nfc.INfcTag; import android.nfc.NfcAdapter; import android.nfc.TransceiveResult; import android.nfc.Tag; import android.nfc.ErrorCodes; import android.nfc.ErrorCodes; import android.nfc.Tag; import android.nfc.TagLostException; import android.nfc.TagLostException; import android.nfc.TransceiveResult; import android.os.RemoteException; import android.os.RemoteException; import android.util.Log; import android.util.Log; import java.io.IOException; /** /** * A base class for tag technologies that are built on top of transceive(). * A base class for tag technologies that are built on top of transceive(). */ */ Loading @@ -37,11 +34,8 @@ import android.util.Log; /*package*/ final Tag mTag; /*package*/ final Tag mTag; /*package*/ boolean mIsConnected; /*package*/ boolean mIsConnected; /*package*/ int mSelectedTechnology; /*package*/ int mSelectedTechnology; private final NfcAdapter mAdapter; /*package*/ final INfcAdapter mService; /*package*/ final INfcTag mTagService; BasicTagTechnology(NfcAdapter adapter, Tag tag, int tech) throws RemoteException { BasicTagTechnology(Tag tag, int tech) throws RemoteException { int[] techList = tag.getTechnologyList(); int[] techList = tag.getTechnologyList(); int i; int i; Loading @@ -56,15 +50,12 @@ import android.util.Log; throw new IllegalArgumentException("Technology " + tech + " not present on tag " + tag); throw new IllegalArgumentException("Technology " + tech + " not present on tag " + tag); } } mAdapter = adapter; mService = mAdapter.getService(); mTagService = mAdapter.getTagService(); mTag = tag; mTag = tag; mSelectedTechnology = tech; mSelectedTechnology = tech; } } BasicTagTechnology(NfcAdapter adapter, Tag tag) throws RemoteException { BasicTagTechnology(Tag tag) throws RemoteException { this(adapter, tag, tag.getTechnologyList()[0]); this(tag, tag.getTechnologyList()[0]); } } @Override @Override Loading Loading @@ -100,7 +91,7 @@ import android.util.Log; } } try { try { return mTagService.isPresent(mTag.getServiceHandle()); return mTag.getTagService().isPresent(mTag.getServiceHandle()); } catch (RemoteException e) { } catch (RemoteException e) { Log.e(TAG, "NFC service dead", e); Log.e(TAG, "NFC service dead", e); return false; return false; Loading @@ -110,7 +101,7 @@ import android.util.Log; @Override @Override public void connect() throws IOException { public void connect() throws IOException { try { try { int errorCode = mTagService.connect(mTag.getServiceHandle(), getTechnologyId()); int errorCode = mTag.getTagService().connect(mTag.getServiceHandle(), getTechnologyId()); if (errorCode == ErrorCodes.SUCCESS) { if (errorCode == ErrorCodes.SUCCESS) { // Store this in the tag object // Store this in the tag object Loading @@ -132,7 +123,7 @@ import android.util.Log; } } try { try { int errorCode = mTagService.reconnect(mTag.getServiceHandle()); int errorCode = mTag.getTagService().reconnect(mTag.getServiceHandle()); if (errorCode != ErrorCodes.SUCCESS) { if (errorCode != ErrorCodes.SUCCESS) { mIsConnected = false; mIsConnected = false; Loading @@ -153,7 +144,7 @@ import android.util.Log; /* Note that we don't want to physically disconnect the tag, /* Note that we don't want to physically disconnect the tag, * but just reconnect to it to reset its state * but just reconnect to it to reset its state */ */ mTagService.reconnect(mTag.getServiceHandle()); mTag.getTagService().reconnect(mTag.getServiceHandle()); } catch (RemoteException e) { } catch (RemoteException e) { Log.e(TAG, "NFC service dead", e); Log.e(TAG, "NFC service dead", e); } finally { } finally { Loading @@ -167,7 +158,7 @@ import android.util.Log; checkConnected(); checkConnected(); try { try { TransceiveResult result = mTagService.transceive(mTag.getServiceHandle(), data, raw); TransceiveResult result = mTag.getTagService().transceive(mTag.getServiceHandle(), data, raw); if (result == null) { if (result == null) { throw new IOException("transceive failed"); throw new IOException("transceive failed"); } else { } else { Loading Loading
api/current.xml +129 −137 Original line number Original line Diff line number Diff line Loading @@ -100871,21 +100871,6 @@ visibility="public" visibility="public" > > </method> </method> <method name="getTechnology" return="android.nfc.technology.TagTechnology" 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="tech" type="int"> </parameter> </method> <method name="isEnabled" <method name="isEnabled" return="boolean" return="boolean" abstract="false" abstract="false" Loading Loading @@ -101098,7 +101083,7 @@ </constructor> </constructor> </class> </class> </package> </package> <package name="android.nfc.technology" <package name="android.nfc.tech" > > <class name="BasicTagTechnology" <class name="BasicTagTechnology" extends="java.lang.Object" extends="java.lang.Object" Loading @@ -101108,7 +101093,7 @@ deprecated="not deprecated" deprecated="not deprecated" visibility="" visibility="" > > <implements name="android.nfc.technology.TagTechnology"> <implements name="android.nfc.tech.TagTechnology"> </implements> </implements> <method name="close" <method name="close" return="void" return="void" Loading Loading @@ -101182,13 +101167,26 @@ </method> </method> </class> </class> <class name="IsoDep" <class name="IsoDep" extends="android.nfc.technology.BasicTagTechnology" extends="android.nfc.tech.BasicTagTechnology" abstract="false" abstract="false" static="false" static="false" final="true" final="true" deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <method name="get" return="android.nfc.tech.IsoDep" abstract="false" native="false" synchronized="false" static="true" final="false" deprecated="not deprecated" visibility="public" > <parameter name="tag" type="android.nfc.Tag"> </parameter> </method> <method name="getHiLayerResponse" <method name="getHiLayerResponse" return="byte[]" return="byte[]" abstract="false" abstract="false" Loading Loading @@ -101241,7 +101239,7 @@ </method> </method> </class> </class> <class name="MifareClassic" <class name="MifareClassic" extends="android.nfc.technology.BasicTagTechnology" extends="android.nfc.tech.BasicTagTechnology" abstract="false" abstract="false" static="false" static="false" final="true" final="true" Loading Loading @@ -101301,6 +101299,19 @@ <exception name="IOException" type="java.io.IOException"> <exception name="IOException" type="java.io.IOException"> </exception> </exception> </method> </method> <method name="get" return="android.nfc.tech.MifareClassic" abstract="false" native="false" synchronized="false" static="true" final="false" deprecated="not deprecated" visibility="public" > <parameter name="tag" type="android.nfc.Tag"> </parameter> </method> <method name="getBlockCount" <method name="getBlockCount" return="int" return="int" abstract="false" abstract="false" Loading Loading @@ -101644,13 +101655,26 @@ </field> </field> </class> </class> <class name="MifareUltralight" <class name="MifareUltralight" extends="android.nfc.technology.BasicTagTechnology" extends="android.nfc.tech.BasicTagTechnology" abstract="false" abstract="false" static="false" static="false" final="true" final="true" deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <method name="get" return="android.nfc.tech.MifareUltralight" abstract="false" native="false" synchronized="false" static="true" final="false" deprecated="not deprecated" visibility="public" > <parameter name="tag" type="android.nfc.Tag"> </parameter> </method> <method name="getType" <method name="getType" return="int" return="int" abstract="false" abstract="false" Loading Loading @@ -101744,7 +101768,7 @@ </field> </field> </class> </class> <class name="Ndef" <class name="Ndef" extends="android.nfc.technology.BasicTagTechnology" extends="android.nfc.tech.BasicTagTechnology" abstract="false" abstract="false" static="false" static="false" final="true" final="true" Loading @@ -101762,6 +101786,19 @@ visibility="public" visibility="public" > > </method> </method> <method name="get" return="android.nfc.tech.Ndef" abstract="false" native="false" synchronized="false" static="true" final="false" deprecated="not deprecated" visibility="public" > <parameter name="tag" type="android.nfc.Tag"> </parameter> </method> <method name="getCachedNdefMessage" <method name="getCachedNdefMessage" return="android.nfc.NdefMessage" return="android.nfc.NdefMessage" abstract="false" abstract="false" Loading Loading @@ -101855,7 +101892,7 @@ type="int" type="int" transient="false" transient="false" volatile="false" volatile="false" value="105" value="101" static="true" static="true" final="true" final="true" deprecated="not deprecated" deprecated="not deprecated" Loading Loading @@ -101919,7 +101956,7 @@ </field> </field> </class> </class> <class name="NdefFormatable" <class name="NdefFormatable" extends="android.nfc.technology.BasicTagTechnology" extends="android.nfc.tech.BasicTagTechnology" abstract="false" abstract="false" static="false" static="false" final="true" final="true" Loading @@ -101943,15 +101980,41 @@ <exception name="IOException" type="java.io.IOException"> <exception name="IOException" type="java.io.IOException"> </exception> </exception> </method> </method> <method name="get" return="android.nfc.tech.NdefFormatable" abstract="false" native="false" synchronized="false" static="true" final="false" deprecated="not deprecated" visibility="public" > <parameter name="tag" type="android.nfc.Tag"> </parameter> </method> </class> </class> <class name="NfcA" <class name="NfcA" extends="android.nfc.technology.BasicTagTechnology" extends="android.nfc.tech.BasicTagTechnology" abstract="false" abstract="false" static="false" static="false" final="true" final="true" deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <method name="get" return="android.nfc.tech.NfcA" abstract="false" native="false" synchronized="false" static="true" final="false" deprecated="not deprecated" visibility="public" > <parameter name="tag" type="android.nfc.Tag"> </parameter> </method> <method name="getAtqa" <method name="getAtqa" return="byte[]" return="byte[]" abstract="false" abstract="false" Loading Loading @@ -101991,13 +102054,26 @@ </method> </method> </class> </class> <class name="NfcB" <class name="NfcB" extends="android.nfc.technology.BasicTagTechnology" extends="android.nfc.tech.BasicTagTechnology" abstract="false" abstract="false" static="false" static="false" final="true" final="true" deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <method name="get" return="android.nfc.tech.NfcB" abstract="false" native="false" synchronized="false" static="true" final="false" deprecated="not deprecated" visibility="public" > <parameter name="tag" type="android.nfc.Tag"> </parameter> </method> <method name="getApplicationData" <method name="getApplicationData" return="byte[]" return="byte[]" abstract="false" abstract="false" Loading Loading @@ -102037,13 +102113,26 @@ </method> </method> </class> </class> <class name="NfcF" <class name="NfcF" extends="android.nfc.technology.BasicTagTechnology" extends="android.nfc.tech.BasicTagTechnology" abstract="false" abstract="false" static="false" static="false" final="true" final="true" deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <method name="get" return="android.nfc.tech.NfcF" abstract="false" native="false" synchronized="false" static="true" final="false" deprecated="not deprecated" visibility="public" > <parameter name="tag" type="android.nfc.Tag"> </parameter> </method> <method name="getManufacturer" <method name="getManufacturer" return="byte[]" return="byte[]" abstract="false" abstract="false" Loading Loading @@ -102083,13 +102172,26 @@ </method> </method> </class> </class> <class name="NfcV" <class name="NfcV" extends="android.nfc.technology.BasicTagTechnology" extends="android.nfc.tech.BasicTagTechnology" abstract="false" abstract="false" static="false" static="false" final="true" final="true" deprecated="not deprecated" deprecated="not deprecated" visibility="public" visibility="public" > > <method name="get" return="android.nfc.tech.NfcV" abstract="false" native="false" synchronized="false" static="true" final="false" deprecated="not deprecated" visibility="public" > <parameter name="tag" type="android.nfc.Tag"> </parameter> </method> <method name="getDsfId" <method name="getDsfId" return="byte" return="byte" abstract="false" abstract="false" Loading Loading @@ -102170,17 +102272,6 @@ visibility="public" visibility="public" > > </method> </method> <method name="getTechnologyId" return="int" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="reconnect" <method name="reconnect" return="void" return="void" abstract="true" abstract="true" Loading @@ -102194,105 +102285,6 @@ <exception name="IOException" type="java.io.IOException"> <exception name="IOException" type="java.io.IOException"> </exception> </exception> </method> </method> <field name="ISO_DEP" type="int" transient="false" volatile="false" value="3" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="MIFARE_CLASSIC" type="int" transient="false" volatile="false" value="8" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="MIFARE_ULTRALIGHT" type="int" transient="false" volatile="false" value="9" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="NDEF" type="int" transient="false" volatile="false" value="6" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="NDEF_FORMATABLE" type="int" transient="false" volatile="false" value="7" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="NFC_A" type="int" transient="false" volatile="false" value="1" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="NFC_B" type="int" transient="false" volatile="false" value="2" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="NFC_F" type="int" transient="false" volatile="false" value="4" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="NFC_V" type="int" transient="false" volatile="false" value="5" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> </interface> </interface> </package> </package> <package name="android.opengl" <package name="android.opengl"
core/java/android/nfc/NfcAdapter.java +1 −11 Original line number Original line Diff line number Diff line Loading @@ -26,7 +26,7 @@ import android.content.Context; import android.content.IntentFilter; import android.content.IntentFilter; import android.content.pm.IPackageManager; import android.content.pm.IPackageManager; import android.content.pm.PackageManager; import android.content.pm.PackageManager; import android.nfc.technology.TagTechnology; import android.nfc.tech.TagTechnology; import android.os.IBinder; import android.os.IBinder; import android.os.RemoteException; import android.os.RemoteException; import android.os.ServiceManager; import android.os.ServiceManager; Loading Loading @@ -531,16 +531,6 @@ public final class NfcAdapter { } } } } /** * Retrieve a TagTechnology object used to interact with a Tag that is * in field. * <p> * @return TagTechnology object, or null if not present */ public TagTechnology getTechnology(Tag tag, int tech) { return tag.getTechnology(NfcAdapter.this, tech); } /** /** * Set the NDEF Message that this NFC adapter should appear as to Tag * Set the NDEF Message that this NFC adapter should appear as to Tag * readers. * readers. Loading
core/java/android/nfc/NfcSecureElement.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -16,7 +16,7 @@ package android.nfc; package android.nfc; import android.nfc.technology.TagTechnology; import android.nfc.tech.TagTechnology; import android.os.RemoteException; import android.os.RemoteException; import android.util.Log; import android.util.Log; Loading
core/java/android/nfc/Tag.java +28 −57 Original line number Original line Diff line number Diff line Loading @@ -16,20 +16,10 @@ package android.nfc; package android.nfc; import android.nfc.technology.IsoDep; import android.nfc.tech.TagTechnology; import android.nfc.technology.MifareClassic; import android.nfc.technology.MifareUltralight; import android.nfc.technology.NfcV; import android.nfc.technology.Ndef; import android.nfc.technology.NdefFormatable; import android.nfc.technology.NfcA; import android.nfc.technology.NfcB; import android.nfc.technology.NfcF; import android.nfc.technology.TagTechnology; import android.os.Bundle; import android.os.Bundle; import android.os.Parcel; import android.os.Parcel; import android.os.Parcelable; import android.os.Parcelable; import android.os.RemoteException; import java.util.Arrays; import java.util.Arrays; Loading @@ -44,8 +34,8 @@ import java.util.Arrays; * {@link Tag} objects are passed to applications via the {@link NfcAdapter#EXTRA_TAG} extra * {@link Tag} objects are passed to applications via the {@link NfcAdapter#EXTRA_TAG} extra * in {@link NfcAdapter#ACTION_TAG_DISCOVERED} intents. A {@link Tag} object is immutable * in {@link NfcAdapter#ACTION_TAG_DISCOVERED} intents. A {@link Tag} object is immutable * and represents the state of the tag at the time of discovery. It can be * and represents the state of the tag at the time of discovery. It can be * directly queried for its UID and Type, or used to create a {@link TagTechnology} * directly queried for its UID and Type, or used to create a {@link TagTechnology} using the * (with {@link NfcAdapter#getTechnology}). * static <code>get()</code> methods on the varios tech classes. * <p> * <p> * A {@link Tag} can be used to create a {@link TagTechnology} only while the tag is in * A {@link Tag} can be used to create a {@link TagTechnology} only while the tag is in * range. If it is removed and then returned to range, then the most recent * range. If it is removed and then returned to range, then the most recent Loading @@ -61,6 +51,7 @@ public class Tag implements Parcelable { /*package*/ final int[] mTechList; /*package*/ final int[] mTechList; /*package*/ final Bundle[] mTechExtras; /*package*/ final Bundle[] mTechExtras; /*package*/ final int mServiceHandle; // for use by NFC service, 0 indicates a mock /*package*/ final int mServiceHandle; // for use by NFC service, 0 indicates a mock /*package*/ final INfcTag mTagService; /*package*/ int mConnectedTechnology; /*package*/ int mConnectedTechnology; Loading @@ -68,7 +59,8 @@ public class Tag implements Parcelable { * Hidden constructor to be used by NFC service and internal classes. * Hidden constructor to be used by NFC service and internal classes. * @hide * @hide */ */ public Tag(byte[] id, int[] techList, Bundle[] techListExtras, int serviceHandle) { public Tag(byte[] id, int[] techList, Bundle[] techListExtras, int serviceHandle, INfcTag tagService) { if (techList == null) { if (techList == null) { throw new IllegalArgumentException("rawTargets cannot be null"); throw new IllegalArgumentException("rawTargets cannot be null"); } } Loading @@ -77,15 +69,15 @@ public class Tag implements Parcelable { // Ensure mTechExtras is as long as mTechList // Ensure mTechExtras is as long as mTechList mTechExtras = Arrays.copyOf(techListExtras, techList.length); mTechExtras = Arrays.copyOf(techListExtras, techList.length); mServiceHandle = serviceHandle; mServiceHandle = serviceHandle; mTagService = tagService; mConnectedTechnology = -1; mConnectedTechnology = -1; } } /** /** * Construct a mock Tag. * Construct a mock Tag. * <p>This is an application constructed tag, so NfcAdapter methods on this * <p>This is an application constructed tag, so NfcAdapter methods on this Tag may fail * Tag such as {@link NfcAdapter#getTechnology} may fail with * with {@link IllegalArgumentException} since it does not represent a physical Tag. * {@link IllegalArgumentException} since it does not represent a physical Tag. * <p>This constructor might be useful for mock testing. * <p>This constructor might be useful for mock testing. * @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 Loading @@ -93,7 +85,7 @@ public class Tag implements Parcelable { */ */ 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 return new Tag(id, techList, techListExtras, 0); return new Tag(id, techList, techListExtras, 0, null); } } /** /** Loading Loading @@ -127,7 +119,16 @@ public class Tag implements Parcelable { return Arrays.copyOf(mTechList, mTechList.length); return Arrays.copyOf(mTechList, mTechList.length); } } /*package*/ TagTechnology getTechnology(NfcAdapter adapter, int tech) { /** @hide */ public boolean hasTech(int techType) { for (int tech : mTechList) { if (tech == techType) return true; } return false; } /** @hide */ public Bundle getTechExtras(int tech) { int pos = -1; int pos = -1; for (int idx = 0; idx < mTechList.length; idx++) { for (int idx = 0; idx < mTechList.length; idx++) { if (mTechList[idx] == tech) { if (mTechList[idx] == tech) { Loading @@ -139,44 +140,12 @@ public class Tag implements Parcelable { return null; return null; } } Bundle extras = mTechExtras[pos]; return mTechExtras[pos]; try { switch (tech) { case TagTechnology.NFC_A: { return new NfcA(adapter, this, extras); } case TagTechnology.NFC_B: { return new NfcB(adapter, this, extras); } case TagTechnology.ISO_DEP: { return new IsoDep(adapter, this, extras); } case TagTechnology.NFC_V: { return new NfcV(adapter, this, extras); } case TagTechnology.NDEF: { return new Ndef(adapter, this, tech, extras); } case TagTechnology.NDEF_FORMATABLE: { return new NdefFormatable(adapter, this, tech, extras); } case TagTechnology.NFC_F: { return new NfcF(adapter, this, extras); } case TagTechnology.MIFARE_CLASSIC: { return new MifareClassic(adapter, this, extras); } case TagTechnology.MIFARE_ULTRALIGHT: { return new MifareUltralight(adapter, this, extras); } } default: { /** @hide */ throw new UnsupportedOperationException("Tech " + tech + " not supported"); public INfcTag getTagService() { } return mTagService; } } catch (RemoteException e) { return null; } } } @Override @Override Loading Loading @@ -223,6 +192,7 @@ public class Tag implements Parcelable { dest.writeIntArray(mTechList); dest.writeIntArray(mTechList); dest.writeTypedArray(mTechExtras, 0); dest.writeTypedArray(mTechExtras, 0); dest.writeInt(mServiceHandle); dest.writeInt(mServiceHandle); dest.writeStrongBinder(mTagService.asBinder()); } } public static final Parcelable.Creator<Tag> CREATOR = public static final Parcelable.Creator<Tag> CREATOR = Loading @@ -235,8 +205,9 @@ public class Tag implements Parcelable { in.readIntArray(techList); in.readIntArray(techList); Bundle[] techExtras = in.createTypedArray(Bundle.CREATOR); Bundle[] techExtras = in.createTypedArray(Bundle.CREATOR); int serviceHandle = in.readInt(); int serviceHandle = in.readInt(); INfcTag tagService = INfcTag.Stub.asInterface(in.readStrongBinder()); return new Tag(id, techList, techExtras, serviceHandle); return new Tag(id, techList, techExtras, serviceHandle, tagService); } } @Override @Override Loading
core/java/android/nfc/technology/BasicTagTechnology.java→core/java/android/nfc/tech/BasicTagTechnology.java +13 −22 Original line number Original line Diff line number Diff line Loading @@ -14,20 +14,17 @@ * limitations under the License. * limitations under the License. */ */ package android.nfc.technology; package android.nfc.tech; import java.io.IOException; import android.nfc.INfcAdapter; import android.nfc.INfcTag; import android.nfc.NfcAdapter; import android.nfc.TransceiveResult; import android.nfc.Tag; import android.nfc.ErrorCodes; import android.nfc.ErrorCodes; import android.nfc.Tag; import android.nfc.TagLostException; import android.nfc.TagLostException; import android.nfc.TransceiveResult; import android.os.RemoteException; import android.os.RemoteException; import android.util.Log; import android.util.Log; import java.io.IOException; /** /** * A base class for tag technologies that are built on top of transceive(). * A base class for tag technologies that are built on top of transceive(). */ */ Loading @@ -37,11 +34,8 @@ import android.util.Log; /*package*/ final Tag mTag; /*package*/ final Tag mTag; /*package*/ boolean mIsConnected; /*package*/ boolean mIsConnected; /*package*/ int mSelectedTechnology; /*package*/ int mSelectedTechnology; private final NfcAdapter mAdapter; /*package*/ final INfcAdapter mService; /*package*/ final INfcTag mTagService; BasicTagTechnology(NfcAdapter adapter, Tag tag, int tech) throws RemoteException { BasicTagTechnology(Tag tag, int tech) throws RemoteException { int[] techList = tag.getTechnologyList(); int[] techList = tag.getTechnologyList(); int i; int i; Loading @@ -56,15 +50,12 @@ import android.util.Log; throw new IllegalArgumentException("Technology " + tech + " not present on tag " + tag); throw new IllegalArgumentException("Technology " + tech + " not present on tag " + tag); } } mAdapter = adapter; mService = mAdapter.getService(); mTagService = mAdapter.getTagService(); mTag = tag; mTag = tag; mSelectedTechnology = tech; mSelectedTechnology = tech; } } BasicTagTechnology(NfcAdapter adapter, Tag tag) throws RemoteException { BasicTagTechnology(Tag tag) throws RemoteException { this(adapter, tag, tag.getTechnologyList()[0]); this(tag, tag.getTechnologyList()[0]); } } @Override @Override Loading Loading @@ -100,7 +91,7 @@ import android.util.Log; } } try { try { return mTagService.isPresent(mTag.getServiceHandle()); return mTag.getTagService().isPresent(mTag.getServiceHandle()); } catch (RemoteException e) { } catch (RemoteException e) { Log.e(TAG, "NFC service dead", e); Log.e(TAG, "NFC service dead", e); return false; return false; Loading @@ -110,7 +101,7 @@ import android.util.Log; @Override @Override public void connect() throws IOException { public void connect() throws IOException { try { try { int errorCode = mTagService.connect(mTag.getServiceHandle(), getTechnologyId()); int errorCode = mTag.getTagService().connect(mTag.getServiceHandle(), getTechnologyId()); if (errorCode == ErrorCodes.SUCCESS) { if (errorCode == ErrorCodes.SUCCESS) { // Store this in the tag object // Store this in the tag object Loading @@ -132,7 +123,7 @@ import android.util.Log; } } try { try { int errorCode = mTagService.reconnect(mTag.getServiceHandle()); int errorCode = mTag.getTagService().reconnect(mTag.getServiceHandle()); if (errorCode != ErrorCodes.SUCCESS) { if (errorCode != ErrorCodes.SUCCESS) { mIsConnected = false; mIsConnected = false; Loading @@ -153,7 +144,7 @@ import android.util.Log; /* Note that we don't want to physically disconnect the tag, /* Note that we don't want to physically disconnect the tag, * but just reconnect to it to reset its state * but just reconnect to it to reset its state */ */ mTagService.reconnect(mTag.getServiceHandle()); mTag.getTagService().reconnect(mTag.getServiceHandle()); } catch (RemoteException e) { } catch (RemoteException e) { Log.e(TAG, "NFC service dead", e); Log.e(TAG, "NFC service dead", e); } finally { } finally { Loading @@ -167,7 +158,7 @@ import android.util.Log; checkConnected(); checkConnected(); try { try { TransceiveResult result = mTagService.transceive(mTag.getServiceHandle(), data, raw); TransceiveResult result = mTag.getTagService().transceive(mTag.getServiceHandle(), data, raw); if (result == null) { if (result == null) { throw new IOException("transceive failed"); throw new IOException("transceive failed"); } else { } else { Loading