Disconnect held call when answering third call.

When accepting a call when there was already both an active
and held call, the CallsManager tried to hold the active call, and
then answer the new incoming call. But since there were still two
calls tracked by the calls manager, the answer failed.

To fix, if we are attempting to hold the active call before accepting
a new call, if there is a pre-existing held call disconnect that held
call before holding the active call.

Bug: 17318947
Change-Id: I78e5899c5f0344af0245b77827df75f9dde683b4
diff --git a/src/com/android/server/telecom/CallsManager.java b/src/com/android/server/telecom/CallsManager.java
index cfd4641..db46333 100644
--- a/src/com/android/server/telecom/CallsManager.java
+++ b/src/com/android/server/telecom/CallsManager.java
@@ -644,6 +644,13 @@
                         mForegroundCall.disconnect();
                     }
                 } else {
+                    Call heldCall = getHeldCall();
+                    if (heldCall != null) {
+                        Log.v(this, "Disconnecting held call %s before holding active call.",
+                                heldCall);
+                        heldCall.disconnect();
+                    }
+
                     Log.v(this, "Holding active/dialing call %s before answering incoming call %s.",
                             mForegroundCall, call);
                     mForegroundCall.hold();