diff options
author | Service qcabuildsw <qcabuildsw@localhost> | 2016-11-23 16:58:30 -0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2016-11-23 16:58:30 -0800 |
commit | e647595a9554b82e365d8f56f60c52a958bed2b2 (patch) | |
tree | c1e31ba82aa555ad4423624d17a097ff9a68403e | |
parent | a11342d4376973c93307f77f3d659a64a7a8b361 (diff) | |
parent | 833970d02cddbdbe5a11f2020163eea4b34483ad (diff) | |
download | android_hardware_qcom_fm-e647595a9554b82e365d8f56f60c52a958bed2b2.tar.gz android_hardware_qcom_fm-e647595a9554b82e365d8f56f60c52a958bed2b2.tar.bz2 android_hardware_qcom_fm-e647595a9554b82e365d8f56f60c52a958bed2b2.zip |
Merge "Update FM UI after service bind complete" into fm.lnx.2.1-dev
-rw-r--r-- | fmapp2/src/com/caf/fmradio/FMRadio.java | 28 |
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; |