summaryrefslogtreecommitdiffstats
path: root/fmapp2
diff options
context:
space:
mode:
Diffstat (limited to 'fmapp2')
-rw-r--r--fmapp2/src/com/caf/fmradio/FMRadioService.java27
1 files changed, 16 insertions, 11 deletions
diff --git a/fmapp2/src/com/caf/fmradio/FMRadioService.java b/fmapp2/src/com/caf/fmradio/FMRadioService.java
index ef7ea4d..cf4c0d4 100644
--- a/fmapp2/src/com/caf/fmradio/FMRadioService.java
+++ b/fmapp2/src/com/caf/fmradio/FMRadioService.java
@@ -223,6 +223,8 @@ public class FMRadioService extends Service
private static final int FM_OFF_FROM_APPLICATION = 1;
private static final int FM_OFF_FROM_ANTENNA = 2;
+ private static Object mNotchFilterLock = new Object();
+
public FMRadioService() {
}
@@ -1484,14 +1486,13 @@ public class FMRadioService extends Service
}
} else {
if (mReceiver != null) {
- if( true == mNotchFilterSet )
- {
- mDelayedStopHandler.removeMessages(RESET_NOTCH_FILTER);
- }
- else
- {
- mReceiver.setNotchFilter(true);
- mNotchFilterSet = true;
+ synchronized (mNotchFilterLock) {
+ if (true == mNotchFilterSet) {
+ mDelayedStopHandler.removeMessages(RESET_NOTCH_FILTER);
+ } else {
+ mReceiver.setNotchFilter(true);
+ mNotchFilterSet = true;
+ }
}
}
}
@@ -1521,9 +1522,13 @@ public class FMRadioService extends Service
stopSelf(mServiceStartId);
break;
case RESET_NOTCH_FILTER:
- if (mReceiver != null) {
- mReceiver.setNotchFilter(false);
- mNotchFilterSet = false;
+ synchronized (mNotchFilterLock) {
+ if (false == mNotchFilterSet)
+ break;
+ if (mReceiver != null) {
+ mReceiver.setNotchFilter(false);
+ mNotchFilterSet = false;
+ }
}
break;
case STOPSERVICE_ONSLEEP: