Merge "FM: Fix the issue with AUDIOFOCUS_LOSS_TRANSIENT"
diff --git a/fmapp2/src/com/caf/fmradio/FMRadioService.java b/fmapp2/src/com/caf/fmradio/FMRadioService.java
index 4918680..5825d1e 100644
--- a/fmapp2/src/com/caf/fmradio/FMRadioService.java
+++ b/fmapp2/src/com/caf/fmradio/FMRadioService.java
@@ -189,8 +189,6 @@
"codeaurora.intent.action.FM.Recording.Status";
private BroadcastReceiver mFmRecordingStatus = null;
private Thread mRecordServiceCheckThread = null;
- private boolean mUnMuteOnFocusLoss = false;
- private boolean mSpeakerOnFocusLoss = false;
private MediaSession mSession;
private boolean mIsSSRInProgress = false;
private boolean mIsSSRInProgressFromActivity = false;
@@ -1056,8 +1054,6 @@
}
startRecordSink();
mPlaybackInProgress = true;
- mUnMuteOnFocusLoss = false;
- mSpeakerOnFocusLoss = false;
}
private void stopFM(){
@@ -1358,14 +1354,7 @@
if((TelephonyManager.CALL_STATE_OFFHOOK == state)||
(TelephonyManager.CALL_STATE_RINGING == state)) {
- boolean bTempSpeaker = (mSpeakerPhoneOn | mSpeakerOnFocusLoss) ; //need to restore SpeakerPhone
- if (mUnMuteOnFocusLoss) {
- if (audioManager != null) {
- Log.d(LOGTAG, "Mute");
- mMuted = true;
- audioManager.setStreamMute(AudioManager.STREAM_MUSIC,true);
- }
- }
+ boolean bTempSpeaker = mSpeakerPhoneOn ; //need to restore SpeakerPhone
boolean bTempMute = mMuted;// need to restore Mute status
int bTempCall = mCallStatus;//need to restore call status
if (isFmOn() && fmOff()) {
@@ -1498,23 +1487,10 @@
Log.v(LOGTAG, "AudioFocus: received AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK");
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT:
Log.v(LOGTAG, "AudioFocus: received AUDIOFOCUS_LOSS_TRANSIENT");
- if (mSpeakerPhoneOn) {
- mSpeakerDisableHandler.removeCallbacks(mSpeakerDisableTask);
- mSpeakerDisableHandler.postDelayed(mSpeakerDisableTask, 0);
- mSpeakerOnFocusLoss = true;
- }
if (true == mPlaybackInProgress) {
- if(mMuted) {
- unMute();
- mUnMuteOnFocusLoss = true;
- }
stopFM();
+ mStoppedOnFocusLoss = true;
}
- if (mSpeakerPhoneOn) {
- if (isAnalogModeSupported())
- setAudioPath(false);
- }
- mStoppedOnFocusLoss = true;
break;
case AudioManager.AUDIOFOCUS_LOSS:
Log.v(LOGTAG, "AudioFocus: received AUDIOFOCUS_LOSS");