diff options
Diffstat (limited to 'fmapp2/src/com/caf/fmradio')
-rw-r--r-- | fmapp2/src/com/caf/fmradio/FMRadioService.java | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/fmapp2/src/com/caf/fmradio/FMRadioService.java b/fmapp2/src/com/caf/fmradio/FMRadioService.java index 9ce5133..bc28f62 100644 --- a/fmapp2/src/com/caf/fmradio/FMRadioService.java +++ b/fmapp2/src/com/caf/fmradio/FMRadioService.java @@ -290,10 +290,6 @@ public class FMRadioService extends Service cancelAlarms(); //release the audio focus listener AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); - if (isMuted()) { - mMuted = false; - audioManager.setStreamMute(AudioManager.STREAM_MUSIC,false); - } audioManager.abandonAudioFocus(mAudioFocusListener); /* Remove the Screen On/off listener */ if (mScreenOnOffReceiver != null) { @@ -363,6 +359,8 @@ public class FMRadioService extends Service AUDIO_SAMPLE_RATE, AUDIO_CHANNEL_CONFIG, AUDIO_ENCODING_FORMAT, FM_RECORD_BUF_SIZE, AudioTrack.MODE_STREAM); + if (mMuted) + mAudioTrack.setVolume(0.0f); } private synchronized void startRecordSink() { @@ -1580,8 +1578,6 @@ public class FMRadioService extends Service mSpeakerDisableHandler.postDelayed(mSpeakerDisableTask, 0); } if (true == mPlaybackInProgress) { - if(mMuted) - unMute(); stopFM(); } if (mSpeakerPhoneOn) { @@ -2200,7 +2196,6 @@ public class FMRadioService extends Service if(audioManager != null) { Log.d(LOGTAG, "audioManager.setFmRadioOn = false \n" ); - unMute(); stopFM(); //audioManager.setParameters("FMRadioOn=false"); Log.d(LOGTAG, "audioManager.setFmRadioOn false done \n" ); @@ -2460,7 +2455,9 @@ public class FMRadioService extends Service if (audioManager != null) { mMuted = true; - audioManager.setStreamMute(AudioManager.STREAM_MUSIC,true); + audioManager.setParameters("fm_mute=1"); + if (mAudioTrack != null) + mAudioTrack.setVolume(0.0f); } return bCommandSent; } @@ -2480,7 +2477,9 @@ public class FMRadioService extends Service if (audioManager != null) { mMuted = false; - audioManager.setStreamMute(AudioManager.STREAM_MUSIC,false); + audioManager.setParameters("fm_mute=0"); + if (mAudioTrack != null) + mAudioTrack.setVolume(1.0f); if (mResumeAfterCall) { //We are unmuting FM in a voice call. Need to enable FM audio routing. |