From 9a54fef99874c6cccf317ebcb4e811438252e745 Mon Sep 17 00:00:00 2001 From: Mingbo Zhang <mingboz@codeaurora.org> Date: Thu, 4 Feb 2016 17:34:26 +0800 Subject: [PATCH] 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 76b961c..e7f1c51 100644 --- a/fmapp2/src/com/caf/fmradio/FMRadio.java +++ b/fmapp2/src/com/caf/fmradio/FMRadio.java @@ -496,14 +496,11 @@ 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; - } // TODO: We should return on exception or continue? try { - mService.registerCallbacks(mServiceCallbacks); + if (mService != null) + mService.registerCallbacks(mServiceCallbacks); } catch (RemoteException e) { e.printStackTrace(); } @@ -511,7 +508,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(); } @@ -524,7 +522,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(); } @@ -536,7 +535,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(); } -- GitLab