summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartijn Coenen <maco@google.com>2012-09-26 12:51:39 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-09-26 12:51:39 -0700
commit70c3445ec1cea8278b61a556cf467591cd128348 (patch)
treed5fb4920379ce2378e5fdab9177c8016746a73c8
parent2e4fc72b81880372344e36cd94e12da6122f7401 (diff)
parent18ccd96ac38d28864230f4f1d264fd1a4cc16d8a (diff)
downloadpackages_apps_nfc-70c3445ec1cea8278b61a556cf467591cd128348.zip
packages_apps_nfc-70c3445ec1cea8278b61a556cf467591cd128348.tar.gz
packages_apps_nfc-70c3445ec1cea8278b61a556cf467591cd128348.tar.bz2
am 18ccd96a: Enable/disable RF discovery only when needed.
* commit '18ccd96ac38d28864230f4f1d264fd1a4cc16d8a': Enable/disable RF discovery only when needed.
-rwxr-xr-xnci/jni/NativeNfcManager.cpp15
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
{