Loading src/java/com/android/internal/telephony/CallManager.java +31 −3 Original line number Diff line number Diff line Loading @@ -100,6 +100,8 @@ public final class CallManager { // default phone as the first phone registered, which is PhoneBase obj private Phone mDefaultPhone; private boolean mSpeedUpAudioForMtCall = false; // state registrants protected final RegistrantList mPreciseCallStateRegistrants = new RegistrantList(); Loading Loading @@ -377,15 +379,22 @@ public final class CallManager { // but only on audio mode transitions switch (getState()) { case RINGING: if (audioManager.getMode() != AudioManager.MODE_RINGTONE) { int curAudioMode = audioManager.getMode(); if (curAudioMode != AudioManager.MODE_RINGTONE) { // only request audio focus if the ringtone is going to be heard if (audioManager.getStreamVolume(AudioManager.STREAM_RING) > 0) { if (VDBG) Rlog.d(LOG_TAG, "requestAudioFocus on STREAM_RING"); audioManager.requestAudioFocusForCall(AudioManager.STREAM_RING, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT); } if(!mSpeedUpAudioForMtCall) { audioManager.setMode(AudioManager.MODE_RINGTONE); } } if (mSpeedUpAudioForMtCall && (curAudioMode != AudioManager.MODE_IN_CALL)) { audioManager.setMode(AudioManager.MODE_IN_CALL); } break; case OFFHOOK: Phone offhookPhone = getFgPhone(); Loading @@ -400,13 +409,14 @@ public final class CallManager { // enable IN_COMMUNICATION audio mode instead for sipPhone newAudioMode = AudioManager.MODE_IN_COMMUNICATION; } if (audioManager.getMode() != newAudioMode) { if (audioManager.getMode() != newAudioMode || mSpeedUpAudioForMtCall) { // request audio focus before setting the new mode if (VDBG) Rlog.d(LOG_TAG, "requestAudioFocus on STREAM_VOICE_CALL"); audioManager.requestAudioFocusForCall(AudioManager.STREAM_VOICE_CALL, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT); audioManager.setMode(newAudioMode); } mSpeedUpAudioForMtCall = false; break; case IDLE: if (audioManager.getMode() != AudioManager.MODE_NORMAL) { Loading @@ -415,6 +425,7 @@ public final class CallManager { // abandon audio focus after the mode has been set back to normal audioManager.abandonAudioFocusForCall(); } mSpeedUpAudioForMtCall = false; break; } } Loading Loading @@ -529,6 +540,23 @@ public final class CallManager { } } Context context = getContext(); if (context == null) { Rlog.d(LOG_TAG, "Speedup Audio Path enhancement: Context is null"); } else if (context.getResources().getBoolean( com.android.internal.R.bool.config_speed_up_audio_on_mt_calls)) { Rlog.d(LOG_TAG, "Speedup Audio Path enhancement"); AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); int currMode = audioManager.getMode(); if ((currMode != AudioManager.MODE_IN_CALL) && !(ringingPhone instanceof SipPhone)) { Rlog.d(LOG_TAG, "setAudioMode Setting audio mode from " + currMode + " to " + AudioManager.MODE_IN_CALL); audioManager.setMode(AudioManager.MODE_IN_CALL); mSpeedUpAudioForMtCall = true; } } ringingPhone.acceptCall(); if (VDBG) { Loading Loading
src/java/com/android/internal/telephony/CallManager.java +31 −3 Original line number Diff line number Diff line Loading @@ -100,6 +100,8 @@ public final class CallManager { // default phone as the first phone registered, which is PhoneBase obj private Phone mDefaultPhone; private boolean mSpeedUpAudioForMtCall = false; // state registrants protected final RegistrantList mPreciseCallStateRegistrants = new RegistrantList(); Loading Loading @@ -377,15 +379,22 @@ public final class CallManager { // but only on audio mode transitions switch (getState()) { case RINGING: if (audioManager.getMode() != AudioManager.MODE_RINGTONE) { int curAudioMode = audioManager.getMode(); if (curAudioMode != AudioManager.MODE_RINGTONE) { // only request audio focus if the ringtone is going to be heard if (audioManager.getStreamVolume(AudioManager.STREAM_RING) > 0) { if (VDBG) Rlog.d(LOG_TAG, "requestAudioFocus on STREAM_RING"); audioManager.requestAudioFocusForCall(AudioManager.STREAM_RING, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT); } if(!mSpeedUpAudioForMtCall) { audioManager.setMode(AudioManager.MODE_RINGTONE); } } if (mSpeedUpAudioForMtCall && (curAudioMode != AudioManager.MODE_IN_CALL)) { audioManager.setMode(AudioManager.MODE_IN_CALL); } break; case OFFHOOK: Phone offhookPhone = getFgPhone(); Loading @@ -400,13 +409,14 @@ public final class CallManager { // enable IN_COMMUNICATION audio mode instead for sipPhone newAudioMode = AudioManager.MODE_IN_COMMUNICATION; } if (audioManager.getMode() != newAudioMode) { if (audioManager.getMode() != newAudioMode || mSpeedUpAudioForMtCall) { // request audio focus before setting the new mode if (VDBG) Rlog.d(LOG_TAG, "requestAudioFocus on STREAM_VOICE_CALL"); audioManager.requestAudioFocusForCall(AudioManager.STREAM_VOICE_CALL, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT); audioManager.setMode(newAudioMode); } mSpeedUpAudioForMtCall = false; break; case IDLE: if (audioManager.getMode() != AudioManager.MODE_NORMAL) { Loading @@ -415,6 +425,7 @@ public final class CallManager { // abandon audio focus after the mode has been set back to normal audioManager.abandonAudioFocusForCall(); } mSpeedUpAudioForMtCall = false; break; } } Loading Loading @@ -529,6 +540,23 @@ public final class CallManager { } } Context context = getContext(); if (context == null) { Rlog.d(LOG_TAG, "Speedup Audio Path enhancement: Context is null"); } else if (context.getResources().getBoolean( com.android.internal.R.bool.config_speed_up_audio_on_mt_calls)) { Rlog.d(LOG_TAG, "Speedup Audio Path enhancement"); AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); int currMode = audioManager.getMode(); if ((currMode != AudioManager.MODE_IN_CALL) && !(ringingPhone instanceof SipPhone)) { Rlog.d(LOG_TAG, "setAudioMode Setting audio mode from " + currMode + " to " + AudioManager.MODE_IN_CALL); audioManager.setMode(AudioManager.MODE_IN_CALL); mSpeedUpAudioForMtCall = true; } } ringingPhone.acceptCall(); if (VDBG) { Loading