Disable "Add Call" and "Mute" while in emergency callback mode

This is Sprint ECM requirement ANDR-118.

Note that this change affects ECM on all CDMA devices regardless of
carrier.  (This particular requirement is from Sprint, but I don't think
it's *contrary* to any other carrier's requirements, so let's just do it
for any device that uses ECM.)

TESTED: On crespo-s, by temporarily hacking the isPhoneInEcm() method to
return true (so I wouldn't need to actually call 911.)  Also removed the
hack and confirmed that "Add Call" and "Mute" still work normally.

Bug: 4147101
Change-Id: Idfeb79892f6cf6b9878735ad12bb97d52c22c0c2
diff --git a/src/com/android/phone/InCallControlState.java b/src/com/android/phone/InCallControlState.java
index e0a4f9a..8b44f29 100644
--- a/src/com/android/phone/InCallControlState.java
+++ b/src/com/android/phone/InCallControlState.java
@@ -138,11 +138,13 @@
 
         // "Mute": only enabled when the foreground call is ACTIVE.
         // (It's meaningless while on hold, or while DIALING/ALERTING.)
-        // It's also explicitly disabled during emergency calls.
+        // It's also explicitly disabled during emergency calls or if
+        // emergency callback mode (ECM) is active.
         Connection c = fgCall.getLatestConnection();
         boolean isEmergencyCall = false;
         if (c != null) isEmergencyCall = PhoneNumberUtils.isEmergencyNumber(c.getAddress());
-        if (isEmergencyCall) { // disable "Mute" item
+        boolean isECM = PhoneUtils.isPhoneInEcm(fgCall.getPhone());
+        if (isEmergencyCall || isECM) {  // disable "Mute" item
             canMute = false;
             muteIndicatorOn = false;
         } else {
diff --git a/src/com/android/phone/PhoneUtils.java b/src/com/android/phone/PhoneUtils.java
index 1708310..6148a2d 100644
--- a/src/com/android/phone/PhoneUtils.java
+++ b/src/com/android/phone/PhoneUtils.java
@@ -2065,6 +2065,11 @@
     /* package */ static boolean okToAddCall(CallManager cm) {
         Phone phone = cm.getActiveFgCall().getPhone();
 
+        // "Add call" is never allowed in emergency callback mode (ECM).
+        if (isPhoneInEcm(phone)) {
+            return false;
+        }
+
         int phoneType = phone.getPhoneType();
         final Call.State fgCallState = cm.getActiveFgCall().getState();
         if (phoneType == Phone.PHONE_TYPE_CDMA) {