summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartijn Coenen <maco@google.com>2016-08-30 05:56:24 -0700
committerMartijn Coenen <maco@google.com>2016-08-31 02:48:01 +0000
commit6e95c4d9dacc38108b0818a5b622d7cdf4f4b1b5 (patch)
tree998874154b59618dde6f8e8affa8e1402a4087ad
parentb0cc05288d393e83a0ca878e1d79d3d4f55a65e2 (diff)
downloadandroid_packages_apps_Nfc-6e95c4d9dacc38108b0818a5b622d7cdf4f4b1b5.tar.gz
android_packages_apps_Nfc-6e95c4d9dacc38108b0818a5b622d7cdf4f4b1b5.tar.bz2
android_packages_apps_Nfc-6e95c4d9dacc38108b0818a5b622d7cdf4f4b1b5.zip
Don't dispatch tags when NDEF read times out.
If we get a timeout status from the stack, store that state so we don't dispatch tags with empty NDEF messages with a read timeout. This was already done when we timed out while reading NDEF meta-data, but not the message itself. Also, don't play sounds during detection at all; NDEF messages are usually so small that the "start detect" sound is immediately followed by either a "success" sound or a "failure" sound; we now only play a sound if the tag was successfully read and will be dispatched. Bug: 31165960 Change-Id: I4738731ad3b265df08a22666e52d801578dd329f
-rwxr-xr-xnci/jni/NfcTag.cpp3
-rwxr-xr-xnci/src/com/android/nfc/dhimpl/NativeNfcTag.java5
-rwxr-xr-xsrc/com/android/nfc/NfcService.java9
3 files changed, 3 insertions, 14 deletions
diff --git a/nci/jni/NfcTag.cpp b/nci/jni/NfcTag.cpp
index ddf354a3..c6e074bd 100755
--- a/nci/jni/NfcTag.cpp
+++ b/nci/jni/NfcTag.cpp
@@ -1422,6 +1422,9 @@ void NfcTag::connectionEventHandler (UINT8 event, tNFA_CONN_EVT_DATA* data)
{
SyncEventGuard g (mReadCompleteEvent);
mReadCompletedStatus = data->status;
+ mNdefDetectionTimedOut = data->status != NFA_STATUS_OK;
+ if (mNdefDetectionTimedOut)
+ ALOGE ("%s: NDEF detection timed out", fn);
mReadCompleteEvent.notifyOne ();
}
break;
diff --git a/nci/src/com/android/nfc/dhimpl/NativeNfcTag.java b/nci/src/com/android/nfc/dhimpl/NativeNfcTag.java
index c121a622..6e5ffca7 100755
--- a/nci/src/com/android/nfc/dhimpl/NativeNfcTag.java
+++ b/nci/src/com/android/nfc/dhimpl/NativeNfcTag.java
@@ -812,11 +812,6 @@ public class NativeNfcTag implements TagEndpoint {
if (generateEmptyNdef) {
ndefMsg = null;
- addNdefTechnology(null,
- getConnectedHandle(),
- getConnectedLibNfcType(),
- getConnectedTechnology(),
- supportedNdefLength, cardState);
foundFormattable = false;
reconnect();
}
diff --git a/src/com/android/nfc/NfcService.java b/src/com/android/nfc/NfcService.java
index d91e3b55..6b671e8f 100755
--- a/src/com/android/nfc/NfcService.java
+++ b/src/com/android/nfc/NfcService.java
@@ -1848,12 +1848,6 @@ public class NfcService implements DeviceHostListener {
}
}
- boolean playSound = (readerParams == null ||
- (readerParams.flags & NfcAdapter.FLAG_READER_NO_PLATFORM_SOUNDS) == 0) &&
- debounceTagUid == null;
- if (mScreenState == ScreenStateHelper.SCREEN_STATE_ON_UNLOCKED && playSound) {
- playSound(SOUND_START);
- }
if (tag.getConnectedTechnology() == TagTechnology.NFC_BARCODE) {
// When these tags start containing NDEF, they will require
// the stack to deal with them in a different way, since
@@ -1870,9 +1864,6 @@ public class NfcService implements DeviceHostListener {
// First try to see if this was a bad tag read
if (!tag.reconnect()) {
tag.disconnect();
- if (playSound) {
- playSound(SOUND_ERROR);
- }
break;
}
}