Use telecomm DiconnectCause in services/Telecomm.

+ Some of this is straightforward replacing the old disconnect cause
code/message with the new DisconnectCause object.
+ Replace codes in some instances; most maps straightforwardly to the
newer generic set of disconnect causes.
+ InCallToneMonitor can no longer rely on the specific telephony
DisconnectCauses. Now, instead, they map from a tone (which is
specified on the new telecomm DisconnectCauses) to the type of tone
which should be played in InCall. Most of these are just taking
unique matches from InCallTonePlayer. It is a little redundant, as
the conversion just flips, but it seemed like the easiest way to
accomplish this given current constraints.

+ Behavior is unchanged, but now DisconnectCause.OUT_OF_SERVICE
will invoke InCallTonePlayer.TONE_CDMA_DROP.
+ Now play TONE_PROP_PROMPT regardless of whether there is precisely
one remaining call; this is because we can't distinguish between
telephony DisconnectCause.ERROR_UNSPECIFIED/NORMAL/LOCAL. I figured
this would be a relatively minor change in scenario, and it wouldn't
hurt for a tone to be played even in a disconnect in that scenario.

Bug: 17329632
Change-Id: I85767d424bcfd59b3929819c9c6de46fc4a8629e
diff --git a/src/com/android/server/telecom/CallsManager.java b/src/com/android/server/telecom/CallsManager.java
index 2636c2f..8238ec7 100644
--- a/src/com/android/server/telecom/CallsManager.java
+++ b/src/com/android/server/telecom/CallsManager.java
@@ -22,11 +22,11 @@
 import android.provider.CallLog.Calls;
 import android.telecom.AudioState;
 import android.telecom.CallState;
+import android.telecom.DisconnectCause;
 import android.telecom.GatewayInfo;
 import android.telecom.ParcelableConference;
 import android.telecom.PhoneAccountHandle;
 import android.telecom.PhoneCapabilities;
-import android.telephony.DisconnectCause;
 import android.telephony.TelephonyManager;
 
 import com.android.internal.util.ArrayUtils;
@@ -172,11 +172,11 @@
     }
 
     @Override
-    public void onFailedOutgoingCall(Call call, int errorCode, String errorMsg) {
+    public void onFailedOutgoingCall(Call call, DisconnectCause disconnectCause) {
         Log.v(this, "onFailedOutgoingCall, call: %s", call);
 
         // TODO: Replace disconnect cause with more specific disconnect causes.
-        markCallAsDisconnected(call, errorCode, errorMsg);
+        markCallAsDisconnected(call, disconnectCause);
     }
 
     @Override
@@ -670,11 +670,10 @@
      * Marks the specified call as STATE_DISCONNECTED and notifies the in-call app. If this was the
      * last live call, then also disconnect from the in-call controller.
      *
-     * @param disconnectCause The disconnect reason, see {@link android.telephony.DisconnectCause}.
-     * @param disconnectMessage Optional message about the disconnect.
+     * @param disconnectCause The disconnect cause, see {@link android.telecomm.DisconnectCause}.
      */
-    void markCallAsDisconnected(Call call, int disconnectCause, String disconnectMessage) {
-        call.setDisconnectCause(disconnectCause, disconnectMessage);
+    void markCallAsDisconnected(Call call, DisconnectCause disconnectCause) {
+        call.setDisconnectCause(disconnectCause);
         setCallState(call, CallState.DISCONNECTED);
         removeCall(call);
     }
@@ -696,7 +695,7 @@
         if (service != null) {
             for (Call call : mCalls) {
                 if (call.getConnectionService() == service) {
-                    markCallAsDisconnected(call, DisconnectCause.ERROR_UNSPECIFIED, null);
+                    markCallAsDisconnected(call, new DisconnectCause(DisconnectCause.ERROR));
                 }
             }
         }