Merge commit 'c289432' into manualmerge
Change-Id: If41bedc2b72823ec27f3d0d6536e9678e0f27561
diff --git a/src/com/android/server/telecom/CallAudioManager.java b/src/com/android/server/telecom/CallAudioManager.java
index 7a84eac..8d1144d 100644
--- a/src/com/android/server/telecom/CallAudioManager.java
+++ b/src/com/android/server/telecom/CallAudioManager.java
@@ -45,6 +45,7 @@
private boolean mIsTonePlaying;
private boolean mWasSpeakerOn;
private int mMostRecentlyUsedMode = AudioManager.MODE_IN_CALL;
+ private Call mCallToSpeedUpMTAudio = null;
CallAudioManager(
Context context,
@@ -112,6 +113,12 @@
}
setSystemAudioState(false /* isMute */, route, mAudioState.getSupportedRouteMask());
+
+ if (call.can(android.telecom.Call.Details.CAPABILITY_SPEED_UP_MT_AUDIO)) {
+ Log.v(this, "Speed up audio setup for IMS MT call.");
+ mCallToSpeedUpMTAudio = call;
+ updateAudioStreamAndMode();
+ }
}
@Override
@@ -286,6 +293,10 @@
boolean wasNotVoiceCall = mAudioFocusStreamType != AudioManager.STREAM_VOICE_CALL;
updateAudioStreamAndMode();
+ if (call != null && call.getState() == CallState.ACTIVE &&
+ call == mCallToSpeedUpMTAudio) {
+ mCallToSpeedUpMTAudio = null;
+ }
// If we transition from not voice call to voice call, we need to set an initial state.
if (wasNotVoiceCall && mAudioFocusStreamType == AudioManager.STREAM_VOICE_CALL) {
setInitialAudioState(call, true /* force */);
@@ -366,7 +377,11 @@
Call foregroundCall = getForegroundCall();
Call waitingForAccountSelectionCall = mCallsManager
.getFirstCallWithState(CallState.PRE_DIAL_WAIT);
- if (foregroundCall != null && waitingForAccountSelectionCall == null) {
+ Call call = mCallsManager.getForegroundCall();
+ if (foregroundCall == null && call != null && call == mCallToSpeedUpMTAudio) {
+ requestAudioFocusAndSetMode(AudioManager.STREAM_VOICE_CALL,
+ AudioManager.MODE_IN_CALL);
+ } else if (foregroundCall != null && waitingForAccountSelectionCall == null) {
// In the case where there is a call that is waiting for account selection,
// this will fall back to abandonAudioFocus() below, which temporarily exits
// the in-call audio mode. This is to allow TalkBack to speak the "Call with"
@@ -417,6 +432,7 @@
Log.v(this, "abandoning audio focus");
mAudioManager.abandonAudioFocusForCall();
mAudioFocusStreamType = STREAM_NONE;
+ mCallToSpeedUpMTAudio = null;
}
}