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

Commit 3a3763bc authored by Muhammed Siju's avatar Muhammed Siju Committed by Gerrit - the friendly Code Review server
Browse files

IMS: Add support for sending ADD_PARTICIPANTS response to apps.

Applications pass Message callback object for ADD_PARTICIPANT
request. The corresponding success/failure response is sent back
to applications via the Message callback. Only the callback
object for latest request is cached, so it is the responsibility
of caller to wait for the response for previous request before
sending a new request.

Change-Id: Ia1d6fc4be1d0e1e7fdf938120f14c5966ceb3c35
CRs-Fixed: 757978
parent faa2bb34
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;
            }
        }
    };

    /**