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

Commit 286e95aa authored by Tyler Gunn's avatar Tyler Gunn
Browse files

Suppress Connection address changes while merge is in progress.

Due to the manner in which conferences are formed, the IMS session
associated with the conference is swapped into the call which initiated
the merge briefly before the conference is added to Telecom and the
session is moved to that conference.  The issue is that in some cases
the new conference session will have a conference URI associated with it.
To mitigate this, this change blocks address changes during the merge
process.

Test: Manual
Bug: 62017197
Change-Id: I7e7c21e26380c55a6b4ed34ad50f384be7df9d5f
parent f8f9bc4b
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -1229,13 +1229,11 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
        ImsPhoneConnection foregroundConnection = mForegroundCall.getFirstConnection();
        if (foregroundConnection != null) {
            foregroundConnection.setConferenceConnectTime(conferenceConnectTime);
            foregroundConnection.onConnectionEvent(android.telecom.Connection.EVENT_MERGE_START,
                    null);
            foregroundConnection.handleMergeStart();
        }
        ImsPhoneConnection backgroundConnection = findConnection(bgImsCall);
        if (backgroundConnection != null) {
            backgroundConnection.onConnectionEvent(android.telecom.Connection.EVENT_MERGE_START,
                    null);
            backgroundConnection.handleMergeStart();
        }

        try {
@@ -2348,7 +2346,7 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
            ImsPhoneConnection conn = findConnection(call);
            if (conn != null) {
                conn.onConferenceMergeFailed();
                conn.onConnectionEvent(android.telecom.Connection.EVENT_MERGE_COMPLETE, null);
                conn.handleMergeComplete();
            }
        }

+53 −23
Original line number Diff line number Diff line
@@ -35,6 +35,8 @@ import android.telephony.Rlog;
import android.telephony.ServiceState;
import android.text.TextUtils;

import com.android.ims.ImsCall;
import com.android.ims.ImsCallProfile;
import com.android.ims.ImsException;
import com.android.ims.ImsStreamMediaProfile;
import com.android.ims.internal.ImsVideoCallProviderWrapper;
@@ -44,9 +46,6 @@ import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.UUSInfo;

import com.android.ims.ImsCall;
import com.android.ims.ImsCallProfile;

import java.util.Objects;

/**
@@ -107,6 +106,11 @@ public class ImsPhoneConnection extends Connection implements
    private ImsRttTextHandler mRttTextHandler;
    private android.telecom.Connection.RttTextStream mRttTextStream;

    /**
     * Used to indicate that this call is in the midst of being merged into a conference.
     */
    private boolean mIsMergeInProcess = false;

    //***** Event Constants
    private static final int EVENT_DTMF_DONE = 1;
    private static final int EVENT_PAUSE_DONE = 2;
@@ -761,9 +765,18 @@ public class ImsPhoneConnection extends Connection implements
            int namep = ImsCallProfile.OIRToPresentation(
                    callProfile.getCallExtraInt(ImsCallProfile.EXTRA_CNAP));
            if (Phone.DEBUG_PHONE) {
                Rlog.d(LOG_TAG, "address = " + Rlog.pii(LOG_TAG, address) + " name = " + name +
                        " nump = " + nump + " namep = " + namep);
            }
                Rlog.d(LOG_TAG, "callId = " + getTelecomCallId() + " address = " + Rlog.pii(LOG_TAG,
                        address) + " name = " + name + " nump = " + nump + " namep = " + namep);
            }
            if (!mIsMergeInProcess) {
                // Only process changes to the name and address when a merge is not in process.
                // When call A initiated a merge with call B to form a conference C, there is a
                // point in time when the ImsCall transfers the conference call session into A,
                // at which point the ImsConferenceController creates the conference in Telecom.
                // For some carriers C will have a unique conference URI address.  Swapping the
                // conference session into A, which is about to be disconnected, to be logged to
                // the call log using the conference address.  To prevent this we suppress updates
                // to the call address while a merge is in process.
                if (!equalsBaseDialString(mAddress, address)) {
                    mAddress = address;
                    changed = true;
@@ -786,6 +799,7 @@ public class ImsPhoneConnection extends Connection implements
                    changed = true;
                }
            }
        }
        return changed;
    }

@@ -1172,4 +1186,20 @@ public class ImsPhoneConnection extends Connection implements

        return mImsVideoCallProviderWrapper.wasVideoPausedFromSource(source);
    }

    /**
     * Mark the call as in the process of being merged and inform the UI of the merge start.
     */
    public void handleMergeStart() {
        mIsMergeInProcess = true;
        onConnectionEvent(android.telecom.Connection.EVENT_MERGE_START, null);
    }

    /**
     * Mark the call as done merging and inform the UI of the merge start.
     */
    public void handleMergeComplete() {
        mIsMergeInProcess = false;
        onConnectionEvent(android.telecom.Connection.EVENT_MERGE_COMPLETE, null);
    }
}