summaryrefslogtreecommitdiffstats
path: root/core/java/android/nfc/tech
diff options
context:
space:
mode:
authorMartijn Coenen <maco@google.com>2012-03-29 10:09:19 -0700
committerMartijn Coenen <maco@google.com>2012-03-29 10:09:19 -0700
commit2976da0305367ac051d0fcae160bfdb0497b2750 (patch)
tree5e623512d89977a31e884b4ccb2ade62e6144081 /core/java/android/nfc/tech
parent5fa47298af9f8495a162db77d718ba2cb82ee113 (diff)
downloadframeworks_base-2976da0305367ac051d0fcae160bfdb0497b2750.zip
frameworks_base-2976da0305367ac051d0fcae160bfdb0497b2750.tar.gz
frameworks_base-2976da0305367ac051d0fcae160bfdb0497b2750.tar.bz2
Allow formatting a tag as NDEF without a message.
Change-Id: I53a219eec17450b2d0ddc42556f0b930d9b34615
Diffstat (limited to 'core/java/android/nfc/tech')
-rw-r--r--core/java/android/nfc/tech/NdefFormatable.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/core/java/android/nfc/tech/NdefFormatable.java b/core/java/android/nfc/tech/NdefFormatable.java
index bb2eb94..ffa6a2b 100644
--- a/core/java/android/nfc/tech/NdefFormatable.java
+++ b/core/java/android/nfc/tech/NdefFormatable.java
@@ -137,7 +137,12 @@ public final class NdefFormatable extends BasicTagTechnology {
throw new IOException();
}
// Now check and see if the format worked
- if (tagService.isNdef(serviceHandle)) {
+ if (!tagService.isNdef(serviceHandle)) {
+ throw new IOException();
+ }
+
+ // Write a message, if one was provided
+ if (firstMessage != null) {
errorCode = tagService.ndefWrite(serviceHandle, firstMessage);
switch (errorCode) {
case ErrorCodes.SUCCESS:
@@ -150,9 +155,8 @@ public final class NdefFormatable extends BasicTagTechnology {
// Should not happen
throw new IOException();
}
- } else {
- throw new IOException();
}
+
// optionally make read-only
if (makeReadOnly) {
errorCode = tagService.ndefMakeReadOnly(serviceHandle);