Loading core/java/android/nfc/Tag.java +5 −2 Original line number Diff line number Diff line Loading @@ -113,7 +113,7 @@ public final class Tag implements Parcelable { /*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; /*package*/ final INfcTag mTagService; // interface to NFC service, will be null if mock tag /*package*/ int mConnectedTechnology; Loading Loading @@ -148,7 +148,7 @@ public final class Tag implements Parcelable { * @hide */ public static Tag createMockTag(byte[] id, int[] techList, Bundle[] techListExtras) { // set serviceHandle to 0 to indicate mock tag // set serviceHandle to 0 and tagService to null to indicate mock tag return new Tag(id, techList, techListExtras, 0, null); } Loading Loading @@ -266,6 +266,9 @@ public final class Tag implements Parcelable { throw new IllegalStateException("Close connection to the technology first!"); } if (mTagService == null) { throw new IOException("Mock tags don't support this operation."); } try { Tag newTag = mTagService.rediscover(getServiceHandle()); if (newTag != null) { Loading core/java/android/nfc/tech/Ndef.java +12 −0 Original line number Diff line number Diff line Loading @@ -259,6 +259,9 @@ public final class Ndef extends BasicTagTechnology { try { INfcTag tagService = mTag.getTagService(); if (tagService == null) { throw new IOException("Mock tags don't support this operation."); } int serviceHandle = mTag.getServiceHandle(); if (tagService.isNdef(serviceHandle)) { NdefMessage msg = tagService.ndefRead(serviceHandle); Loading Loading @@ -303,6 +306,9 @@ public final class Ndef extends BasicTagTechnology { try { INfcTag tagService = mTag.getTagService(); if (tagService == null) { throw new IOException("Mock tags don't support this operation."); } int serviceHandle = mTag.getServiceHandle(); if (tagService.isNdef(serviceHandle)) { int errorCode = tagService.ndefWrite(serviceHandle, msg); Loading Loading @@ -335,6 +341,9 @@ public final class Ndef extends BasicTagTechnology { */ public boolean canMakeReadOnly() { INfcTag tagService = mTag.getTagService(); if (tagService == null) { return false; } try { return tagService.canMakeReadOnly(mNdefType); } catch (RemoteException e) { Loading Loading @@ -366,6 +375,9 @@ public final class Ndef extends BasicTagTechnology { try { INfcTag tagService = mTag.getTagService(); if (tagService == null) { return false; } if (tagService.isNdef(mTag.getServiceHandle())) { int errorCode = tagService.ndefMakeReadOnly(mTag.getServiceHandle()); switch (errorCode) { Loading Loading
core/java/android/nfc/Tag.java +5 −2 Original line number Diff line number Diff line Loading @@ -113,7 +113,7 @@ public final class Tag implements Parcelable { /*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; /*package*/ final INfcTag mTagService; // interface to NFC service, will be null if mock tag /*package*/ int mConnectedTechnology; Loading Loading @@ -148,7 +148,7 @@ public final class Tag implements Parcelable { * @hide */ public static Tag createMockTag(byte[] id, int[] techList, Bundle[] techListExtras) { // set serviceHandle to 0 to indicate mock tag // set serviceHandle to 0 and tagService to null to indicate mock tag return new Tag(id, techList, techListExtras, 0, null); } Loading Loading @@ -266,6 +266,9 @@ public final class Tag implements Parcelable { throw new IllegalStateException("Close connection to the technology first!"); } if (mTagService == null) { throw new IOException("Mock tags don't support this operation."); } try { Tag newTag = mTagService.rediscover(getServiceHandle()); if (newTag != null) { Loading
core/java/android/nfc/tech/Ndef.java +12 −0 Original line number Diff line number Diff line Loading @@ -259,6 +259,9 @@ public final class Ndef extends BasicTagTechnology { try { INfcTag tagService = mTag.getTagService(); if (tagService == null) { throw new IOException("Mock tags don't support this operation."); } int serviceHandle = mTag.getServiceHandle(); if (tagService.isNdef(serviceHandle)) { NdefMessage msg = tagService.ndefRead(serviceHandle); Loading Loading @@ -303,6 +306,9 @@ public final class Ndef extends BasicTagTechnology { try { INfcTag tagService = mTag.getTagService(); if (tagService == null) { throw new IOException("Mock tags don't support this operation."); } int serviceHandle = mTag.getServiceHandle(); if (tagService.isNdef(serviceHandle)) { int errorCode = tagService.ndefWrite(serviceHandle, msg); Loading Loading @@ -335,6 +341,9 @@ public final class Ndef extends BasicTagTechnology { */ public boolean canMakeReadOnly() { INfcTag tagService = mTag.getTagService(); if (tagService == null) { return false; } try { return tagService.canMakeReadOnly(mNdefType); } catch (RemoteException e) { Loading Loading @@ -366,6 +375,9 @@ public final class Ndef extends BasicTagTechnology { try { INfcTag tagService = mTag.getTagService(); if (tagService == null) { return false; } if (tagService.isNdef(mTag.getServiceHandle())) { int errorCode = tagService.ndefMakeReadOnly(mTag.getServiceHandle()); switch (errorCode) { Loading