Disconnect SELECT_PHONE_ACCOUNT call to make room for outgoing call
If there is a call still in the SELECT_PHONE_ACCOUNT state while
a new outgoing call is made, disconnect it to make room.
Also fix some logging in InCallController
Bug: 19187111
Change-Id: Ia161325480692ead7a1633f47604ced01604883f
diff --git a/src/com/android/server/telecom/CallsManager.java b/src/com/android/server/telecom/CallsManager.java
index 2d74d88..9e0e328 100644
--- a/src/com/android/server/telecom/CallsManager.java
+++ b/src/com/android/server/telecom/CallsManager.java
@@ -1394,15 +1394,19 @@
}
if (hasMaximumOutgoingCalls()) {
- // Disconnect the current outgoing call if it's not an emergency call. If the user
- // tries to make two outgoing calls to different emergency call numbers, we will try
- // to connect the first outgoing call.
- if (isEmergency) {
- Call outgoingCall = getFirstCallWithState(OUTGOING_CALL_STATES);
- if (!outgoingCall.isEmergencyCall()) {
- outgoingCall.disconnect();
- return true;
- }
+ Call outgoingCall = getFirstCallWithState(OUTGOING_CALL_STATES);
+ if (isEmergency && !outgoingCall.isEmergencyCall()) {
+ // Disconnect the current outgoing call if it's not an emergency call. If the
+ // user tries to make two outgoing calls to different emergency call numbers,
+ // we will try to connect the first outgoing call.
+ outgoingCall.disconnect();
+ return true;
+ }
+ if (outgoingCall.getState() == CallState.SELECT_PHONE_ACCOUNT) {
+ // If there is an orphaned call in the {@link CallState#SELECT_PHONE_ACCOUNT}
+ // state, just disconnect it since the user has explicitly started a new call.
+ outgoingCall.disconnect();
+ return true;
}
return false;
}