summaryrefslogtreecommitdiffstats
path: root/jni/com_android_nfc_NativeNfcSecureElement.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'jni/com_android_nfc_NativeNfcSecureElement.cpp')
-rwxr-xr-xjni/com_android_nfc_NativeNfcSecureElement.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/jni/com_android_nfc_NativeNfcSecureElement.cpp b/jni/com_android_nfc_NativeNfcSecureElement.cpp
index dc4d3ba..97417ea 100755
--- a/jni/com_android_nfc_NativeNfcSecureElement.cpp
+++ b/jni/com_android_nfc_NativeNfcSecureElement.cpp
@@ -24,6 +24,7 @@ static phNfc_sRemoteDevInformation_t* SecureElementInfo;
static int secureElementHandle;
extern void *gHWRef;
static int SecureElementTech;
+extern uint8_t device_connected_flag;
namespace android {
@@ -202,6 +203,13 @@ static jint com_android_nfc_NativeNfcSecureElement_doOpenSecureElementConnection
TRACE("Open Secure Element");
+ /* Check if NFC device is already connected to a tag or P2P peer */
+ if (device_connected_flag == 1)
+ {
+ LOGD("Unable to open SE connection, device already connected to a P2P peer or a Tag");
+ goto clean_and_return;
+ }
+
/* Test if External RF field is detected */
InParam.buffer = ExternalRFDetected;
InParam.length = 3;
@@ -213,6 +221,7 @@ static jint com_android_nfc_NativeNfcSecureElement_doOpenSecureElementConnection
if(ret!=NFCSTATUS_PENDING)
{
LOGE("IOCTL status error");
+ goto clean_and_return;
}
/* Wait for callback response */