summaryrefslogtreecommitdiffstats
path: root/fmapp2/src
diff options
context:
space:
mode:
authorDanesh M <daneshm90@gmail.com>2015-08-14 11:20:31 -0700
committerMatt Wagantall <mwagantall@cyngn.com>2016-02-19 14:07:46 -0800
commit3a71df12f694b07c80849087684a4a6a9ae3d5d0 (patch)
tree860a0e622783f103fcca2054b746aeb5bd283dfe /fmapp2/src
parent0f42b8edc961ff373d918be6681b647210d2d807 (diff)
downloadandroid_hardware_qcom_fm-3a71df12f694b07c80849087684a4a6a9ae3d5d0.tar.gz
android_hardware_qcom_fm-3a71df12f694b07c80849087684a4a6a9ae3d5d0.tar.bz2
android_hardware_qcom_fm-3a71df12f694b07c80849087684a4a6a9ae3d5d0.zip
FMRadio : Ensure scan state is kept in sync
In the middle of a scan, the user could navigate away from the activity, during which the scan could've finished. The activity is no longer synchronized with the service and causes issues where the dialog for scan keeps showing...etc Fix this by syncing state in onResume issue-id: CRACKLING-529 Change-Id: Ief3138e4d6e157ad0b060dc3aced18668959f4e1
Diffstat (limited to 'fmapp2/src')
-rw-r--r--fmapp2/src/com/caf/fmradio/FMRadio.java14
-rw-r--r--fmapp2/src/com/caf/fmradio/FMRadioService.java9
-rw-r--r--fmapp2/src/com/caf/fmradio/IFMRadioService.aidl1
3 files changed, 24 insertions, 0 deletions
diff --git a/fmapp2/src/com/caf/fmradio/FMRadio.java b/fmapp2/src/com/caf/fmradio/FMRadio.java
index 6f3f291..d26a0cd 100644
--- a/fmapp2/src/com/caf/fmradio/FMRadio.java
+++ b/fmapp2/src/com/caf/fmradio/FMRadio.java
@@ -516,9 +516,23 @@ public class FMRadio extends Activity
}
}
+ private void syncScanState() {
+ if (!mIsScaning || mService == null) {
+ return;
+ }
+ try {
+ if (!mService.isSearchInProgress()) {
+ resetSearch();
+ }
+ }catch (RemoteException e) {
+ e.printStackTrace();
+ }
+ }
+
@Override
public void onResume() {
super.onResume();
+ syncScanState();
try {
if(mService != null) {
mService.registerCallbacks(mServiceCallbacks);
diff --git a/fmapp2/src/com/caf/fmradio/FMRadioService.java b/fmapp2/src/com/caf/fmradio/FMRadioService.java
index c7f2b01..d8c0fea 100644
--- a/fmapp2/src/com/caf/fmradio/FMRadioService.java
+++ b/fmapp2/src/com/caf/fmradio/FMRadioService.java
@@ -1977,6 +1977,10 @@ public class FMRadioService extends Service
{
return(mService.get().isA2DPConnected());
}
+ public boolean isSearchInProgress()
+ {
+ return(mService.get().isSearchInProgress());
+ }
}
private final IBinder mBinder = new ServiceStub(this);
@@ -2209,6 +2213,11 @@ public class FMRadioService extends Service
return(bStatus);
}
+ public boolean isSearchInProgress() {
+ int state = mReceiver.getFMState();
+ return state == qcom.fmradio.FmTransceiver.FMState_Srch_InProg;
+ }
+
public boolean isSSRInProgress() {
return mIsSSRInProgress;
}
diff --git a/fmapp2/src/com/caf/fmradio/IFMRadioService.aidl b/fmapp2/src/com/caf/fmradio/IFMRadioService.aidl
index a02c593..0b26459 100644
--- a/fmapp2/src/com/caf/fmradio/IFMRadioService.aidl
+++ b/fmapp2/src/com/caf/fmradio/IFMRadioService.aidl
@@ -75,5 +75,6 @@ interface IFMRadioService
boolean isSSRInProgress();
boolean isRtPlusSupported();
boolean isA2DPConnected();
+ boolean isSearchInProgress();
}