summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartijn Coenen <maco@google.com>2011-07-21 17:30:28 +0200
committerMartijn Coenen <maco@google.com>2011-07-21 17:30:28 +0200
commite063132e40dc788f0b471ed3832f5fbaebd7e463 (patch)
tree90317d016bdb4a303b8c808c74321c1b07dfabeb
parentd9567994fefe21743131adc7390acdb97f81ed67 (diff)
downloadpackages_apps_nfc-e063132e40dc788f0b471ed3832f5fbaebd7e463.zip
packages_apps_nfc-e063132e40dc788f0b471ed3832f5fbaebd7e463.tar.gz
packages_apps_nfc-e063132e40dc788f0b471ed3832f5fbaebd7e463.tar.bz2
Fix synchronisation for 0-click setting.
Change-Id: I25fa9ff4430267dd5822f226d1ac8f19fb9a4c05
-rwxr-xr-xsrc/com/android/nfc/NfcService.java23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/com/android/nfc/NfcService.java b/src/com/android/nfc/NfcService.java
index b6d60b0..efe5f8b 100755
--- a/src/com/android/nfc/NfcService.java
+++ b/src/com/android/nfc/NfcService.java
@@ -1777,13 +1777,14 @@ public class NfcService extends Application implements DeviceHostListener {
/* Start polling loop */
applyRouting();
-
- boolean zeroclick_on = mPrefs.getBoolean(PREF_ZEROCLICK_ON,
- ZEROCLICK_ON_DEFAULT);
- if (zeroclick_on) {
- /* bring up p2p ndef servers */
- mP2pManager.enableNdefServer();
- mZeroClickOn = true;
+ synchronized(NfcService.this) {
+ boolean zeroclick_on = mPrefs.getBoolean(PREF_ZEROCLICK_ON,
+ ZEROCLICK_ON_DEFAULT);
+ if (zeroclick_on) {
+ /* bring up p2p ndef servers */
+ mP2pManager.enableNdefServer();
+ mZeroClickOn = true;
+ }
}
} else {
Log.w(TAG, "Error enabling NFC");
@@ -1805,9 +1806,11 @@ public class NfcService extends Application implements DeviceHostListener {
boolean isSuccess;
/* tear down the p2p server */
- if (mZeroClickOn) {
- mP2pManager.disableNdefServer();
- mZeroClickOn = false;
+ synchronized(NfcService.this) {
+ if (mZeroClickOn) {
+ mP2pManager.disableNdefServer();
+ mZeroClickOn = false;
+ }
}
// Stop watchdog if tag present
// A convenient way to stop the watchdog properly consists of