Skip to content
Snippets Groups Projects
Commit 14101f92 authored by Venkateshwarlu Domakonda's avatar Venkateshwarlu Domakonda Committed by Gerrit - the friendly Code Review server
Browse files

FM: Fix the issue with AUDIOFOCUS_LOSS_TRANSIENT

Stop the FM audio and retain the mute status and speaker status.

Change-Id: Iefcde4df34b484da6d48798703d66a1bb42c9b51
CRs-Fixed: 901852
parent ba8d581c
No related branches found
No related tags found
No related merge requests found
...@@ -191,8 +191,6 @@ public class FMRadioService extends Service ...@@ -191,8 +191,6 @@ public class FMRadioService extends Service
static final int RECORD_START = 1; static final int RECORD_START = 1;
static final int RECORD_STOP = 0; static final int RECORD_STOP = 0;
private Thread mRecordServiceCheckThread = null; private Thread mRecordServiceCheckThread = null;
private boolean mUnMuteOnFocusLoss = false;
private boolean mSpeakerOnFocusLoss = false;
private MediaSession mSession; private MediaSession mSession;
private boolean mIsSSRInProgress = false; private boolean mIsSSRInProgress = false;
private boolean mIsSSRInProgressFromActivity = false; private boolean mIsSSRInProgressFromActivity = false;
...@@ -1075,8 +1073,6 @@ public class FMRadioService extends Service ...@@ -1075,8 +1073,6 @@ public class FMRadioService extends Service
} }
startRecordSink(); startRecordSink();
mPlaybackInProgress = true; mPlaybackInProgress = true;
mUnMuteOnFocusLoss = false;
mSpeakerOnFocusLoss = false;
} }
private void stopFM(){ private void stopFM(){
...@@ -1367,14 +1363,7 @@ public class FMRadioService extends Service ...@@ -1367,14 +1363,7 @@ public class FMRadioService extends Service
if((TelephonyManager.CALL_STATE_OFFHOOK == state)|| if((TelephonyManager.CALL_STATE_OFFHOOK == state)||
(TelephonyManager.CALL_STATE_RINGING == state)) { (TelephonyManager.CALL_STATE_RINGING == state)) {
boolean bTempSpeaker = (mSpeakerPhoneOn | mSpeakerOnFocusLoss) ; //need to restore SpeakerPhone boolean bTempSpeaker = mSpeakerPhoneOn ; //need to restore SpeakerPhone
if (mUnMuteOnFocusLoss) {
if (audioManager != null) {
Log.d(LOGTAG, "Mute");
mMuted = true;
audioManager.setStreamMute(AudioManager.STREAM_MUSIC,true);
}
}
boolean bTempMute = mMuted;// need to restore Mute status boolean bTempMute = mMuted;// need to restore Mute status
int bTempCall = mCallStatus;//need to restore call status int bTempCall = mCallStatus;//need to restore call status
if (isFmOn() && fmOff()) { if (isFmOn() && fmOff()) {
...@@ -1507,23 +1496,10 @@ public class FMRadioService extends Service ...@@ -1507,23 +1496,10 @@ public class FMRadioService extends Service
Log.v(LOGTAG, "AudioFocus: received AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK"); Log.v(LOGTAG, "AudioFocus: received AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK");
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT: case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT:
Log.v(LOGTAG, "AudioFocus: received 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 (true == mPlaybackInProgress) {
if(mMuted) {
unMute();
mUnMuteOnFocusLoss = true;
}
stopFM(); stopFM();
}
if (mSpeakerPhoneOn) {
if (isAnalogModeSupported())
setAudioPath(false);
}
mStoppedOnFocusLoss = true; mStoppedOnFocusLoss = true;
}
break; break;
case AudioManager.AUDIOFOCUS_LOSS: case AudioManager.AUDIOFOCUS_LOSS:
Log.v(LOGTAG, "AudioFocus: received AUDIOFOCUS_LOSS"); Log.v(LOGTAG, "AudioFocus: received AUDIOFOCUS_LOSS");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment