Remove an extraneous check in callSessionMergeFailed().

There is no reason why we cannot continue with merge cleanup
(just to be safe) on a call regardless of if the "i'm in a merge"
flag is set or not. If, for some reason, the call is not
part of a merge, its a NOOP. This handles the case when the
callbacks are out of order and we receive a callSessionMergedFailed()
after a callSessionTerminate() on the merge host. It doesn't really
make sense for the callbacks to come back that way but we should
support it either way.  I also cleaned up the processMergeFailed()
function so that it doesn't abort when there is no merge peer.
Now the logic cleans up the merge host anyways and cleans up the
peer only if it exists.
Note that this is only a partial fix for this bug. The other issue
(main issue) that we need to resolve is why the first conference
puts Telecom in a state where the second conference fails.

Bug: 19852295
Change-Id: I3acf8fd4fd5c199c01ca2c4ead4119f3876e38d5
diff --git a/src/java/com/android/ims/ImsCall.java b/src/java/com/android/ims/ImsCall.java
index 39bbbac..5f842a3 100644
--- a/src/java/com/android/ims/ImsCall.java
+++ b/src/java/com/android/ims/ImsCall.java
@@ -1822,30 +1822,26 @@
                 return;
             }
 
-            if (mMergePeer == null) {
-                loge("processMergeFailed :: No merge peer!");
-                return;
-            }
-
-            if (!isMultiparty()) {
-                if (mTransientConferenceSession == null) {
-                    loge("processMergeFailed :: No transient session!");
-                    return;
-                }
-                // Clean up any work that we performed on the transient session.
+            // Try to clean up the transient session if it exists.
+            if (mTransientConferenceSession != null) {
                 mTransientConferenceSession.setListener(null);
                 mTransientConferenceSession = null;
             }
 
-            // Ensure the calls being conferenced into the conference has isMerged = false.
-            setIsMerged(false);
-            mMergePeer.setIsMerged(false);
-
             listener = mListener;
 
+            // Ensure the calls being conferenced into the conference has isMerged = false.
             // Ensure any terminations are surfaced from this session.
+            setIsMerged(false);
             notifySessionTerminatedDuringMerge();
-            mMergePeer.notifySessionTerminatedDuringMerge();
+
+            if (mMergePeer != null) {
+                // Perform the same cleanup on the merge peer if it exists.
+                mMergePeer.setIsMerged(false);
+                mMergePeer.notifySessionTerminatedDuringMerge();
+            } else {
+                loge("processMergeFailed :: No merge peer!");
+            }
 
             // Clear all the various flags around coordinating this merge.
             clearMergeInfo();
@@ -2238,11 +2234,6 @@
             // Its possible that there could be threading issues with the other thread handling
             // the other call. This could affect our state.
             synchronized (ImsCall.this) {
-                if (!isCallSessionMergePending()) {
-                    // Odd, we are not in the midst of merging anything.
-                    logi("callSessionMergeFailed :: no merge in progress.");
-                    return;
-                }
                 // Let's tell our parent ImsCall that the merge has failed and we need to clean
                 // up any temporary, transient state.  Note this only gets called for an initial
                 // conference.  If a merge into an existing conference fails, the two sessions will