Need to update UI in onResume though fmservice not bound
CRs-Fixed: 972557
Change-Id: I7a87f897c29b033c46e9dc3b4d9d99a0eb46e7e4
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 @@
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 @@
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 @@
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 @@
// 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();
}