summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKamal Negi <kamaln@codeaurora.org>2016-11-16 13:09:12 +0530
committerKamal Negi <kamaln@codeaurora.org>2016-11-22 12:24:51 +0530
commit833970d02cddbdbe5a11f2020163eea4b34483ad (patch)
tree88149a13c6a419b0e378a20af4bfe2788e5e2854
parent7e4074908c5682bf7ccfeb8cf5fbab2e7d29034b (diff)
downloadandroid_hardware_qcom_fm-833970d02cddbdbe5a11f2020163eea4b34483ad.tar.gz
android_hardware_qcom_fm-833970d02cddbdbe5a11f2020163eea4b34483ad.tar.bz2
android_hardware_qcom_fm-833970d02cddbdbe5a11f2020163eea4b34483ad.zip
Update FM UI after service bind complete
On activity start, bind service callback can be delayed and is received after activity life cycle i.e after onResume(). Because of the delay, UI update won't happen. Hence update FM user interface, i.e. RDS, frequency etc., if service callback received or retry once after 100ms. CRs-Fixed: 1090643 Change-Id: Icef5922c3e3972f5e44cd1d3f873f864785e26be
-rw-r--r--fmapp2/src/com/caf/fmradio/FMRadio.java28
1 files changed, 19 insertions, 9 deletions
diff --git a/fmapp2/src/com/caf/fmradio/FMRadio.java b/fmapp2/src/com/caf/fmradio/FMRadio.java
index 7d357f7..1da839b 100644
--- a/fmapp2/src/com/caf/fmradio/FMRadio.java
+++ b/fmapp2/src/com/caf/fmradio/FMRadio.java
@@ -505,16 +505,25 @@ public class FMRadio extends Activity
super.onResume();
- if (!isAntennaAvailable()) {
+ if (mService == null) {
+ Log.d(LOGTAG,"bind callback has not received yet - wait for 100ms");
+ mHandler.postDelayed(UpdateFm, 100);
return;
}
- // TODO: We should return on exception or continue?
- try {
- if (mService != null)
- mService.registerCallbacks(mServiceCallbacks);
- } catch (RemoteException e) {
- e.printStackTrace();
- }
+ mHandler.post(UpdateFm);
+ }
+ Runnable UpdateFm = new Runnable() {
+ public void run() {
+ // TODO: We should return on exception or continue?
+ if (!isAntennaAvailable()) {
+ return;
+ }
+ try {
+ if (mService != null)
+ mService.registerCallbacks(mServiceCallbacks);
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
if (isSleepTimerActive()) {
Log.d(LOGTAG, "isSleepTimerActive is true");
@@ -559,7 +568,8 @@ public class FMRadio extends Activity
mUpdatePickerValue = true;
updateStationInfoToUI();
enableRadioOnOffUI();
- }
+ }
+ };
private static class LoadedDataAndState {
public LoadedDataAndState(){};
public boolean onOrOff;