summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Chang <georgekgchang@google.com>2020-06-19 07:10:04 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-06-19 07:10:04 +0000
commit884d187226d513eca21468856b3e198ea1ae85d7 (patch)
tree83d2f76c4f823607df7e66d86ab39551e8335af6
parentc0a05298fd9c9587e16d083e1129c3e7ba26f464 (diff)
parent73469c9d622771baf78c6d977d02a0e8be5f75f8 (diff)
downloadNfc-884d187226d513eca21468856b3e198ea1ae85d7.tar.gz
Merge "Remove the NFC_DEP count from NumDiscNtf" into rvc-dev am: 73469c9d62
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Nfc/+/11822728 Change-Id: I8623ec684fc5cccb8c7cc6cc815977125e8f7c50
-rw-r--r--nci/jni/NativeNfcManager.cpp11
-rwxr-xr-xnci/jni/NfcTag.cpp4
2 files changed, 11 insertions, 4 deletions
diff --git a/nci/jni/NativeNfcManager.cpp b/nci/jni/NativeNfcManager.cpp
index c99e982f..5048262c 100644
--- a/nci/jni/NativeNfcManager.cpp
+++ b/nci/jni/NativeNfcManager.cpp
@@ -234,12 +234,19 @@ static void handleRfDiscoveryEvent(tNFC_RESULT_DEVT* discoveredDevice) {
// there is more discovery notification coming
return;
}
+
+ bool isP2p = natTag.isP2pDiscovered();
+
if (natTag.getNumDiscNtf() > 1) {
natTag.setMultiProtocolTagSupport(true);
+ if (isP2p) {
+ // Remove NFC_DEP NTF count
+ // Skip NFC_DEP protocol in MultiProtocolTag select.
+ natTag.setNumDiscNtf(natTag.getNumDiscNtf() - 1);
+ }
}
- bool isP2p = natTag.isP2pDiscovered();
- if (!sReaderModeEnabled && isP2p) {
+ if (sP2pEnabled && !sReaderModeEnabled && isP2p) {
// select the peer that supports P2P
natTag.selectP2p();
} else {
diff --git a/nci/jni/NfcTag.cpp b/nci/jni/NfcTag.cpp
index 6f5f9b82..b9d8d555 100755
--- a/nci/jni/NfcTag.cpp
+++ b/nci/jni/NfcTag.cpp
@@ -1013,8 +1013,8 @@ bool NfcTag::isP2pDiscovered() {
static const char fn[] = "NfcTag::isP2pDiscovered";
bool retval = false;
- for (int i = 0; i < mNumTechList; i++) {
- if (mTechLibNfcTypes[i] == NFA_PROTOCOL_NFC_DEP) {
+ for (int i = 0; i < mNumDiscTechList; i++) {
+ if (mTechLibNfcTypesDiscData[i] == NFA_PROTOCOL_NFC_DEP) {
// if remote device supports P2P
DLOG_IF(INFO, nfc_debug_enabled)
<< StringPrintf("%s: discovered P2P", fn);