Fix issues associated with hold failure

When Telecom requests that a call be held on IMS, don't perform the hold
if there's a call on call-waiting.

Fixes: 128275255
Test: manual
Change-Id: I2b1449a94c0da0f00eecc72eb18e0bcd99fd088a
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
index 7c09320..632e9ac 100644
--- a/src/com/android/services/telephony/TelephonyConnection.java
+++ b/src/com/android/services/telephony/TelephonyConnection.java
@@ -932,12 +932,6 @@
             try {
                 Phone phone = mOriginalConnection.getCall().getPhone();
 
-                // New behavior for IMS -- don't use the clunky switchHoldingAndActive logic.
-                if (phone.getPhoneType() == PhoneConstants.PHONE_TYPE_IMS) {
-                    ImsPhone imsPhone = (ImsPhone) phone;
-                    imsPhone.holdActiveCall();
-                    return;
-                }
                 Call ringingCall = phone.getRingingCall();
 
                 // Although the method says switchHoldingAndActive, it eventually calls a RIL method
@@ -951,6 +945,12 @@
                 // could "fake" hold by silencing the audio and microphone streams for this call
                 // instead of actually putting it on hold.
                 if (ringingCall.getState() != Call.State.WAITING) {
+                    // New behavior for IMS -- don't use the clunky switchHoldingAndActive logic.
+                    if (phone.getPhoneType() == PhoneConstants.PHONE_TYPE_IMS) {
+                        ImsPhone imsPhone = (ImsPhone) phone;
+                        imsPhone.holdActiveCall();
+                        return;
+                    }
                     phone.switchHoldingAndActive();
                 }