summaryrefslogtreecommitdiffstats
path: root/fmapp2
diff options
context:
space:
mode:
authorRupesh Tatiya <rtatiya@codeaurora.org>2016-01-12 18:37:31 +0530
committerArne Coucheron <arco68@gmail.com>2016-03-22 00:14:20 +0100
commit6706ef97c131bababd34a55244623ef8504c6070 (patch)
tree22a224f00d04dec0c383af693a67bbe684bec5f4 /fmapp2
parent10d0ec6f98f1149cd67d760f2198177ee8f8d873 (diff)
downloadandroid_hardware_qcom_fm-6706ef97c131bababd34a55244623ef8504c6070.tar.gz
android_hardware_qcom_fm-6706ef97c131bababd34a55244623ef8504c6070.tar.bz2
android_hardware_qcom_fm-6706ef97c131bababd34a55244623ef8504c6070.zip
Reset notch filter only if it is set.
Everytime there is data activity, notch filter settings need to be updated. This request gets queued and executed after a delay of 10 seconds. The update request might take 2 seconds in the worst case. Data activity might change very rapidly resulting in large number of RESET_NOTCH_FILTER messages being put queue before the first request itself is processed. In such scenario, multiple requests are processed together and they will take time to execute greater than ANR threashold time. CRs-Fixed: 958512 Change-Id: I78521f425d7419f3a3d577cc573560d3601b1b1e
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: