diff --git a/src/com/android/phone/CallModeler.java b/src/com/android/phone/CallModeler.java
index 79e77f6..495a5ef 100644
--- a/src/com/android/phone/CallModeler.java
+++ b/src/com/android/phone/CallModeler.java
@@ -20,6 +20,7 @@
 import android.os.Handler;
 import android.os.Message;
 import android.os.SystemProperties;
+import android.telephony.PhoneNumberUtils;
 import android.text.TextUtils;
 import android.util.Log;
 
@@ -27,7 +28,6 @@
 import com.android.internal.telephony.Connection;
 import com.android.internal.telephony.Phone;
 import com.android.internal.telephony.PhoneConstants;
-import com.android.internal.telephony.TelephonyCapabilities;
 import com.android.phone.CallGatewayManager.RawGatewayInfo;
 import com.android.services.telephony.common.Call;
 import com.android.services.telephony.common.Call.Capabilities;
@@ -512,19 +512,39 @@
         final boolean callIsActive = (call.getState() == Call.State.ACTIVE);
         final Phone phone = connection.getCall().getPhone();
 
-        final boolean canHold = TelephonyCapabilities.supportsAnswerAndHold(phone);
         boolean canAddCall = false;
         boolean canMergeCall = false;
         boolean canSwapCall = false;
         boolean canRespondViaText = false;
+        boolean canMute = false;
+
+        final boolean supportHold = PhoneUtils.okToSupportHold(mCallManager);
+        final boolean canHold = PhoneUtils.okToHoldCall(mCallManager);
 
         // only applies to active calls
         if (callIsActive) {
-            canAddCall = PhoneUtils.okToAddCall(mCallManager);
             canMergeCall = PhoneUtils.okToMergeCalls(mCallManager);
             canSwapCall = PhoneUtils.okToSwapCalls(mCallManager);
         }
 
+        canAddCall = PhoneUtils.okToAddCall(mCallManager);
+
+        // "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 or if
+        // emergency callback mode (ECM) is active.
+        boolean isEmergencyCall = false;
+        if (connection != null) {
+            isEmergencyCall = PhoneNumberUtils.isLocalEmergencyNumber(connection.getAddress(),
+                    phone.getContext());
+        }
+        boolean isECM = PhoneUtils.isPhoneInEcm(phone);
+        if (isEmergencyCall || isECM) {  // disable "Mute" item
+            canMute = false;
+        } else {
+            canMute = callIsActive;
+        }
+
         canRespondViaText = RejectWithTextMessageManager.allowRespondViaSmsForCall(call,
                 connection);
 
@@ -532,15 +552,15 @@
         // CDMA always has Add
         if (phone.getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA) {
             canAddCall = true;
-        } else {
-            // if neither merge nor add is on...then allow add
-            canAddCall |= !(canAddCall || canMergeCall);
         }
 
         int retval = 0x0;
         if (canHold) {
             retval |= Capabilities.HOLD;
         }
+        if (supportHold) {
+            retval |= Capabilities.SUPPORT_HOLD;
+        }
         if (canAddCall) {
             retval |= Capabilities.ADD_CALL;
         }
@@ -550,10 +570,12 @@
         if (canSwapCall) {
             retval |= Capabilities.SWAP_CALLS;
         }
-
         if (canRespondViaText) {
             retval |= Capabilities.RESPOND_VIA_TEXT;
         }
+        if (canMute) {
+            retval |= Capabilities.MUTE;
+        }
 
         return retval;
     }
diff --git a/src/com/android/phone/PhoneUtils.java b/src/com/android/phone/PhoneUtils.java
index 43ad8b1..bb858b0 100644
--- a/src/com/android/phone/PhoneUtils.java
+++ b/src/com/android/phone/PhoneUtils.java
@@ -2149,6 +2149,50 @@
     //
 
     /**
+     * @return true if we're allowed to hold calls, given the current
+     * state of the Phone.
+     */
+    /* package */ static boolean okToHoldCall(CallManager cm) {
+        final Call fgCall = cm.getActiveFgCall();
+        final boolean hasHoldingCall = cm.hasActiveBgCall();
+        final Call.State fgCallState = fgCall.getState();
+
+        // The "Hold" control is disabled entirely if there's
+        // no way to either hold or unhold in the current state.
+        final boolean okToHold = (fgCallState == Call.State.ACTIVE) && !hasHoldingCall;
+        final boolean okToUnhold = cm.hasActiveBgCall() && (fgCallState == Call.State.IDLE);
+        final boolean canHold = okToHold || okToUnhold;
+
+        return canHold;
+    }
+
+    /**
+     * @return true if we support holding calls, given the current
+     * state of the Phone.
+     */
+    /* package */ static boolean okToSupportHold(CallManager cm) {
+        boolean supportsHold = false;
+
+        final Call fgCall = cm.getActiveFgCall();
+        final boolean hasHoldingCall = cm.hasActiveBgCall();
+        final Call.State fgCallState = fgCall.getState();
+
+        if (TelephonyCapabilities.supportsHoldAndUnhold(fgCall.getPhone())) {
+            // This phone has the concept of explicit "Hold" and "Unhold" actions.
+            supportsHold = true;
+        } else if (hasHoldingCall && (fgCallState == Call.State.IDLE)) {
+            // Even when foreground phone device doesn't support hold/unhold, phone devices
+            // for background holding calls may do.
+            final Call bgCall = cm.getFirstActiveBgCall();
+            if (bgCall != null &&
+                    TelephonyCapabilities.supportsHoldAndUnhold(bgCall.getPhone())) {
+                supportsHold = true;
+            }
+        }
+        return supportsHold;
+    }
+
+    /**
      * @return true if we're allowed to swap calls, given the current
      * state of the Phone.
      */
