summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartijn Coenen <maco@google.com>2012-03-29 16:09:24 -0700
committerMartijn Coenen <maco@google.com>2012-03-29 16:09:24 -0700
commitcd7f018ec0cff0fcdcfe1399aa2398b809f2e35e (patch)
tree97692459749c6ae9e5cd04bf6fe7c3b497768caa /src
parent182152b054d555fc4ac5d5c2cd2367cb8c205782 (diff)
downloadpackages_apps_nfc-cd7f018ec0cff0fcdcfe1399aa2398b809f2e35e.zip
packages_apps_nfc-cd7f018ec0cff0fcdcfe1399aa2398b809f2e35e.tar.gz
packages_apps_nfc-cd7f018ec0cff0fcdcfe1399aa2398b809f2e35e.tar.bz2
Let connect() fail with an I/O exception if tag has left the field.
Because connect() can sometimes be implemented without any I/O, (usually between transitions to/from the NDEF technology), it does not always notice when a tag has left the field. Since we promise in the API docs that it does, fix it by checking (cached) presence. Change-Id: Ie6ad1b5dec3621051e395d3be0d0e09615e53ebc
Diffstat (limited to 'src')
-rwxr-xr-xsrc/com/android/nfc/NfcService.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/com/android/nfc/NfcService.java b/src/com/android/nfc/NfcService.java
index dca96b9..560c5aa 100755
--- a/src/com/android/nfc/NfcService.java
+++ b/src/com/android/nfc/NfcService.java
@@ -853,6 +853,10 @@ public class NfcService extends Application implements DeviceHostListener {
return ErrorCodes.ERROR_DISCONNECT;
}
+ if (!tag.isPresent()) {
+ return ErrorCodes.ERROR_DISCONNECT;
+ }
+
if (technology == TagTechnology.NFC_B) {
return ErrorCodes.ERROR_NOT_SUPPORTED;
}