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

Commit 57209e5f authored by Youming Ye's avatar Youming Ye Committed by paulye
Browse files

Fix IMS conference merge failed

Ims conference merge failed when mergeHost is background call. This
could be due to merge() misses checking the merge host pending or
multiparty status.

Bug: 122905208
Test: Manual
Change-Id: Ibbc626facf82f111bdf8bdef3868a266d3b085e4
parent fcd9bdc8
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();