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

Commit 1601772b authored by Tyler Gunn's avatar Tyler Gunn Committed by Android (Google) Code Review
Browse files

Merge "Fixing conference merge where only one party is added to conference." into lmp-mr1-dev

parents e70617d8 fd230563
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.