IMS-VT: Set audio route correctly for Video/voice call for outgoing calls
- Set speaker phone flag for outgoing calls when one of three conditions
is met - speakerPhoneOn flag passed into the placeOutgoingCall is true
or speaker is auto enabled for video calls or phone is docked.
- Route audio to earpiece in DIALING state if call is a Voice call and
bluetooth or wired headset is not connected. This fixes an issue where
if we make a first video call and second outgoing call is voice, audio
is routed to speaker which is not expected.
Change-Id: I8c534bc4164eefa71cb070b0e446e901b151858a
CRs-Fixed: 879183
diff --git a/src/com/android/server/telecom/CallsManager.java b/src/com/android/server/telecom/CallsManager.java
index 382d327..0de43e4 100644
--- a/src/com/android/server/telecom/CallsManager.java
+++ b/src/com/android/server/telecom/CallsManager.java
@@ -730,17 +730,11 @@
call.setHandle(uriHandle);
call.setGatewayInfo(gatewayInfo);
// Auto-enable speakerphone if the originating intent specified to do so, or if the call
- // is a video call.
- call.setStartWithSpeakerphoneOn(speakerphoneOn || isSpeakerphoneAutoEnabled(videoState));
+ // is a video call or if the phone is docked.
+ call.setStartWithSpeakerphoneOn(speakerphoneOn || isSpeakerphoneAutoEnabled(videoState)
+ || mDockManager.isDocked());
call.setVideoState(videoState);
- if (speakerphoneOn) {
- Log.i(this, "%s Starting with speakerphone as requested", call);
- } else {
- Log.i(this, "%s Starting with speakerphone because car is docked.", call);
- }
- call.setStartWithSpeakerphoneOn(speakerphoneOn || mDockManager.isDocked());
-
boolean isEmergencyCall = TelephonyUtil.shouldProcessAsEmergency(mContext,
call.getHandle());
if (isEmergencyCall) {
@@ -1051,6 +1045,7 @@
void markCallAsDialing(Call call) {
setCallState(call, CallState.DIALING, "dialing set explicitly");
+ maybeMoveToEarpiece(call);
maybeMoveToSpeakerPhone(call);
setActiveSubscription(call.getTargetPhoneAccount().getId());
}
@@ -1852,6 +1847,13 @@
}
}
+ private void maybeMoveToEarpiece(Call call) {
+ if (!call.getStartWithSpeakerphoneOn() && !mWiredHeadsetManager.isPluggedIn() &&
+ !mCallAudioManager.isBluetoothDeviceAvailable()) {
+ setAudioRoute(CallAudioState.ROUTE_EARPIECE);
+ }
+ }
+
/**
* Creates a new call for an existing connection.
*