Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 85f6eb0c authored by Youming Ye's avatar Youming Ye Committed by Gerrit Code Review
Browse files

Merge "Fix IMS conference merge failed"

parents aa43f578 57209e5f
Loading
Loading
Loading
Loading
+23 −15
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@

package com.android.ims;

import com.android.internal.R;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -1368,6 +1366,15 @@ public class ImsCall implements ICall {
        }
    }

    private boolean isUpdatePending(ImsCall imsCall) {
        if (imsCall != null && imsCall.mUpdateRequest != UPDATE_NONE) {
            loge("merge :: update is in progress; request=" +
                    updateRequestToString(mUpdateRequest));
            return true;
        }
        return false;
    }

    /**
     * Merges the active & hold call.
     *
@@ -1378,25 +1385,23 @@ public class ImsCall implements ICall {
        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) {
            // If the fg call of the merge is in the midst of some other operation, we cannot merge.
            // fg is either the host or the peer of the merge
            if (isUpdatePending(this)) {
                setCallSessionMergePending(false);
                if (mMergePeer != null) {
                    mMergePeer.setCallSessionMergePending(false);
                }
                loge("merge :: update is in progress; request=" +
                        updateRequestToString(mUpdateRequest));
                if (mMergePeer != null) mMergePeer.setCallSessionMergePending(false);
                if (mMergeHost != null) mMergeHost.setCallSessionMergePending(false);
                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) {
            // If the bg call of the merge is in the midst of some other operation, we cannot merge.
            // bg is either the peer or the host of the merge.
            if (isUpdatePending(mMergePeer) || isUpdatePending(mMergeHost)) {
                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",
                if (mMergePeer != null) mMergePeer.setCallSessionMergePending(false);
                if (mMergeHost != null) mMergeHost.setCallSessionMergePending(false);
                throw new ImsException("Peer or host call update is in progress",
                        ImsReasonInfo.CODE_LOCAL_ILLEGAL_STATE);
            }

@@ -1421,6 +1426,9 @@ public class ImsCall implements ICall {
                    // merge is pending.
                    mUpdateRequest = UPDATE_MERGE;
                    mMergePeer.mUpdateRequest = UPDATE_MERGE;
                } else if (mMergeHost != null && !mMergeHost.isMultiparty() && !isMultiparty()) {
                    mUpdateRequest = UPDATE_MERGE;
                    mMergeHost.mUpdateRequest = UPDATE_MERGE;
                }

                mSession.merge();