Skip to content
Snippets Groups Projects
Commit 2b1781ca authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "FM: FMRadio will wait for the focus from telecom repeatedly" into fm.lnx.2.1-dev

parents 5429d364 9a2f2372
No related branches found
No related tags found
No related merge requests found
...@@ -1441,6 +1441,7 @@ public class FMRadioService extends Service ...@@ -1441,6 +1441,7 @@ public class FMRadioService extends Service
//any. Similarly once call is ended FM should be unmuted. //any. Similarly once call is ended FM should be unmuted.
AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
mCallStatus = state; mCallStatus = state;
int granted = AudioManager.AUDIOFOCUS_REQUEST_FAILED, count = 0;
if((TelephonyManager.CALL_STATE_OFFHOOK == state)|| if((TelephonyManager.CALL_STATE_OFFHOOK == state)||
(TelephonyManager.CALL_STATE_RINGING == state)) { (TelephonyManager.CALL_STATE_RINGING == state)) {
...@@ -1475,9 +1476,21 @@ public class FMRadioService extends Service ...@@ -1475,9 +1476,21 @@ public class FMRadioService extends Service
if (isAntennaAvailable() && (!isFmOn()) && mServiceInUse) if (isAntennaAvailable() && (!isFmOn()) && mServiceInUse)
{ {
Log.d(LOGTAG, "Resuming after call:"); Log.d(LOGTAG, "Resuming after call:");
do {
granted = audioManager.requestAudioFocus(mAudioFocusListener,
AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT);
++count;
try {
Thread.sleep(100);
} catch (Exception ex) {
Log.d( LOGTAG, "InterruptedException");
}
} while(granted != AudioManager.AUDIOFOCUS_REQUEST_GRANTED && count != 3);
if(true != fmOn()) { if(true != fmOn()) {
return; return;
} }
mResumeAfterCall = false; mResumeAfterCall = false;
if(mCallbacks != null) { if(mCallbacks != null) {
try { try {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment