From 914d6caa70f544fb3dd0710de59dff090c695caa Mon Sep 17 00:00:00 2001 From: Martijn Coenen Date: Wed, 26 Sep 2012 13:09:20 -0700 Subject: Disable all RF activity when DH connects to SE. If we leave RF polling/listen enabled while talking to the SE from the DH, there is corruption on frames sent out over SWP. To resolve this, disable discovery (both poll and listen) when the SE is route to the DH. This also makes the behavior identical to that of the PN65N devices, which don't allow any RF activity when the SE is routed to the host. Bug: 7004303 Change-Id: I05ad55a6f75b9f346feaf20dccefc23919ff538f --- nci/jni/NativeNfcManager.cpp | 2 +- nci/jni/SecureElement.cpp | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'nci') diff --git a/nci/jni/NativeNfcManager.cpp b/nci/jni/NativeNfcManager.cpp index f4d5573..99ffc77 100755 --- a/nci/jni/NativeNfcManager.cpp +++ b/nci/jni/NativeNfcManager.cpp @@ -87,6 +87,7 @@ namespace android const char* gNativeNfcSecureElementClassName = "com/android/nfc/dhimpl/NativeNfcSecureElement"; void doStartupConfig (); void startStopPolling (bool isStartPolling); + void startRfDiscovery (bool isStart); } @@ -132,7 +133,6 @@ static UINT32 sConfigUpdated = 0; static void nfaConnectionCallback (UINT8 event, tNFA_CONN_EVT_DATA *eventData); static void nfaDeviceManagementCallback (UINT8 event, tNFA_DM_CBACK_DATA *eventData); static bool isPeerToPeer (tNFA_ACTIVATED& activated); -static void startRfDiscovery (bool isStart); ///////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// diff --git a/nci/jni/SecureElement.cpp b/nci/jni/SecureElement.cpp index 2f94047..5f370cc 100755 --- a/nci/jni/SecureElement.cpp +++ b/nci/jni/SecureElement.cpp @@ -37,6 +37,10 @@ int gSEId = -1; // secure element ID to use in connectEE(), -1 means not set int gGatePipe = -1; // gate id or static pipe id to use in connectEE(), -1 means not set bool gUseStaticPipe = false; // if true, use gGatePipe as static pipe id. if false, use as gate id +namespace android +{ + extern void startRfDiscovery (bool isStart); +} ////////////////////////////////////////////// ////////////////////////////////////////////// @@ -630,6 +634,9 @@ bool SecureElement::connectEE () return (false); } + // Disable RF discovery completely while the DH is connected + android::startRfDiscovery(false); + mNewSourceGate = 0; if (gGatePipe == -1) @@ -809,6 +816,11 @@ bool SecureElement::disconnectEE (jint seID) ALOGE ("%s: fail dealloc gate; error=0x%X", fn, nfaStat); } mIsPiping = false; + // Re-enable RF discovery + // Note that it only effactuates the current configuration, + // so if polling/listening were configured OFF (forex because + // the screen was off), they will stay OFF with this call. + android::startRfDiscovery(true); return true; } -- cgit v1.1