Loading api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -12621,6 +12621,7 @@ package android.nfc { ctor public NdefMessage(android.nfc.NdefRecord, android.nfc.NdefRecord...); ctor public NdefMessage(android.nfc.NdefRecord[]); method public int describeContents(); method public int getByteLength(); method public android.nfc.NdefRecord[] getRecords(); method public byte[] toByteArray(); method public void writeToParcel(android.os.Parcel, int); core/java/android/nfc/INfcAdapter.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -44,5 +44,5 @@ interface INfcAdapter in IntentFilter[] filters, in TechListParcel techLists); void setForegroundNdefPush(in NdefMessage msg, in INdefPushCallback callback); void dispatch(in Tag tag, in NdefMessage message); void dispatch(in Tag tag); } core/java/android/nfc/NdefMessage.java +24 −6 Original line number Diff line number Diff line Loading @@ -158,7 +158,28 @@ public final class NdefMessage implements Parcelable { } /** * Return this NDEF MEssage as raw bytes.<p> * Return the length of this NDEF Message if it is written to a byte array * with {@link #toByteArray}.<p> * An NDEF Message can be formatted to bytes in different ways * depending on chunking, SR, and ID flags, so the length returned * by this method may not be equal to the length of the original * byte array used to construct this NDEF Message. However it will * always be equal to the length of the byte array produced by * {@link #toByteArray}. * * @return length of this NDEF Message when written to bytes with {@link toByteArray} * @see #toByteArray */ public int getByteArrayLength() { int length = 0; for (NdefRecord r : mRecords) { length += r.getByteLength(); } return length; } /** * Return this NDEF Message as raw bytes.<p> * The NDEF Message is formatted as per the NDEF 1.0 specification, * and the byte array is suitable for network transmission or storage * in an NFC Forum NDEF compatible tag.<p> Loading @@ -166,13 +187,10 @@ public final class NdefMessage implements Parcelable { * short record (SR) format and omit the identifier field when possible. * * @return NDEF Message in binary format * @see getByteArrayLength */ public byte[] toByteArray() { int length = 0; for (NdefRecord r : mRecords) { length += r.getByteLength(); } int length = getByteArrayLength(); ByteBuffer buffer = ByteBuffer.allocate(length); for (int i=0; i<mRecords.length; i++) { Loading core/java/android/nfc/NfcAdapter.java +2 −2 Original line number Diff line number Diff line Loading @@ -889,12 +889,12 @@ public final class NfcAdapter { * {@link android.Manifest.permission#WRITE_SECURE_SETTINGS} permission. * @hide */ public void dispatch(Tag tag, NdefMessage message) { public void dispatch(Tag tag) { if (tag == null) { throw new NullPointerException("tag cannot be null"); } try { sService.dispatch(tag, message); sService.dispatch(tag); } catch (RemoteException e) { attemptDeadServiceRecovery(e); } Loading core/java/android/nfc/Tag.java +8 −8 Original line number Diff line number Diff line Loading @@ -108,14 +108,14 @@ import java.util.Arrays; * <p> */ public final class Tag implements Parcelable { /*package*/ final byte[] mId; /*package*/ final int[] mTechList; /*package*/ final String[] mTechStringList; /*package*/ final Bundle[] mTechExtras; /*package*/ final int mServiceHandle; // for use by NFC service, 0 indicates a mock /*package*/ final INfcTag mTagService; // interface to NFC service, will be null if mock tag /*package*/ int mConnectedTechnology; final byte[] mId; final int[] mTechList; final String[] mTechStringList; final Bundle[] mTechExtras; final int mServiceHandle; // for use by NFC service, 0 indicates a mock final INfcTag mTagService; // interface to NFC service, will be null if mock tag int mConnectedTechnology; /** * Hidden constructor to be used by NFC service and internal classes. Loading Loading
api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -12621,6 +12621,7 @@ package android.nfc { ctor public NdefMessage(android.nfc.NdefRecord, android.nfc.NdefRecord...); ctor public NdefMessage(android.nfc.NdefRecord[]); method public int describeContents(); method public int getByteLength(); method public android.nfc.NdefRecord[] getRecords(); method public byte[] toByteArray(); method public void writeToParcel(android.os.Parcel, int);
core/java/android/nfc/INfcAdapter.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -44,5 +44,5 @@ interface INfcAdapter in IntentFilter[] filters, in TechListParcel techLists); void setForegroundNdefPush(in NdefMessage msg, in INdefPushCallback callback); void dispatch(in Tag tag, in NdefMessage message); void dispatch(in Tag tag); }
core/java/android/nfc/NdefMessage.java +24 −6 Original line number Diff line number Diff line Loading @@ -158,7 +158,28 @@ public final class NdefMessage implements Parcelable { } /** * Return this NDEF MEssage as raw bytes.<p> * Return the length of this NDEF Message if it is written to a byte array * with {@link #toByteArray}.<p> * An NDEF Message can be formatted to bytes in different ways * depending on chunking, SR, and ID flags, so the length returned * by this method may not be equal to the length of the original * byte array used to construct this NDEF Message. However it will * always be equal to the length of the byte array produced by * {@link #toByteArray}. * * @return length of this NDEF Message when written to bytes with {@link toByteArray} * @see #toByteArray */ public int getByteArrayLength() { int length = 0; for (NdefRecord r : mRecords) { length += r.getByteLength(); } return length; } /** * Return this NDEF Message as raw bytes.<p> * The NDEF Message is formatted as per the NDEF 1.0 specification, * and the byte array is suitable for network transmission or storage * in an NFC Forum NDEF compatible tag.<p> Loading @@ -166,13 +187,10 @@ public final class NdefMessage implements Parcelable { * short record (SR) format and omit the identifier field when possible. * * @return NDEF Message in binary format * @see getByteArrayLength */ public byte[] toByteArray() { int length = 0; for (NdefRecord r : mRecords) { length += r.getByteLength(); } int length = getByteArrayLength(); ByteBuffer buffer = ByteBuffer.allocate(length); for (int i=0; i<mRecords.length; i++) { Loading
core/java/android/nfc/NfcAdapter.java +2 −2 Original line number Diff line number Diff line Loading @@ -889,12 +889,12 @@ public final class NfcAdapter { * {@link android.Manifest.permission#WRITE_SECURE_SETTINGS} permission. * @hide */ public void dispatch(Tag tag, NdefMessage message) { public void dispatch(Tag tag) { if (tag == null) { throw new NullPointerException("tag cannot be null"); } try { sService.dispatch(tag, message); sService.dispatch(tag); } catch (RemoteException e) { attemptDeadServiceRecovery(e); } Loading
core/java/android/nfc/Tag.java +8 −8 Original line number Diff line number Diff line Loading @@ -108,14 +108,14 @@ import java.util.Arrays; * <p> */ public final class Tag implements Parcelable { /*package*/ final byte[] mId; /*package*/ final int[] mTechList; /*package*/ final String[] mTechStringList; /*package*/ final Bundle[] mTechExtras; /*package*/ final int mServiceHandle; // for use by NFC service, 0 indicates a mock /*package*/ final INfcTag mTagService; // interface to NFC service, will be null if mock tag /*package*/ int mConnectedTechnology; final byte[] mId; final int[] mTechList; final String[] mTechStringList; final Bundle[] mTechExtras; final int mServiceHandle; // for use by NFC service, 0 indicates a mock final INfcTag mTagService; // interface to NFC service, will be null if mock tag int mConnectedTechnology; /** * Hidden constructor to be used by NFC service and internal classes. Loading