Tag detection does not stop after screen off
There is a timing issue if a tag was detected just before
HOST sent screen off command. RF_INTF_ACTIVATED_NTF may still
be sent by NFCC (because it happened first). Then HOST will
activate the tag and keep the connection of tag.
The fix drop RF_INTF_ACTIVATED_NTF if screen turns off.
Update prevScreenState for NCi 1.0 devices when screen state change.
Bug: 120588308
Test: NFC ON/OFF, Tag read with NCI 1.0/2.0 devices
Change-Id: I5733e1e55967b92b443ac487d3207569c9113e39
diff --git a/nci/jni/NativeNfcManager.cpp b/nci/jni/NativeNfcManager.cpp
index 9eebba8..948e832 100755
--- a/nci/jni/NativeNfcManager.cpp
+++ b/nci/jni/NativeNfcManager.cpp
@@ -353,6 +353,11 @@
}
nativeNfcTag_resetPresenceCheck();
+ if (!isListenMode(eventData->activated) &&
+ (prevScreenState == NFA_SCREEN_STATE_OFF_LOCKED ||
+ prevScreenState == NFA_SCREEN_STATE_OFF_UNLOCKED)) {
+ NFA_Deactivate(FALSE);
+ }
if (isPeerToPeer(eventData->activated)) {
if (sReaderModeEnabled) {
DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
@@ -1713,8 +1718,10 @@
}
if (sIsDisabling || !sIsNfaEnabled ||
- (NFC_GetNCIVersion() != NCI_VERSION_2_0))
+ (NFC_GetNCIVersion() != NCI_VERSION_2_0)) {
+ prevScreenState = state;
return;
+ }
if (prevScreenState == NFA_SCREEN_STATE_OFF_LOCKED ||
prevScreenState == NFA_SCREEN_STATE_OFF_UNLOCKED ||
prevScreenState == NFA_SCREEN_STATE_ON_LOCKED) {