summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVenkateshwarlu Domakonda <vdomak@codeaurora.org>2014-11-25 15:08:27 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2014-11-25 21:45:34 -0800
commit3f4530670ff55610de448f5b5d72cd0461b2d789 (patch)
treee0fb05df0b58553ac5aae0c5a932378f1d1f1e99
parenta3f6630152663ff56b6f58497360d90d34566c59 (diff)
downloadandroid_hardware_qcom_fm-3f4530670ff55610de448f5b5d72cd0461b2d789.tar.gz
android_hardware_qcom_fm-3f4530670ff55610de448f5b5d72cd0461b2d789.tar.bz2
android_hardware_qcom_fm-3f4530670ff55610de448f5b5d72cd0461b2d789.zip
FM: Fix the issue with MO call and Mute concurrency
- As the google made changes in Telephony, while initiating MO call, requesting for Audio focus before change the call state. - To make the same behavior for MO & MT calls, changes made to handle Mute & speaker scenarios. CRs-Fixed: 747388 Change-Id: I0c9f0e891f7065faa8025f046ee00ec207e431df
-rw-r--r--fmapp2/src/com/caf/fmradio/FMRadioService.java18
1 files changed, 16 insertions, 2 deletions
diff --git a/fmapp2/src/com/caf/fmradio/FMRadioService.java b/fmapp2/src/com/caf/fmradio/FMRadioService.java
index 458fb96..75086b0 100644
--- a/fmapp2/src/com/caf/fmradio/FMRadioService.java
+++ b/fmapp2/src/com/caf/fmradio/FMRadioService.java
@@ -177,6 +177,8 @@ 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;
public FMRadioService() {
}
@@ -830,6 +832,8 @@ public class FMRadioService extends Service
}
sendRecordServiceIntent(RECORD_START);
mPlaybackInProgress = true;
+ mUnMuteOnFocusLoss = false;
+ mSpeakerOnFocusLoss = false;
}
private void stopFM(){
@@ -1055,7 +1059,14 @@ public class FMRadioService extends Service
if((TelephonyManager.CALL_STATE_OFFHOOK == state)||
(TelephonyManager.CALL_STATE_RINGING == state)) {
- boolean bTempSpeaker = mSpeakerPhoneOn; //need to restore SpeakerPhone
+ 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 bTempMute = mMuted;// need to restore Mute status
int bTempCall = mCallStatus;//need to restore call status
if (isFmOn() && fmOff()) {
@@ -1183,10 +1194,13 @@ public class FMRadioService extends Service
if (mSpeakerPhoneOn) {
mSpeakerDisableHandler.removeCallbacks(mSpeakerDisableTask);
mSpeakerDisableHandler.postDelayed(mSpeakerDisableTask, 0);
+ mSpeakerOnFocusLoss = true;
}
if (true == mPlaybackInProgress) {
- if(mMuted)
+ if(mMuted) {
unMute();
+ mUnMuteOnFocusLoss = true;
+ }
stopFM();
}
if (mSpeakerPhoneOn) {