xref: /aosp_15_r20/prebuilts/sdk/34/public/api/framework-nfc.txt (revision 344a7f5ef16c479e7a7f54ee6567a9d112f9e72b)
1// Signature format: 2.0
2package android.nfc {
3
4  public final class AvailableNfcAntenna implements android.os.Parcelable {
5    ctor public AvailableNfcAntenna(int, int);
6    method public int describeContents();
7    method public int getLocationX();
8    method public int getLocationY();
9    method public void writeToParcel(@NonNull android.os.Parcel, int);
10    field @NonNull public static final android.os.Parcelable.Creator<android.nfc.AvailableNfcAntenna> CREATOR;
11  }
12
13  public class FormatException extends java.lang.Exception {
14    ctor public FormatException();
15    ctor public FormatException(String);
16    ctor public FormatException(String, Throwable);
17  }
18
19  public final class NdefMessage implements android.os.Parcelable {
20    ctor public NdefMessage(byte[]) throws android.nfc.FormatException;
21    ctor public NdefMessage(android.nfc.NdefRecord, android.nfc.NdefRecord...);
22    ctor public NdefMessage(android.nfc.NdefRecord[]);
23    method public int describeContents();
24    method public int getByteArrayLength();
25    method public android.nfc.NdefRecord[] getRecords();
26    method public byte[] toByteArray();
27    method public void writeToParcel(android.os.Parcel, int);
28    field @NonNull public static final android.os.Parcelable.Creator<android.nfc.NdefMessage> CREATOR;
29  }
30
31  public final class NdefRecord implements android.os.Parcelable {
32    ctor public NdefRecord(short, byte[], byte[], byte[]);
33    ctor @Deprecated public NdefRecord(byte[]) throws android.nfc.FormatException;
34    method public static android.nfc.NdefRecord createApplicationRecord(String);
35    method public static android.nfc.NdefRecord createExternal(String, String, byte[]);
36    method public static android.nfc.NdefRecord createMime(String, byte[]);
37    method public static android.nfc.NdefRecord createTextRecord(String, String);
38    method public static android.nfc.NdefRecord createUri(android.net.Uri);
39    method public static android.nfc.NdefRecord createUri(String);
40    method public int describeContents();
41    method public byte[] getId();
42    method public byte[] getPayload();
43    method public short getTnf();
44    method public byte[] getType();
45    method @Deprecated public byte[] toByteArray();
46    method public String toMimeType();
47    method public android.net.Uri toUri();
48    method public void writeToParcel(android.os.Parcel, int);
49    field @NonNull public static final android.os.Parcelable.Creator<android.nfc.NdefRecord> CREATOR;
50    field public static final byte[] RTD_ALTERNATIVE_CARRIER;
51    field public static final byte[] RTD_HANDOVER_CARRIER;
52    field public static final byte[] RTD_HANDOVER_REQUEST;
53    field public static final byte[] RTD_HANDOVER_SELECT;
54    field public static final byte[] RTD_SMART_POSTER;
55    field public static final byte[] RTD_TEXT;
56    field public static final byte[] RTD_URI;
57    field public static final short TNF_ABSOLUTE_URI = 3; // 0x3
58    field public static final short TNF_EMPTY = 0; // 0x0
59    field public static final short TNF_EXTERNAL_TYPE = 4; // 0x4
60    field public static final short TNF_MIME_MEDIA = 2; // 0x2
61    field public static final short TNF_UNCHANGED = 6; // 0x6
62    field public static final short TNF_UNKNOWN = 5; // 0x5
63    field public static final short TNF_WELL_KNOWN = 1; // 0x1
64  }
65
66  public final class NfcAdapter {
67    method public void disableForegroundDispatch(android.app.Activity);
68    method public void disableReaderMode(android.app.Activity);
69    method public void enableForegroundDispatch(android.app.Activity, android.app.PendingIntent, android.content.IntentFilter[], String[][]);
70    method public void enableReaderMode(android.app.Activity, android.nfc.NfcAdapter.ReaderCallback, int, android.os.Bundle);
71    method public static android.nfc.NfcAdapter getDefaultAdapter(android.content.Context);
72    method @Nullable public android.nfc.NfcAntennaInfo getNfcAntennaInfo();
73    method public boolean ignore(android.nfc.Tag, int, android.nfc.NfcAdapter.OnTagRemovedListener, android.os.Handler);
74    method public boolean isEnabled();
75    method public boolean isSecureNfcEnabled();
76    method public boolean isSecureNfcSupported();
77    field public static final String ACTION_ADAPTER_STATE_CHANGED = "android.nfc.action.ADAPTER_STATE_CHANGED";
78    field public static final String ACTION_NDEF_DISCOVERED = "android.nfc.action.NDEF_DISCOVERED";
79    field @RequiresPermission(android.Manifest.permission.NFC_PREFERRED_PAYMENT_INFO) public static final String ACTION_PREFERRED_PAYMENT_CHANGED = "android.nfc.action.PREFERRED_PAYMENT_CHANGED";
80    field public static final String ACTION_TAG_DISCOVERED = "android.nfc.action.TAG_DISCOVERED";
81    field public static final String ACTION_TECH_DISCOVERED = "android.nfc.action.TECH_DISCOVERED";
82    field @RequiresPermission(android.Manifest.permission.NFC_TRANSACTION_EVENT) public static final String ACTION_TRANSACTION_DETECTED = "android.nfc.action.TRANSACTION_DETECTED";
83    field public static final String EXTRA_ADAPTER_STATE = "android.nfc.extra.ADAPTER_STATE";
84    field public static final String EXTRA_AID = "android.nfc.extra.AID";
85    field public static final String EXTRA_DATA = "android.nfc.extra.DATA";
86    field public static final String EXTRA_ID = "android.nfc.extra.ID";
87    field public static final String EXTRA_NDEF_MESSAGES = "android.nfc.extra.NDEF_MESSAGES";
88    field public static final String EXTRA_PREFERRED_PAYMENT_CHANGED_REASON = "android.nfc.extra.PREFERRED_PAYMENT_CHANGED_REASON";
89    field public static final String EXTRA_READER_PRESENCE_CHECK_DELAY = "presence";
90    field public static final String EXTRA_SECURE_ELEMENT_NAME = "android.nfc.extra.SECURE_ELEMENT_NAME";
91    field public static final String EXTRA_TAG = "android.nfc.extra.TAG";
92    field public static final int FLAG_READER_NFC_A = 1; // 0x1
93    field public static final int FLAG_READER_NFC_B = 2; // 0x2
94    field public static final int FLAG_READER_NFC_BARCODE = 16; // 0x10
95    field public static final int FLAG_READER_NFC_F = 4; // 0x4
96    field public static final int FLAG_READER_NFC_V = 8; // 0x8
97    field public static final int FLAG_READER_NO_PLATFORM_SOUNDS = 256; // 0x100
98    field public static final int FLAG_READER_SKIP_NDEF_CHECK = 128; // 0x80
99    field public static final int PREFERRED_PAYMENT_CHANGED = 2; // 0x2
100    field public static final int PREFERRED_PAYMENT_LOADED = 1; // 0x1
101    field public static final int PREFERRED_PAYMENT_UPDATED = 3; // 0x3
102    field public static final int STATE_OFF = 1; // 0x1
103    field public static final int STATE_ON = 3; // 0x3
104    field public static final int STATE_TURNING_OFF = 4; // 0x4
105    field public static final int STATE_TURNING_ON = 2; // 0x2
106  }
107
108  @Deprecated public static interface NfcAdapter.CreateBeamUrisCallback {
109    method @Deprecated public android.net.Uri[] createBeamUris(android.nfc.NfcEvent);
110  }
111
112  @Deprecated public static interface NfcAdapter.CreateNdefMessageCallback {
113    method @Deprecated public android.nfc.NdefMessage createNdefMessage(android.nfc.NfcEvent);
114  }
115
116  @Deprecated public static interface NfcAdapter.OnNdefPushCompleteCallback {
117    method @Deprecated public void onNdefPushComplete(android.nfc.NfcEvent);
118  }
119
120  public static interface NfcAdapter.OnTagRemovedListener {
121    method public void onTagRemoved();
122  }
123
124  public static interface NfcAdapter.ReaderCallback {
125    method public void onTagDiscovered(android.nfc.Tag);
126  }
127
128  public final class NfcAntennaInfo implements android.os.Parcelable {
129    ctor public NfcAntennaInfo(int, int, boolean, @NonNull java.util.List<android.nfc.AvailableNfcAntenna>);
130    method public int describeContents();
131    method @NonNull public java.util.List<android.nfc.AvailableNfcAntenna> getAvailableNfcAntennas();
132    method public int getDeviceHeight();
133    method public int getDeviceWidth();
134    method public boolean isDeviceFoldable();
135    method public void writeToParcel(@NonNull android.os.Parcel, int);
136    field @NonNull public static final android.os.Parcelable.Creator<android.nfc.NfcAntennaInfo> CREATOR;
137  }
138
139  public final class NfcEvent {
140    field public final android.nfc.NfcAdapter nfcAdapter;
141    field public final int peerLlcpMajorVersion;
142    field public final int peerLlcpMinorVersion;
143  }
144
145  public final class NfcManager {
146    method public android.nfc.NfcAdapter getDefaultAdapter();
147  }
148
149  public final class Tag implements android.os.Parcelable {
150    method public int describeContents();
151    method public byte[] getId();
152    method public String[] getTechList();
153    method public void writeToParcel(android.os.Parcel, int);
154    field @NonNull public static final android.os.Parcelable.Creator<android.nfc.Tag> CREATOR;
155  }
156
157  public class TagLostException extends java.io.IOException {
158    ctor public TagLostException();
159    ctor public TagLostException(String);
160  }
161
162}
163
164package android.nfc.cardemulation {
165
166  public final class CardEmulation {
167    method public boolean categoryAllowsForegroundPreference(String);
168    method @Nullable @RequiresPermission(android.Manifest.permission.NFC_PREFERRED_PAYMENT_INFO) public java.util.List<java.lang.String> getAidsForPreferredPaymentService();
169    method public java.util.List<java.lang.String> getAidsForService(android.content.ComponentName, String);
170    method @Nullable @RequiresPermission(android.Manifest.permission.NFC_PREFERRED_PAYMENT_INFO) public CharSequence getDescriptionForPreferredPaymentService();
171    method public static android.nfc.cardemulation.CardEmulation getInstance(android.nfc.NfcAdapter);
172    method @Nullable @RequiresPermission(android.Manifest.permission.NFC_PREFERRED_PAYMENT_INFO) public String getRouteDestinationForPreferredPaymentService();
173    method public int getSelectionModeForCategory(String);
174    method public boolean isDefaultServiceForAid(android.content.ComponentName, String);
175    method public boolean isDefaultServiceForCategory(android.content.ComponentName, String);
176    method public boolean registerAidsForService(android.content.ComponentName, String, java.util.List<java.lang.String>);
177    method public boolean removeAidsForService(android.content.ComponentName, String);
178    method @NonNull @RequiresPermission(android.Manifest.permission.NFC) public boolean setOffHostForService(@NonNull android.content.ComponentName, @NonNull String);
179    method public boolean setPreferredService(android.app.Activity, android.content.ComponentName);
180    method public boolean supportsAidPrefixRegistration();
181    method @NonNull @RequiresPermission(android.Manifest.permission.NFC) public boolean unsetOffHostForService(@NonNull android.content.ComponentName);
182    method public boolean unsetPreferredService(android.app.Activity);
183    field public static final String ACTION_CHANGE_DEFAULT = "android.nfc.cardemulation.action.ACTION_CHANGE_DEFAULT";
184    field public static final String CATEGORY_OTHER = "other";
185    field public static final String CATEGORY_PAYMENT = "payment";
186    field public static final String EXTRA_CATEGORY = "category";
187    field public static final String EXTRA_SERVICE_COMPONENT = "component";
188    field public static final int SELECTION_MODE_ALWAYS_ASK = 1; // 0x1
189    field public static final int SELECTION_MODE_ASK_IF_CONFLICT = 2; // 0x2
190    field public static final int SELECTION_MODE_PREFER_DEFAULT = 0; // 0x0
191  }
192
193  public abstract class HostApduService extends android.app.Service {
194    ctor public HostApduService();
195    method public final void notifyUnhandled();
196    method public final android.os.IBinder onBind(android.content.Intent);
197    method public abstract void onDeactivated(int);
198    method public abstract byte[] processCommandApdu(byte[], android.os.Bundle);
199    method public final void sendResponseApdu(byte[]);
200    field public static final int DEACTIVATION_DESELECTED = 1; // 0x1
201    field public static final int DEACTIVATION_LINK_LOSS = 0; // 0x0
202    field public static final String SERVICE_INTERFACE = "android.nfc.cardemulation.action.HOST_APDU_SERVICE";
203    field public static final String SERVICE_META_DATA = "android.nfc.cardemulation.host_apdu_service";
204  }
205
206  public abstract class HostNfcFService extends android.app.Service {
207    ctor public HostNfcFService();
208    method public final android.os.IBinder onBind(android.content.Intent);
209    method public abstract void onDeactivated(int);
210    method public abstract byte[] processNfcFPacket(byte[], android.os.Bundle);
211    method public final void sendResponsePacket(byte[]);
212    field public static final int DEACTIVATION_LINK_LOSS = 0; // 0x0
213    field public static final String SERVICE_INTERFACE = "android.nfc.cardemulation.action.HOST_NFCF_SERVICE";
214    field public static final String SERVICE_META_DATA = "android.nfc.cardemulation.host_nfcf_service";
215  }
216
217  public final class NfcFCardEmulation {
218    method public boolean disableService(android.app.Activity) throws java.lang.RuntimeException;
219    method public boolean enableService(android.app.Activity, android.content.ComponentName) throws java.lang.RuntimeException;
220    method public static android.nfc.cardemulation.NfcFCardEmulation getInstance(android.nfc.NfcAdapter);
221    method public String getNfcid2ForService(android.content.ComponentName) throws java.lang.RuntimeException;
222    method public String getSystemCodeForService(android.content.ComponentName) throws java.lang.RuntimeException;
223    method public boolean registerSystemCodeForService(android.content.ComponentName, String) throws java.lang.RuntimeException;
224    method public boolean setNfcid2ForService(android.content.ComponentName, String) throws java.lang.RuntimeException;
225    method public boolean unregisterSystemCodeForService(android.content.ComponentName) throws java.lang.RuntimeException;
226  }
227
228  public abstract class OffHostApduService extends android.app.Service {
229    ctor public OffHostApduService();
230    field public static final String SERVICE_INTERFACE = "android.nfc.cardemulation.action.OFF_HOST_APDU_SERVICE";
231    field public static final String SERVICE_META_DATA = "android.nfc.cardemulation.off_host_apdu_service";
232  }
233
234}
235
236package android.nfc.tech {
237
238  public final class IsoDep implements android.nfc.tech.TagTechnology {
239    method public void close() throws java.io.IOException;
240    method public void connect() throws java.io.IOException;
241    method public static android.nfc.tech.IsoDep get(android.nfc.Tag);
242    method public byte[] getHiLayerResponse();
243    method public byte[] getHistoricalBytes();
244    method public int getMaxTransceiveLength();
245    method public android.nfc.Tag getTag();
246    method public int getTimeout();
247    method public boolean isConnected();
248    method public boolean isExtendedLengthApduSupported();
249    method public void setTimeout(int);
250    method public byte[] transceive(byte[]) throws java.io.IOException;
251  }
252
253  public final class MifareClassic implements android.nfc.tech.TagTechnology {
254    method public boolean authenticateSectorWithKeyA(int, byte[]) throws java.io.IOException;
255    method public boolean authenticateSectorWithKeyB(int, byte[]) throws java.io.IOException;
256    method public int blockToSector(int);
257    method public void close() throws java.io.IOException;
258    method public void connect() throws java.io.IOException;
259    method public void decrement(int, int) throws java.io.IOException;
260    method public static android.nfc.tech.MifareClassic get(android.nfc.Tag);
261    method public int getBlockCount();
262    method public int getBlockCountInSector(int);
263    method public int getMaxTransceiveLength();
264    method public int getSectorCount();
265    method public int getSize();
266    method public android.nfc.Tag getTag();
267    method public int getTimeout();
268    method public int getType();
269    method public void increment(int, int) throws java.io.IOException;
270    method public boolean isConnected();
271    method public byte[] readBlock(int) throws java.io.IOException;
272    method public void restore(int) throws java.io.IOException;
273    method public int sectorToBlock(int);
274    method public void setTimeout(int);
275    method public byte[] transceive(byte[]) throws java.io.IOException;
276    method public void transfer(int) throws java.io.IOException;
277    method public void writeBlock(int, byte[]) throws java.io.IOException;
278    field public static final int BLOCK_SIZE = 16; // 0x10
279    field public static final byte[] KEY_DEFAULT;
280    field public static final byte[] KEY_MIFARE_APPLICATION_DIRECTORY;
281    field public static final byte[] KEY_NFC_FORUM;
282    field public static final int SIZE_1K = 1024; // 0x400
283    field public static final int SIZE_2K = 2048; // 0x800
284    field public static final int SIZE_4K = 4096; // 0x1000
285    field public static final int SIZE_MINI = 320; // 0x140
286    field public static final int TYPE_CLASSIC = 0; // 0x0
287    field public static final int TYPE_PLUS = 1; // 0x1
288    field public static final int TYPE_PRO = 2; // 0x2
289    field public static final int TYPE_UNKNOWN = -1; // 0xffffffff
290  }
291
292  public final class MifareUltralight implements android.nfc.tech.TagTechnology {
293    method public void close() throws java.io.IOException;
294    method public void connect() throws java.io.IOException;
295    method public static android.nfc.tech.MifareUltralight get(android.nfc.Tag);
296    method public int getMaxTransceiveLength();
297    method public android.nfc.Tag getTag();
298    method public int getTimeout();
299    method public int getType();
300    method public boolean isConnected();
301    method public byte[] readPages(int) throws java.io.IOException;
302    method public void setTimeout(int);
303    method public byte[] transceive(byte[]) throws java.io.IOException;
304    method public void writePage(int, byte[]) throws java.io.IOException;
305    field public static final int PAGE_SIZE = 4; // 0x4
306    field public static final int TYPE_ULTRALIGHT = 1; // 0x1
307    field public static final int TYPE_ULTRALIGHT_C = 2; // 0x2
308    field public static final int TYPE_UNKNOWN = -1; // 0xffffffff
309  }
310
311  public final class Ndef implements android.nfc.tech.TagTechnology {
312    method public boolean canMakeReadOnly();
313    method public void close() throws java.io.IOException;
314    method public void connect() throws java.io.IOException;
315    method public static android.nfc.tech.Ndef get(android.nfc.Tag);
316    method public android.nfc.NdefMessage getCachedNdefMessage();
317    method public int getMaxSize();
318    method public android.nfc.NdefMessage getNdefMessage() throws android.nfc.FormatException, java.io.IOException;
319    method public android.nfc.Tag getTag();
320    method public String getType();
321    method public boolean isConnected();
322    method public boolean isWritable();
323    method public boolean makeReadOnly() throws java.io.IOException;
324    method public void writeNdefMessage(android.nfc.NdefMessage) throws android.nfc.FormatException, java.io.IOException;
325    field public static final String MIFARE_CLASSIC = "com.nxp.ndef.mifareclassic";
326    field public static final String NFC_FORUM_TYPE_1 = "org.nfcforum.ndef.type1";
327    field public static final String NFC_FORUM_TYPE_2 = "org.nfcforum.ndef.type2";
328    field public static final String NFC_FORUM_TYPE_3 = "org.nfcforum.ndef.type3";
329    field public static final String NFC_FORUM_TYPE_4 = "org.nfcforum.ndef.type4";
330  }
331
332  public final class NdefFormatable implements android.nfc.tech.TagTechnology {
333    method public void close() throws java.io.IOException;
334    method public void connect() throws java.io.IOException;
335    method public void format(android.nfc.NdefMessage) throws android.nfc.FormatException, java.io.IOException;
336    method public void formatReadOnly(android.nfc.NdefMessage) throws android.nfc.FormatException, java.io.IOException;
337    method public static android.nfc.tech.NdefFormatable get(android.nfc.Tag);
338    method public android.nfc.Tag getTag();
339    method public boolean isConnected();
340  }
341
342  public final class NfcA implements android.nfc.tech.TagTechnology {
343    method public void close() throws java.io.IOException;
344    method public void connect() throws java.io.IOException;
345    method public static android.nfc.tech.NfcA get(android.nfc.Tag);
346    method public byte[] getAtqa();
347    method public int getMaxTransceiveLength();
348    method public short getSak();
349    method public android.nfc.Tag getTag();
350    method public int getTimeout();
351    method public boolean isConnected();
352    method public void setTimeout(int);
353    method public byte[] transceive(byte[]) throws java.io.IOException;
354  }
355
356  public final class NfcB implements android.nfc.tech.TagTechnology {
357    method public void close() throws java.io.IOException;
358    method public void connect() throws java.io.IOException;
359    method public static android.nfc.tech.NfcB get(android.nfc.Tag);
360    method public byte[] getApplicationData();
361    method public int getMaxTransceiveLength();
362    method public byte[] getProtocolInfo();
363    method public android.nfc.Tag getTag();
364    method public boolean isConnected();
365    method public byte[] transceive(byte[]) throws java.io.IOException;
366  }
367
368  public final class NfcBarcode implements android.nfc.tech.TagTechnology {
369    method public void close() throws java.io.IOException;
370    method public void connect() throws java.io.IOException;
371    method public static android.nfc.tech.NfcBarcode get(android.nfc.Tag);
372    method public byte[] getBarcode();
373    method public android.nfc.Tag getTag();
374    method public int getType();
375    method public boolean isConnected();
376    field public static final int TYPE_KOVIO = 1; // 0x1
377    field public static final int TYPE_UNKNOWN = -1; // 0xffffffff
378  }
379
380  public final class NfcF implements android.nfc.tech.TagTechnology {
381    method public void close() throws java.io.IOException;
382    method public void connect() throws java.io.IOException;
383    method public static android.nfc.tech.NfcF get(android.nfc.Tag);
384    method public byte[] getManufacturer();
385    method public int getMaxTransceiveLength();
386    method public byte[] getSystemCode();
387    method public android.nfc.Tag getTag();
388    method public int getTimeout();
389    method public boolean isConnected();
390    method public void setTimeout(int);
391    method public byte[] transceive(byte[]) throws java.io.IOException;
392  }
393
394  public final class NfcV implements android.nfc.tech.TagTechnology {
395    method public void close() throws java.io.IOException;
396    method public void connect() throws java.io.IOException;
397    method public static android.nfc.tech.NfcV get(android.nfc.Tag);
398    method public byte getDsfId();
399    method public int getMaxTransceiveLength();
400    method public byte getResponseFlags();
401    method public android.nfc.Tag getTag();
402    method public boolean isConnected();
403    method public byte[] transceive(byte[]) throws java.io.IOException;
404  }
405
406  public interface TagTechnology extends java.io.Closeable {
407    method public void connect() throws java.io.IOException;
408    method public android.nfc.Tag getTag();
409    method public boolean isConnected();
410  }
411
412}
413
414