diff options
author | Danesh M <daneshm90@gmail.com> | 2015-08-14 11:20:31 -0700 |
---|---|---|
committer | Michael Bestas <mikeioannina@gmail.com> | 2017-01-04 20:05:24 +0200 |
commit | eec4bcfcff8596c9a3c5bcc68ebbe3f09916ec9c (patch) | |
tree | ee1b7684181e58324fa0bf1923c59c1a17e78d9c | |
parent | 13e98e58c8ec13b61b0b9c94202406ce7835670f (diff) | |
download | android_hardware_qcom_fm-eec4bcfcff8596c9a3c5bcc68ebbe3f09916ec9c.tar.gz android_hardware_qcom_fm-eec4bcfcff8596c9a3c5bcc68ebbe3f09916ec9c.tar.bz2 android_hardware_qcom_fm-eec4bcfcff8596c9a3c5bcc68ebbe3f09916ec9c.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
-rw-r--r-- | fmapp2/src/com/caf/fmradio/FMRadio.java | 14 | ||||
-rw-r--r-- | fmapp2/src/com/caf/fmradio/FMRadioService.java | 10 | ||||
-rw-r--r-- | fmapp2/src/com/caf/fmradio/IFMRadioService.aidl | 1 |
3 files changed, 25 insertions, 0 deletions
diff --git a/fmapp2/src/com/caf/fmradio/FMRadio.java b/fmapp2/src/com/caf/fmradio/FMRadio.java index 4e2e452..4fd71b7 100644 --- a/fmapp2/src/com/caf/fmradio/FMRadio.java +++ b/fmapp2/src/com/caf/fmradio/FMRadio.java @@ -524,11 +524,25 @@ 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() { Log.d(LOGTAG, "FMRadio: onResume"); super.onResume(); + syncScanState(); if (mService == null) { Log.d(LOGTAG,"bind callback has not received yet - wait for 100ms"); diff --git a/fmapp2/src/com/caf/fmradio/FMRadioService.java b/fmapp2/src/com/caf/fmradio/FMRadioService.java index 47618e1..7c1f849 100644 --- a/fmapp2/src/com/caf/fmradio/FMRadioService.java +++ b/fmapp2/src/com/caf/fmradio/FMRadioService.java @@ -2098,6 +2098,11 @@ public class FMRadioService extends Service return(mService.get().isA2DPConnected()); } + public boolean isSearchInProgress() + { + return(mService.get().isSearchInProgress()); + } + public int getExtenCountryCode() { return(mService.get().getExtenCountryCode()); @@ -2384,6 +2389,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 07d210e..3359542 100644 --- a/fmapp2/src/com/caf/fmradio/IFMRadioService.aidl +++ b/fmapp2/src/com/caf/fmradio/IFMRadioService.aidl @@ -76,6 +76,7 @@ interface IFMRadioService boolean isSSRInProgress(); boolean isRtPlusSupported(); boolean isA2DPConnected(); + boolean isSearchInProgress(); boolean getIntfDetLowTh(); boolean getIntfDetHighTh(); boolean getRxRepeatCount(); |