diff --git a/fmapp2/src/com/caf/fmradio/FMRadioService.java b/fmapp2/src/com/caf/fmradio/FMRadioService.java index 2b9fb83acea33de0036b35ec8b03f5f20687861e..43e91a61f684b56d6b749a7ec2a90c9b712fbf8a 100644 --- a/fmapp2/src/com/caf/fmradio/FMRadioService.java +++ b/fmapp2/src/com/caf/fmradio/FMRadioService.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2015, The Linux Foundation. All rights reserved. + * Copyright (c) 2009-2016, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -1604,8 +1604,6 @@ public class FMRadioService extends Service case AudioManager.AUDIOFOCUS_LOSS: Log.v(LOGTAG, "AudioFocus: received AUDIOFOCUS_LOSS"); //intentional fall through. - if (true == isFmRecordingOn()) - stopRecording(); if (mSpeakerPhoneOn) { mSpeakerDisableHandler.removeCallbacks(mSpeakerDisableTask); mSpeakerDisableHandler.postDelayed(mSpeakerDisableTask, 0); @@ -1613,6 +1611,9 @@ public class FMRadioService extends Service if (true == mPlaybackInProgress) { stopFM(); } + if (true == isFmRecordingOn()) + stopRecording(); + if (mSpeakerPhoneOn) { if (isAnalogModeSupported()) setAudioPath(false); @@ -2247,6 +2248,17 @@ public class FMRadioService extends Service * Turn OFF FM Operations: This disables all the current FM operations . */ private void fmOperationsOff() { + // disable audio path + AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); + if(audioManager != null) + { + Log.d(LOGTAG, "audioManager.setFmRadioOn = false \n" ); + stopFM(); + unMute(); + audioManager.abandonAudioFocus(mAudioFocusListener); + //audioManager.setParameters("FMRadioOn=false"); + Log.d(LOGTAG, "audioManager.setFmRadioOn false done \n" ); + } // stop recording if (isFmRecordingOn()) { @@ -2258,17 +2270,6 @@ public class FMRadioService extends Service return; } } - // disable audio path - AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); - if(audioManager != null) - { - Log.d(LOGTAG, "audioManager.setFmRadioOn = false \n" ); - stopFM(); - unMute(); - audioManager.abandonAudioFocus(mAudioFocusListener); - //audioManager.setParameters("FMRadioOn=false"); - Log.d(LOGTAG, "audioManager.setFmRadioOn false done \n" ); - } // reset FM audio settings resetAudioRoute(); @@ -2281,6 +2282,7 @@ public class FMRadioService extends Service } } + /* * Reset (OFF) FM Operations: This resets all the current FM operations . */