Prevent IMS call merge if the peer call has a pending update request.

Currently, if the user requests merge, and the call they request the merge
on is in the midst of some other pending operation (e.g. hold, resume), the
system will prevent the merge from taking place.  The logic, however does
not account for the fact that the background call being merged into the
foreground call could also be engaged in some other update operation.

Added code to ensure that both calls are not actively engaged in some
pending operation.

Test: Manual
Change-Id: Icc2f3786865345435bbf138b54736fc6f09c0aa4
Fixes: 63764631
diff --git a/src/java/com/android/ims/ImsCall.java b/src/java/com/android/ims/ImsCall.java
index 716687d..c5e6368 100644
--- a/src/java/com/android/ims/ImsCall.java
+++ b/src/java/com/android/ims/ImsCall.java
@@ -1319,13 +1319,28 @@
         logi("merge :: ");
 
         synchronized(mLockObj) {
+            // If the host of the merge is in the midst of some other operation, we cannot merge.
             if (mUpdateRequest != UPDATE_NONE) {
+                setCallSessionMergePending(false);
+                if (mMergePeer != null) {
+                    mMergePeer.setCallSessionMergePending(false);
+                }
                 loge("merge :: update is in progress; request=" +
                         updateRequestToString(mUpdateRequest));
                 throw new ImsException("Call update is in progress",
                         ImsReasonInfo.CODE_LOCAL_ILLEGAL_STATE);
             }
 
+            // The peer of the merge is in the midst of some other operation, we cannot merge.
+            if (mMergePeer != null && mMergePeer.mUpdateRequest != UPDATE_NONE) {
+                setCallSessionMergePending(false);
+                mMergePeer.setCallSessionMergePending(false);
+                loge("merge :: peer call update is in progress; request=" +
+                        updateRequestToString(mMergePeer.mUpdateRequest));
+                throw new ImsException("Peer call update is in progress",
+                        ImsReasonInfo.CODE_LOCAL_ILLEGAL_STATE);
+            }
+
             if (mSession == null) {
                 loge("merge :: no call session");
                 throw new ImsException("No call session",