diff options
author | Venkateshwarlu Domakonda <vdomak@codeaurora.org> | 2015-09-03 22:08:34 +0530 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2015-09-04 03:43:27 -0700 |
commit | 14101f92e70b2452282a968b57e5c8ff00b64a6c (patch) | |
tree | d8c048ab60fc11245f05c2063b31b76a621f4dd4 /fmapp2/src/com | |
parent | ba8d581c74eca57ff0b1407aa7f45be72716a23f (diff) | |
download | android_hardware_qcom_fm-14101f92e70b2452282a968b57e5c8ff00b64a6c.tar.gz android_hardware_qcom_fm-14101f92e70b2452282a968b57e5c8ff00b64a6c.tar.bz2 android_hardware_qcom_fm-14101f92e70b2452282a968b57e5c8ff00b64a6c.zip |
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
Diffstat (limited to 'fmapp2/src/com')
-rw-r--r-- | fmapp2/src/com/caf/fmradio/FMRadioService.java | 28 |
1 files changed, 2 insertions, 26 deletions
diff --git a/fmapp2/src/com/caf/fmradio/FMRadioService.java b/fmapp2/src/com/caf/fmradio/FMRadioService.java index b35b3f4..4066b9d 100644 --- a/fmapp2/src/com/caf/fmradio/FMRadioService.java +++ b/fmapp2/src/com/caf/fmradio/FMRadioService.java @@ -191,8 +191,6 @@ public class FMRadioService extends Service static final int RECORD_START = 1; static final int RECORD_STOP = 0; private Thread mRecordServiceCheckThread = null; - private boolean mUnMuteOnFocusLoss = false; - private boolean mSpeakerOnFocusLoss = false; private MediaSession mSession; private boolean mIsSSRInProgress = false; private boolean mIsSSRInProgressFromActivity = false; @@ -1075,8 +1073,6 @@ public class FMRadioService extends Service } startRecordSink(); mPlaybackInProgress = true; - mUnMuteOnFocusLoss = false; - mSpeakerOnFocusLoss = false; } private void stopFM(){ @@ -1367,14 +1363,7 @@ public class FMRadioService extends Service 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()) { @@ -1507,23 +1496,10 @@ public class FMRadioService extends Service 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"); |