summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlex Yakavenka <ayakav@codeaurora.org>2012-12-08 10:20:47 -0800
committerRicardo Cerqueira <cyanogenmod@cerqueira.org>2012-12-27 02:22:33 +0000
commitc08256a14875b0e1d2e988ee3700c9dc1a5d4fd3 (patch)
tree578fe5eb1392c2d89e6dbee071ada3c365725e39 /src
parent04c728ab5919289423193a9dd7decc76545aa0fe (diff)
downloadframeworks_opt_telephony-c08256a14875b0e1d2e988ee3700c9dc1a5d4fd3.zip
frameworks_opt_telephony-c08256a14875b0e1d2e988ee3700c9dc1a5d4fd3.tar.gz
frameworks_opt_telephony-c08256a14875b0e1d2e988ee3700c9dc1a5d4fd3.tar.bz2
Set audio mode after accepting the call
Set the audio mode to incall immediately after accepting the call and not wait till call is reported as ACTIVE by RIL. This is done to speed up time taken for audio to set up the voice path (CM change: Remove calls to Rlog, since we haven't imported that yet) Bug: 7612431 Change-Id: I8008edc64928016ab94aa6d770de248b5d85dc93
Diffstat (limited to 'src')
-rw-r--r--src/java/com/android/internal/telephony/CallManager.java34
1 files changed, 31 insertions, 3 deletions
diff --git a/src/java/com/android/internal/telephony/CallManager.java b/src/java/com/android/internal/telephony/CallManager.java
index 3538987..bb237b0 100644
--- a/src/java/com/android/internal/telephony/CallManager.java
+++ b/src/java/com/android/internal/telephony/CallManager.java
@@ -101,6 +101,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();
@@ -381,14 +383,21 @@ 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) Log.d(LOG_TAG, "requestAudioFocus on STREAM_RING");
audioManager.requestAudioFocusForCall(AudioManager.STREAM_RING,
AudioManager.AUDIOFOCUS_GAIN_TRANSIENT);
}
- audioManager.setMode(AudioManager.MODE_RINGTONE);
+ if(!mSpeedUpAudioForMtCall) {
+ audioManager.setMode(AudioManager.MODE_RINGTONE);
+ }
+ }
+
+ if (mSpeedUpAudioForMtCall && (curAudioMode != AudioManager.MODE_IN_CALL)) {
+ audioManager.setMode(AudioManager.MODE_IN_CALL);
}
break;
case OFFHOOK:
@@ -404,13 +413,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) Log.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) {
@@ -419,6 +429,7 @@ public final class CallManager {
// abandon audio focus after the mode has been set back to normal
audioManager.abandonAudioFocusForCall();
}
+ mSpeedUpAudioForMtCall = false;
break;
}
}
@@ -543,6 +554,23 @@ public final class CallManager {
}
}
+ Context context = getContext();
+ if (context == null) {
+ Log.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)) {
+ Log.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)) {
+ Log.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) {