Improvements to the stability of SipDelegateManager based on CTS Testing

1) new shell command to clear the carrier ImsService override for more stable testing.
2) DelegateStateTracker - dedupe DelegateRegistrationState updates if
    they result in the same reg state being sent.
3) SipDelegateBinderConnection - Add linkToDeath on sip transport binder
    interface to unblock pending create/destroy messages if the service
    dies while waiting for a result from one of these commands.
4) SipDelegateController - ensure that when all features are denied we
    do not incorrectly skip the change operation. Also, fixed some race
    conditions between the transport onCreated command being sent after
    onFeatureTagsChanged.
5) SipTransportController - Added OBSERVE_ROLE_HOLDERS to
    AndroidManifest and some better debug logging around role changes.

Bug: 154763999
Test: atest TeleServiceTests
Change-Id: Iad6cf386943769a3b3a95a1f8e793b6e129d468c
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 52b8f0a..beda55c 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -5253,6 +5253,36 @@
     }
 
     /**
+     * Clears any carrier ImsService overrides for the slot index specified that were previously
+     * set with {@link #setBoundImsServiceOverride(int, boolean, int[], String)}.
+     *
+     * This should only be used for testing.
+     *
+     * @param slotIndex the slot ID that the ImsService should bind for.
+     * @return true if clearing the carrier ImsService override succeeded or false if it did not.
+     */
+    @Override
+    public boolean clearCarrierImsServiceOverride(int slotIndex) {
+        int[] subIds = SubscriptionManager.getSubId(slotIndex);
+        TelephonyPermissions.enforceShellOnly(Binder.getCallingUid(),
+                "clearCarrierImsServiceOverride");
+        TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(mApp,
+                (subIds != null ? subIds[0] : SubscriptionManager.INVALID_SUBSCRIPTION_ID),
+                "clearCarrierImsServiceOverride");
+
+        final long identity = Binder.clearCallingIdentity();
+        try {
+            if (mImsResolver == null) {
+                // may happen if the device does not support IMS.
+                return false;
+            }
+            return mImsResolver.clearCarrierImsServiceConfiguration(slotIndex);
+        } finally {
+            Binder.restoreCallingIdentity(identity);
+        }
+    }
+
+    /**
      * Return the package name of the currently bound ImsService.
      *
      * @param slotId The slot that the ImsService is associated with.