summaryrefslogtreecommitdiffstats
path: root/jni/com_android_nfc_NativeP2pDevice.cpp
diff options
context:
space:
mode:
authorArnaud Ferir <arnaud.ferir@trusted-logic.com>2011-01-19 19:10:00 +0100
committerJeff Hamilton <jham@android.com>2011-01-24 12:07:59 -0600
commit7f5487be0414b1f92b41cc5f7b0b7db846d9b1c9 (patch)
tree8fae2471697700b04a4f466e375c840d407794d2 /jni/com_android_nfc_NativeP2pDevice.cpp
parent2436ffe91853535fad87b7a8e03d8883bae20f20 (diff)
downloadpackages_apps_nfc-7f5487be0414b1f92b41cc5f7b0b7db846d9b1c9.zip
packages_apps_nfc-7f5487be0414b1f92b41cc5f7b0b7db846d9b1c9.tar.gz
packages_apps_nfc-7f5487be0414b1f92b41cc5f7b0b7db846d9b1c9.tar.bz2
Do not disconnect P2P target if connect failed.
If the P2P target connect failed, the P2P target disconnect cannot be done. However the polling loop must be restarted. This is already done in JNI layer by the failing connect itself. Change-Id: I1c3323e4c038c8133e7b6e16b3a238c050427cfc
Diffstat (limited to 'jni/com_android_nfc_NativeP2pDevice.cpp')
-rw-r--r--jni/com_android_nfc_NativeP2pDevice.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/jni/com_android_nfc_NativeP2pDevice.cpp b/jni/com_android_nfc_NativeP2pDevice.cpp
index fc2692b..fd9af3e 100644
--- a/jni/com_android_nfc_NativeP2pDevice.cpp
+++ b/jni/com_android_nfc_NativeP2pDevice.cpp
@@ -145,7 +145,6 @@ static jboolean com_android_nfc_NativeP2pDevice_doConnect(JNIEnv *e, jobject o)
if(status != NFCSTATUS_PENDING)
{
LOGE("phLibNfc_RemoteDev_Connect(P2P) returned 0x%04x[%s]", status, nfc_jni_get_status_name(status));
- nfc_jni_restart_discovery_locked(nfc_jni_get_nat_ext(e));
goto clean_and_return;
}
TRACE("phLibNfc_RemoteDev_Connect(P2P) returned 0x%04x[%s]", status, nfc_jni_get_status_name(status));
@@ -185,6 +184,11 @@ static jboolean com_android_nfc_NativeP2pDevice_doConnect(JNIEnv *e, jobject o)
result = JNI_TRUE;
clean_and_return:
+ if (result != JNI_TRUE)
+ {
+ /* Restart the polling loop if the connection failed */
+ nfc_jni_restart_discovery_locked(nfc_jni_get_nat_ext(e));
+ }
nfc_cb_data_deinit(&cb_data);
CONCURRENCY_UNLOCK();
return result;