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

Commit fd230563 authored by Tyler Gunn's avatar Tyler Gunn
Browse files

Fixing conference merge where only one party is added to conference.

- added "swap calls" flag to the onCallMerged listener.  This is used
to indicate that the fg/bg calls need to be swapped after the merge.
- changed how we get the connect time for the conference.  This is now
stored when a conference merge is started (required because of the delaying
of merge complete; one of the calls is already non-existent at the time
we want to get the connect time).


Bug: 18960042
Change-Id: Icc4b60756d333373fe181612824b0c13c076408b
parent 20baf033
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -220,12 +220,15 @@ public class ImsPhoneCall extends Call {
    /* package */ void
    merge(ImsPhoneCall that, State state) {
        // This call is the conference host and the "that" call is the one being merged in.
        // Set the connect time to the earliest of this call and the other call.
        // This ensures that when an ImsConference is started, its start time will be when the first
        // call in the conference started.
        long earliestConnectTime = Math.min(getEarliestConnectTime(),
                that.getEarliestConnectTime());
        getFirstConnection().setConnectTime(earliestConnectTime);
        // Set the connect time for the conference; this will have been determined when the
        // conference was initially created.
        ImsPhoneConnection imsPhoneConnection = getFirstConnection();
        if (imsPhoneConnection != null) {
            long conferenceConnectTime = imsPhoneConnection.getConferenceConnectTime();
            if (conferenceConnectTime > 0) {
                imsPhoneConnection.setConnectTime(conferenceConnectTime);
            }
        }

        ImsPhoneConnection[] cc = that.mConnections.toArray(
                new ImsPhoneConnection[that.mConnections.size()]);
+19 −1
Original line number Diff line number Diff line
@@ -527,6 +527,15 @@ public final class ImsPhoneCallTracker extends CallTracker {
            return;
        }

        // Keep track of the connect time of the earliest call so that it can be set on the
        // {@code ImsConference} when it is created.
        long conferenceConnectTime = Math.min(mForegroundCall.getEarliestConnectTime(),
                mBackgroundCall.getEarliestConnectTime());
        ImsPhoneConnection foregroundConnection = mForegroundCall.getFirstConnection();
        if (foregroundConnection != null) {
            foregroundConnection.setConferenceConnectTime(conferenceConnectTime);
        }

        try {
            fgImsCall.merge(bgImsCall);
        } catch (ImsException e) {
@@ -1151,10 +1160,19 @@ public final class ImsPhoneCallTracker extends CallTracker {
        }

        @Override
        public void onCallMerged(ImsCall call) {
        public void onCallMerged(ImsCall call, boolean swapCalls) {
            if (DBG) log("onCallMerged");

            mForegroundCall.merge(mBackgroundCall, mForegroundCall.getState());
            if (swapCalls) {
                try {
                    switchWaitingOrHoldingAndActive();
                } catch (CallStateException e) {
                    if (Phone.DEBUG_PHONE) {
                        loge("Failed swap fg and bg calls on merge exception=" + e);
                    }
                }
            }
            updatePhoneState();
            mPhone.notifyPreciseCallStateChanged();
        }
+20 −0
Original line number Diff line number Diff line
@@ -77,6 +77,9 @@ public class ImsPhoneConnection extends Connection {

    private PowerManager.WakeLock mPartialWakeLock;

    // The cached connect time of the connection when it turns into a conference.
    private long mConferenceConnectTime = 0;

    //***** Event Constants
    private static final int EVENT_DTMF_DONE = 1;
    private static final int EVENT_PAUSE_DONE = 2;
@@ -598,6 +601,23 @@ public class ImsPhoneConnection extends Connection {
        }
    }

    /**
     * Sets the conference connect time.  Used when an {@code ImsConference} is created to out of
     * this phone connection.
     *
     * @param conferenceConnectTime The conference connect time.
     */
    public void setConferenceConnectTime(long conferenceConnectTime) {
        mConferenceConnectTime = conferenceConnectTime;
    }

    /**
     * @return The conference connect time.
     */
    public long getConferenceConnectTime() {
        return mConferenceConnectTime;
    }

    /**
     * Check for a change in the video capabilities and audio quality for the {@link ImsCall}, and
     * update the {@link ImsPhoneConnection} with this information.