From 25be53652167300183282d170a00a6df576523f5 Mon Sep 17 00:00:00 2001 From: Martijn Coenen Date: Mon, 10 Jan 2011 16:12:52 +0100 Subject: [PATCH] Implement canMakeReadonly(). The method is needed since makeReadOnly() only works on T1T/T2T. Also removed makeLowlevelReadonly(), since NFC forum does not allow setting the CC and the lock bits separately. Change-Id: I8e6d7c065b1f017ef07d878c41df05e1a8193f5a --- core/java/android/nfc/technology/Ndef.java | 28 ++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/core/java/android/nfc/technology/Ndef.java b/core/java/android/nfc/technology/Ndef.java index 457920f8e53d7..5f05b58d506d1 100644 --- a/core/java/android/nfc/technology/Ndef.java +++ b/core/java/android/nfc/technology/Ndef.java @@ -224,7 +224,22 @@ public final class Ndef extends BasicTagTechnology { } /** - * Set the CC field to indicate this tag is read-only + * Indicates whether a tag can be made read-only with + * {@link #makeReadonly()} + */ + public boolean canMakeReadonly() { + if (mNdefType == NFC_FORUM_TYPE_1 || mNdefType == NFC_FORUM_TYPE_2) { + return true; + } else { + return false; + } + } + + /** + * Sets the CC field to indicate this tag is read-only + * and permanently sets the lock bits to prevent any further NDEF + * modifications. + * This is a one-way process and can not be reverted! * @throws IOException */ public boolean makeReadonly() throws IOException { @@ -249,17 +264,6 @@ public final class Ndef extends BasicTagTechnology { } } - /** - * Attempt to use tag specific technology to really make - * the tag read-only - * For NFC Forum Type 1 and 2 only. - */ - public void makeLowLevelReadonly() { - checkConnected(); - - throw new UnsupportedOperationException(); - } - @Override public byte[] transceive(byte[] data) { checkConnected();