FM: FMReceiver not set to NULL for some states
FMReceiver object not set to NULL if the FM is still
trying to turn on. This is being done in order to handle multiple
toggle of FM's.
Change-Id: I172117c091a6f42f91d4be5075ad2bc16d1cd672
diff --git a/fmapp2/src/com/caf/fmradio/FMRadioService.java b/fmapp2/src/com/caf/fmradio/FMRadioService.java
index f36b163..dd25b1d 100644
--- a/fmapp2/src/com/caf/fmradio/FMRadioService.java
+++ b/fmapp2/src/com/caf/fmradio/FMRadioService.java
@@ -2354,13 +2354,14 @@
}
else
{
- mReceiver = null; // as enable failed no need to disable
+ if ((mReceiver.getFMState() != mReceiver.subPwrLevel_FMRx_Starting) &&
+ (mReceiver.getFMState() != mReceiver.FMState_Rx_Turned_On)) {
+ mReceiver = null; // as enable failed no need to disable
// failure of enable can be because handle
// already open which gets effected if
// we disable
- AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
- audioManager.abandonAudioFocus(mAudioFocusListener);
- stop();
+ stop();
+ }
}
return bStatus;
@@ -3384,11 +3385,13 @@
public void FmRxEvEnableReceiver()
{
Log.d(LOGTAG, "FmRxEvEnableReceiver");
- mReceiver.setRawRdsGrpMask();
- if (mReceiver != null && mReceiver.isCherokeeChip()) {
- synchronized(mEventWaitLock) {
- mEventReceived = true;
- mEventWaitLock.notify();
+ if (mReceiver != null) {
+ mReceiver.setRawRdsGrpMask();
+ if (mReceiver.isCherokeeChip()) {
+ synchronized(mEventWaitLock) {
+ mEventReceived = true;
+ mEventWaitLock.notify();
+ }
}
}
}