From 4df923ab5f5eb8f94168454850e6ad187f7f8632 Mon Sep 17 00:00:00 2001 From: Mingbo Zhang Date: Thu, 4 Feb 2016 17:34:26 +0800 Subject: Need to update UI in onResume though fmservice not bound CRs-Fixed: 972557 Change-Id: I7a87f897c29b033c46e9dc3b4d9d99a0eb46e7e4 --- fmapp2/src/com/caf/fmradio/FMRadio.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/fmapp2/src/com/caf/fmradio/FMRadio.java b/fmapp2/src/com/caf/fmradio/FMRadio.java index 5a0808a..ff124f7 100644 --- a/fmapp2/src/com/caf/fmradio/FMRadio.java +++ b/fmapp2/src/com/caf/fmradio/FMRadio.java @@ -531,16 +531,13 @@ public class FMRadio extends Activity Log.d(LOGTAG, "FMRadio: onResume"); super.onResume(); - if (null == mService) { - Log.e(LOGTAG, "FM Service is not running, returning"); - return; - } syncScanState(); // TODO: We should return on exception or continue? try { - mService.registerCallbacks(mServiceCallbacks); + if (mService != null) + mService.registerCallbacks(mServiceCallbacks); } catch (RemoteException e) { e.printStackTrace(); } @@ -548,7 +545,8 @@ public class FMRadio extends Activity if (isSleepTimerActive()) { Log.d(LOGTAG, "isSleepTimerActive is true"); try { - mService.cancelDelayedStop(FMRadioService.STOP_SERVICE); + if (mService != null) + mService.cancelDelayedStop(FMRadioService.STOP_SERVICE); if(null != mSleepUpdateHandlerThread) { mSleepUpdateHandlerThread.interrupt(); } @@ -561,7 +559,8 @@ public class FMRadio extends Activity if (isRecording()) { Log.d(LOGTAG,"isRecordTimerActive is true"); try { - mService.cancelDelayedStop(FMRadioService.STOP_RECORD); + if (mService != null) + mService.cancelDelayedStop(FMRadioService.STOP_RECORD); } catch (Exception e) { e.printStackTrace(); } @@ -573,7 +572,8 @@ public class FMRadio extends Activity // we might lose audio focus between pause and restart, // hence request it again try { - mService.requestFocus(); + if (mService != null) + mService.requestFocus(); } catch (Exception e) { e.printStackTrace(); } -- cgit v1.2.3