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

Commit c8a0f994 authored by Basudev Achary Konderpu's avatar Basudev Achary Konderpu Committed by Steve Kondik
Browse files

IMS : Notifying CallModifyRequest Fail or sucess

1)Added new registrant to handle CallModifyRequest
  Fail or success.
2)Added Error codes.
3)This will ensure failed response to be propagated
  properly.

Change-Id: Ib5671d57e227e4e46bb548cb99703292eb6d4f6e
CRs-Fixed: 667503
parent e33fd4cc
Loading
Loading
Loading
Loading
+28 −0
Original line number Diff line number Diff line
@@ -85,6 +85,7 @@ public class CallManager {
    private static final int EVENT_POST_DIAL_CHARACTER = 119;
    private static final int EVENT_SUPP_SERVICE_NOTIFY = 120;
    private static final int EVENT_CALL_MODIFY = 121;
    private static final int EVENT_CALL_MODIFY_RESPONSE = 122;

    private static final String PROPERTY_QCHAT_ENABLED = "persist.atel.qchat_enabled";

@@ -188,6 +189,9 @@ public class CallManager {
    protected final RegistrantList mCallModifyRegistrants
    = new RegistrantList();

    protected final RegistrantList mModifyCallResponseRegistrants
    = new RegistrantList();

    protected CallManager() {
        mPhones = new ArrayList<Phone>();
        mRingingCalls = new ArrayList<Call>();
@@ -573,6 +577,8 @@ public class CallManager {
            phone.registerForEcmTimerReset(mHandler, EVENT_ECM_TIMER_RESET, null);
            try {
                phone.registerForModifyCallRequest(mHandler, EVENT_CALL_MODIFY, null);
                phone.registerForModifyCallResponse(
                      mHandler, EVENT_CALL_MODIFY_RESPONSE, null);
            } catch (CallStateException e) {
                Rlog.e(LOG_TAG, "registerForModifyCallRequest: CallStateException:" + e);
            }
@@ -624,6 +630,7 @@ public class CallManager {
            phone.unregisterForEcmTimerReset(mHandler);
            try {
                phone.unregisterForModifyCallRequest(mHandler);
                phone.unregisterForModifyCallResponse(mHandler);
            } catch (CallStateException e) {
                Rlog.e(LOG_TAG, "unregisterForModifyCallRequest ", e);
            }
@@ -1718,6 +1725,17 @@ public class CallManager {
        mCallModifyRegistrants.remove(h);
    }

    /*
     * Registrants for CallModify Failed or Succeed
     */
    public void registerForCallModifyResponse(Handler h, int what, Object obj) {
        mModifyCallResponseRegistrants.addUnique(h, what, obj);
    }

    public void unregisterForCallModifyResponse(Handler h) {
        mModifyCallResponseRegistrants.remove(h);
    }

    /* APIs to access foregroudCalls, backgroudCalls, and ringingCalls
     * 1. APIs to access list of calls
     * 2. APIs to check if any active call, which has connection other than
@@ -2093,6 +2111,16 @@ public class CallManager {
                        notifyMsg.sendToTarget();
                    }
                    break;
                 case EVENT_CALL_MODIFY_RESPONSE:
                    if (VDBG) Rlog.d(LOG_TAG, " handleMessage (EVENT_CALL_MODIFY_RESPONSE)");
                    AsyncResult res = (AsyncResult) msg.obj;
                    if (res != null && res.result != null && res.exception == null) {
                        mModifyCallResponseRegistrants.notifyRegistrants(new AsyncResult(null,
                                res.result, null));
                    } else {
                        Rlog.e(LOG_TAG, "EVENT_MODIFY_CALL_RESPONSE AsyncResult res= " + res);
                    }
                    break;
            }
        }
    }
+44 −0
Original line number Diff line number Diff line
@@ -32,8 +32,23 @@ public class CallModify {
    // Keep this error codes in sync with error codes defined in
    // imsIF.proto file.
    public static int E_SUCCESS = 0;
    public static int E_RADIO_NOT_AVAILABLE = 1;
    public static int E_GENERIC_FAILURE = 2;
    public static int E_REQUEST_NOT_SUPPORTED = 6;
    public static int E_CANCELLED = 7;
    public static int E_UNUSED = 16;
    public static int E_INVALID_PARAMETER = 27;
    public static int E_REJECTED_BY_REMOTE = 28;
    public static int E_IMS_DEREGISTERED = 29;

    private static final String ERR_RADIO_NOT_AVAILABLE = "E_RADIO_NOT_AVAILABLE";
    private static final String ERR_GENERIC_FAILURE = "E_GENERIC_FAILURE";
    private static final String ERR_REQUEST_NOT_SUPPORTED = "E_REQUEST_NOT_SUPPORTED";
    private static final String ERR_CANCELLED = "E_CANCELLED";
    private static final String ERR_UNUSED = "E_UNUSED";
    private static final String ERR_INVALID_PARAMETER = "E_INVALID_PARAMETER";
    private static final String ERR_REJECTED_BY_REMOTE = "E_REJECTED_BY_REMOTE";
    private static final String ERR_IMS_DEREGISTERED = "E_IMS_DEREGISTERED";

    public int call_index;

@@ -45,6 +60,12 @@ public class CallModify {
        this(new CallDetails(), 0);
    }

    public CallModify(CallModify callmodify) {
        setCallDetails(callmodify.call_details);
        call_index = callmodify.call_index;
        error = callmodify.error;
    }

    public CallModify(CallDetails callDetails, int callIndex) {
        this(callDetails, callIndex, E_SUCCESS);
    }
@@ -75,4 +96,27 @@ public class CallModify {
                + " " + call_details
                + " " + error);
    }

    /**
     * @return error ID
     */
    public int convertErrorTypeToInt(String errorType) {
        if (ERR_REJECTED_BY_REMOTE.equalsIgnoreCase(errorType)) {
            return E_REJECTED_BY_REMOTE;
        } else if (ERR_INVALID_PARAMETER.equalsIgnoreCase(errorType)) {
            return E_INVALID_PARAMETER;
        } else if (ERR_CANCELLED.equalsIgnoreCase(errorType)) {
            return E_CANCELLED;
        } else if (ERR_UNUSED.equalsIgnoreCase(errorType)) {
            return E_UNUSED;
        } else if (ERR_RADIO_NOT_AVAILABLE.equalsIgnoreCase(errorType)) {
            return E_RADIO_NOT_AVAILABLE;
        } else if (ERR_REQUEST_NOT_SUPPORTED.equalsIgnoreCase(errorType)) {
            return E_REQUEST_NOT_SUPPORTED;
        } else if (ERR_IMS_DEREGISTERED.equalsIgnoreCase(errorType)) {
            return E_IMS_DEREGISTERED;
        } else {
            return E_GENERIC_FAILURE;
        }
    }
}
+15 −0
Original line number Diff line number Diff line
@@ -1927,6 +1927,21 @@ public interface Phone {

    public void unregisterForModifyCallRequest(Handler h) throws CallStateException;

    /**
     * When both the party in an IMS Call wants to upgrade or downgrade a
     * call, a CallModifyRequest success or failure message is received.
     * This function registers for that indication and sends a message
     * to the handler when such an indication occurs.
     * @param h The handler that will receive the message
     * @param what The message to send
     * @param obj User object to send with the message
     * @throws CallStateException
     */
    public void registerForModifyCallResponse(Handler h, int what, Object obj)
            throws CallStateException;

    public void unregisterForModifyCallResponse(Handler h) throws CallStateException;

    /**
     * When upgrade to video call and remote party does not support AVPF, IMS
     * Phone retries upgrade request and this function registers for the failure
+14 −0
Original line number Diff line number Diff line
@@ -244,6 +244,9 @@ public abstract class PhoneBase extends Handler implements Phone {
    protected final RegistrantList mSimRecordsLoadedRegistrants
            = new RegistrantList();

    protected final RegistrantList mModifyCallResponseRegistrants
            = new RegistrantList();

    protected Looper mLooper; /* to insure registrants are in correct thread*/

    protected final Context mContext;
@@ -1601,6 +1604,12 @@ public abstract class PhoneBase extends Handler implements Phone {
                + this);
    }

    public void registerForModifyCallResponse(Handler h, int what, Object obj)
            throws CallStateException {
        throw new CallStateException(
                "registerForModifyCallResponse is not supported in this phone "  + this);
    }

    /*
     * To check VT call capability
     */
@@ -1613,6 +1622,11 @@ public abstract class PhoneBase extends Handler implements Phone {
                "unregisterForModifyCallRequest is not supported in this phone " + this);
    }

    public void unregisterForModifyCallResponse(Handler h) throws CallStateException {
        throw new CallStateException(
                "unregisterForModifyCallResponse is not supported in this phone " + this);
    }

    public void registerForAvpUpgradeFailure(Handler h, int what, Object obj)
            throws CallStateException {
        throw new CallStateException("registerForAvpUpgradeFailure is not supported in this phone "
+9 −0
Original line number Diff line number Diff line
@@ -1296,6 +1296,11 @@ public class PhoneProxy extends Handler implements Phone {
        mActivePhone.registerForModifyCallRequest(h, what, obj);
    }

    public void registerForModifyCallResponse(Handler h, int what, Object obj)
            throws CallStateException {
        mActivePhone.registerForModifyCallResponse(h, what, obj);
    }

    /*
     * To check VT call capability
     */
@@ -1307,6 +1312,10 @@ public class PhoneProxy extends Handler implements Phone {
        mActivePhone.unregisterForModifyCallRequest(h);
    }

    public void unregisterForModifyCallResponse(Handler h) throws CallStateException {
        mActivePhone.unregisterForModifyCallResponse(h);
    }

    public void registerForAvpUpgradeFailure(Handler h, int what, Object obj)
            throws CallStateException {
        mActivePhone.registerForAvpUpgradeFailure(h, what, obj);