diff options
author | Martijn Coenen <maco@google.com> | 2012-09-26 10:53:59 -0700 |
---|---|---|
committer | Martijn Coenen <maco@google.com> | 2012-09-26 10:53:59 -0700 |
commit | 18ccd96ac38d28864230f4f1d264fd1a4cc16d8a (patch) | |
tree | 5ea6f8ec494e787a74116d4e5c6690c604ade206 | |
parent | a112f9c00e3337ef38ea8e1715a99db4966c7219 (diff) | |
download | packages_apps_nfc-18ccd96ac38d28864230f4f1d264fd1a4cc16d8a.zip packages_apps_nfc-18ccd96ac38d28864230f4f1d264fd1a4cc16d8a.tar.gz packages_apps_nfc-18ccd96ac38d28864230f4f1d264fd1a4cc16d8a.tar.bz2 |
Enable/disable RF discovery only when needed.
Fixes coming out of suspend with EE routing enabled.
Bug: 7233312
Change-Id: Ibbb9d7c26c2152fbac543d84d3306fc0ed50272d
-rwxr-xr-x | nci/jni/NativeNfcManager.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/nci/jni/NativeNfcManager.cpp b/nci/jni/NativeNfcManager.cpp index 5fd3025..f4d5573 100755 --- a/nci/jni/NativeNfcManager.cpp +++ b/nci/jni/NativeNfcManager.cpp @@ -109,6 +109,7 @@ static SyncEvent sNfaSetConfigEvent; // event for Set_Config.... static bool sIsNfaEnabled = false; static bool sDiscoveryEnabled = false; //is polling for tag? static bool sIsDisabling = false; +static bool sRfEnabled = false; // whether RF discovery is enabled #define NFA_DM_PWR_STATE_UNKNOWN (-1) // power off sleep state is unkown until is is reported back from NFA... static int sConnlessSap = 0; static int sConnlessLinkMiu = 0; @@ -766,6 +767,11 @@ static void nfcManager_enableDiscovery (JNIEnv* e, jobject o) PowerSwitch::getInstance ().setLevel (PowerSwitch::FULL_POWER); + if (sRfEnabled) { + // Stop RF discovery to reconfigure + startRfDiscovery(false); + } + { SyncEventGuard guard (sNfaEnableDisablePollingEvent); stat = NFA_EnablePolling (tech_mask); @@ -1159,11 +1165,12 @@ static void nfcManager_doSelectSecureElement(JNIEnv *e, jobject o) { ALOGD ("%s: enter", __FUNCTION__); bool stat = true; - PowerSwitch::getInstance ().setLevel (PowerSwitch::FULL_POWER); - // Stop RF Discovery. - startRfDiscovery (false); + if (sRfEnabled) { + // Stop RF Discovery if we were polling + startRfDiscovery (false); + } if (sIsSecElemSelected) { @@ -1177,7 +1184,6 @@ static void nfcManager_doSelectSecureElement(JNIEnv *e, jobject o) sIsSecElemSelected = true; TheEnd: - // Restart RF Discovery. startRfDiscovery (true); ALOGD ("%s: exit", __FUNCTION__); @@ -1581,6 +1587,7 @@ void startRfDiscovery(bool isStart) if (status == NFA_STATUS_OK) { sNfaEnableDisablePollingEvent.wait (); //wait for NFA_RF_DISCOVERY_xxxx_EVT + sRfEnabled = isStart; } else { |