summaryrefslogtreecommitdiffstats
path: root/src/nfc/qnearfieldtarget_android.cpp
diff options
context:
space:
mode:
authorTarja Sundqvist <tarja.sundqvist@qt.io>2022-09-12 18:29:43 +0300
committerTarja Sundqvist <tarja.sundqvist@qt.io>2022-09-12 18:29:43 +0300
commit47c424c7990061714bd3108e3fbaa4339ba411b9 (patch)
tree8b938040ac1d4a596844f8a2717fdfb8435468da /src/nfc/qnearfieldtarget_android.cpp
parent41cd6185fff015f492820ec8d6be99690e562791 (diff)
parent6444868ff5f95e868471d16f61ca3d0696bbd8a5 (diff)
Merge remote-tracking branch 'origin/tqtc/lts-5.15.7' into tqtc/lts-5.15-opensourcev5.15.7-lts-lgpl
Diffstat (limited to 'src/nfc/qnearfieldtarget_android.cpp')
-rw-r--r--src/nfc/qnearfieldtarget_android.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/nfc/qnearfieldtarget_android.cpp b/src/nfc/qnearfieldtarget_android.cpp
index c6b120e7..de59808c 100644
--- a/src/nfc/qnearfieldtarget_android.cpp
+++ b/src/nfc/qnearfieldtarget_android.cpp
@@ -253,6 +253,12 @@ QNearFieldTarget::RequestId NearFieldTarget::sendCommand(const QByteArray &comma
// Writing
QAndroidJniObject myNewVal = m_tagTech.callObjectMethod("transceive", "([B)[B", jba);
if (catchJavaExceptions()) {
+ // Some devices (Samsung, Huawei) throw an exception when the card is lost:
+ // "android.nfc.TagLostException: Tag was lost". But there seems to be a bug that
+ // isConnected still reports true. So we need to invalidate the target as soon as
+ // possible and treat the card as lost.
+ handleTargetLost();
+
reportError(QNearFieldTarget::CommandError, requestId);
return requestId;
}