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

Commit 40e6fb76 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "IMS: Add support for sending ADD_PARTICIPANTS response to apps."

parents faa2bb34 3a3763bc
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -897,6 +897,13 @@ public interface Phone {
     */
    public void addParticipant(String dialString) throws CallStateException;

    /**
     * Initiate to add a participant in an IMS call.
     *
     * @exception CallStateException operation is not supported.
     */
    public void addParticipant(String dialString, Message onComplete) throws CallStateException;

    /**
     * Handles PIN MMI commands (PIN/PIN2/PUK/PUK2), which are initiated
     * without SEND (so <code>dial</code> is not appropriate).
+6 −0
Original line number Diff line number Diff line
@@ -2138,4 +2138,10 @@ public abstract class PhoneBase extends Handler implements Phone {
        throw new CallStateException("addParticipant is not supported in this phone "
                + this);
    }

    @Override
    public void addParticipant(String dialString, Message onComplete) throws CallStateException {
        throw new CallStateException("addParticipant is not supported in this phone "
                + this);
    }
}
+5 −0
Original line number Diff line number Diff line
@@ -723,6 +723,11 @@ public class PhoneProxy extends Handler implements Phone {
        mActivePhone.addParticipant(dialString);
    }

    @Override
    public void addParticipant(String dialString, Message onComplete) throws CallStateException {
        mActivePhone.addParticipant(dialString, onComplete);
    }

    @Override
    public boolean handlePinMmi(String dialString) {
        return mActivePhone.handlePinMmi(dialString);
+6 −1
Original line number Diff line number Diff line
@@ -560,7 +560,12 @@ public class ImsPhone extends ImsPhoneBase {

    @Override
    public void addParticipant(String dialString) throws CallStateException {
        mCT.addParticipant(dialString);
        addParticipant(dialString, null);
    }

    @Override
    public void addParticipant(String dialString, Message onComplete) throws CallStateException {
        mCT.addParticipant(dialString, onComplete);
    }

    @Override
+47 −3
Original line number Diff line number Diff line
@@ -227,6 +227,9 @@ public final class ImsPhoneCallTracker extends CallTracker {
    private int mPendingCallVideoState;
    private boolean pendingCallInEcm = false;

    private Object mAddParticipantLock = new Object();
    private Message mAddPartResp;

    //***** Events


@@ -428,7 +431,8 @@ public final class ImsPhoneCallTracker extends CallTracker {
    }

    public void
    addParticipant(String dialString) throws CallStateException {
    addParticipant(String dialString, Message onComplete) throws CallStateException {
        boolean isSuccess = false;
        if (mForegroundCall != null) {
            ImsCall imsCall = mForegroundCall.getImsCall();
            if (imsCall == null) {
@@ -436,8 +440,12 @@ public final class ImsPhoneCallTracker extends CallTracker {
            } else {
                ImsCallSession imsCallSession = imsCall.getCallSession();
                if (imsCallSession != null) {
                    synchronized (mAddParticipantLock) {
                        mAddPartResp = onComplete;
                        String[] callees = new String[] { dialString };
                        imsCallSession.inviteParticipants(callees);
                        isSuccess = true;
                    }
                } else {
                    loge("addParticipant : ImsCallSession does not exist");
                }
@@ -445,6 +453,23 @@ public final class ImsPhoneCallTracker extends CallTracker {
        } else {
            loge("addParticipant : Foreground call does not exist");
        }
        if (!isSuccess && onComplete != null) {
            sendAddParticipantResponse(false, onComplete);
            mAddPartResp = null;
        }
    }

    private void sendAddParticipantResponse(boolean success, Message onComplete) {
        loge("sendAddParticipantResponse : success = " + success);
        if (onComplete == null) return;

        Exception ex = null;
        if (!success) {
            ex = new Exception("Add participant failed");
        }

        AsyncResult.forMessage(onComplete, null, ex);
        onComplete.sendToTarget();
    }

    private void handleEcmTimer(int action) {
@@ -1350,6 +1375,25 @@ public final class ImsPhoneCallTracker extends CallTracker {
                conn.updateConferenceParticipants(participants);
            }
        }

        @Override
        public void onCallInviteParticipantsRequestDelivered(ImsCall call) {
            if (DBG) log("invite participants delivered");
            synchronized(mAddParticipantLock) {
                sendAddParticipantResponse(true, mAddPartResp);
                mAddPartResp = null;
            }
        }

        @Override
        public void onCallInviteParticipantsRequestFailed(ImsCall call,
                ImsReasonInfo reasonInfo) {
            if (DBG) log("invite participants failed.");
            synchronized(mAddParticipantLock) {
                sendAddParticipantResponse(false, mAddPartResp);
                mAddPartResp = null;
            }
        }
    };

    /**