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

Commit 4a1db1d7 authored by Pavan Kumar Tatavarthi's avatar Pavan Kumar Tatavarthi Committed by c_tpavan
Browse files

IMS support for UI interface

1. UI support for conference call participant display and
   hangup, conference uri, add participant, voice to video
   upgrade downgrade, audio video profile
2. Added ims related data types to Call object
3. Added ims related APIs to CallCommandService and CallHandler
   service

Change-Id: Ie3720cde167a1cf2be350f24da126517c0b2e0f0
parent 1cf1ce40
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -45,6 +45,8 @@ public abstract class Call {
        }
    }

    public boolean isMpty = false;
    private String[] mConfUriList;

    /* Instance Variables */

@@ -146,6 +148,14 @@ public abstract class Call {
        return earliest;
    }

    public String[] getConfUriList() {
        return mConfUriList;
    }

    public void setConfUriList(String[] urilist) {
        mConfUriList = urilist;
    }

    public long
    getEarliestCreateTime() {
        List<Connection> l;
+260 −0
Original line number Diff line number Diff line
/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 *  * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *  * Redistributions in binary form must reproduce the above
 *       copyright notice, this list of conditions and the following
 *       disclaimer in the documentation and/or other materials provided
 *       with the distribution.
 *  * Neither the name of The Linux Foundation nor the names of its
 *       contributors may be used to endorse or promote products derived
 *       from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES O
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package com.android.internal.telephony;

import java.util.Map;
import java.util.Map.Entry;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * CallDetails class takes care of all the additional details like call type and
 * domain needed for IMS calls. This class is not relevant for non-IMS calls
 */
public class CallDetails {

    /*
     * Type of the call based on the media type and the direction of the media.
     */

    public static final int CALL_TYPE_VOICE = 0; /*
                                                  * Phone.CALL_TYPE_VOICE /*
                                                  * Voice call-audio in both
                                                  * directions
                                                  */

    public static final int CALL_TYPE_VT_TX = 1; /*
                                                  * Phone.CALL_TYPE_VT_TX; PS
                                                  * Video telephony call: one
                                                  * way TX video, two way audio
                                                  */

    public static final int CALL_TYPE_VT_RX = 2; /*
                                                  * Phone.CALL_TYPE_VT_RX Video
                                                  * telephony call: one way RX
                                                  * video, two way audio
                                                  */

    public static final int CALL_TYPE_VT = 3; /*
                                               * Phone.CALL_TYPE_VT; Video
                                               * telephony call: two way video,
                                               * two way audio
                                               */

    public static final int CALL_TYPE_VT_NODIR = 4; /*
                                                     * Phone.CALL_TYPE_VT_NODIR;
                                                     * Video telephony call: no
                                                     * direction, two way audio,
                                                     * intermediate state in a
                                                     * video call till video
                                                     * link is setup
                                                     */

    public static final int CALL_TYPE_SMS = 5; /*
                                                * Phone.CALL_TYPE_SMS;SMS Type
                                                */

    public static final int CALL_TYPE_UNKNOWN = 10; /*
                                                     * Phone.CALL_TYPE_UNKNOWN;
                                                     * Unknown Call type, may be
                                                     * used for answering call
                                                     * with same call type as
                                                     * incoming call. This is
                                                     * only for telephony, not
                                                     * meant to be passed to RIL
                                                     */

    public static final int CALL_DOMAIN_UNKNOWN = 11; /*
                                                       * Phone.CALL_DOMAIN_UNKNOWN
                                                       * ; Unknown domain. Sent
                                                       * by RIL when modem has
                                                       * not yet selected a
                                                       * domain for a call
                                                       */
    public static final int CALL_DOMAIN_CS = 1; /*
                                                 * Phone.CALL_DOMAIN_CS; Circuit
                                                 * switched domain
                                                 */
    public static final int CALL_DOMAIN_PS = 2; /*
                                                 * Phone.CALL_DOMAIN_PS; Packet
                                                 * switched domain
                                                 */
    public static final int CALL_DOMAIN_AUTOMATIC = 3; /*
                                                        * Phone.
                                                        * CALL_DOMAIN_AUTOMATIC;
                                                        * Automatic domain. Sent
                                                        * by Android to indicate
                                                        * that the domain for a
                                                        * new call should be
                                                        * selected by modem
                                                        */
    public static final int CALL_DOMAIN_NOT_SET = 4; /*
                                                      * Phone.CALL_DOMAIN_NOT_SET
                                                      * ; Init value used
                                                      * internally by telephony
                                                      * until domain is set
                                                      */

    public static final int CALL_RESTRICT_CAUSE_NONE = 0; /*
                                                           * Default cause, not
                                                           * restricted
                                                           */
    public static final int CALL_RESTRICT_CAUSE_RAT = 1; /*
                                                          * Service not
                                                          * supported by RAT
                                                          */
    public static final int CALL_RESTRICT_CAUSE_DISABLED = 2; /*
                                                               * Service
                                                               * disabled
                                                               */

    public static final String EXTRAS_IS_CONFERENCE_URI = "isConferenceUri";
    public static final String EXTRAS_PARENT_CALL_ID = "parentCallId";

    public int call_type;
    public int call_domain;
    public String[] extras;

    public static class ServiceStatus {
        public boolean isValid;
        public int type;
        public int status;
        public byte[] userdata;
        public int restrictCause;

        public ServiceStatus() {
            this.isValid = false;
        }
    }

    public ServiceStatus[] localAbility;
    public ServiceStatus[] peerAbility;

    public CallDetails() {
        call_type = CALL_TYPE_UNKNOWN;
        call_domain = CALL_DOMAIN_NOT_SET;
        extras = null;
    }

    public CallDetails(int callType, int callDomain, String[] extraparams) {
        call_type = callType;
        call_domain = callDomain;
        extras = extraparams;
    }

    public CallDetails(CallDetails srcCall) {
        if (srcCall != null) {
            call_type = srcCall.call_type;
            call_domain = srcCall.call_domain;
            extras = srcCall.extras;
            localAbility = srcCall.localAbility;
            peerAbility = srcCall.peerAbility;
        }
    }

    public void setExtras(String[] extraparams) {
        extras = extraparams;
    }

    public static String[] getExtrasFromMap(Map<String, String> newExtras) {
        String[] extras = null;

        if (newExtras == null) {
            return null;
        }

        // TODO: Merge new extras into extras. For now, just serialize and set
        // them
        extras = new String[newExtras.size()];

        if (extras != null) {
            int i = 0;
            for (Entry<String, String> entry : newExtras.entrySet()) {
                extras[i] = "" + entry.getKey() + "=" + entry.getValue();
            }
        }
        return extras;
    }

    public void setExtrasFromMap(Map<String, String> newExtras) {
        this.extras = getExtrasFromMap(newExtras);
    }

    public String getValueForKeyFromExtras(String[] extras, String key) {
        for (int i = 0; extras != null && i < extras.length; i++) {
            if (extras[i] != null) {
                String[] currKey = extras[i].split("=");
                if (currKey.length == 2 && currKey[0].equals(key)) {
                    return currKey[1];
                }
            }
        }
        return null;
    }

    /**
     * @return string representation.
     */
    @Override
    public String toString() {
        String extrasResult = "", localSrvAbility = "", peerSrvAbility = "";
        if (extras != null) {
            for (String s : extras) {
                extrasResult += s;
            }
        }

        if (localAbility != null) {
            for (ServiceStatus srv : localAbility) {
                if (srv != null) {
                    localSrvAbility += "isValid = " + srv.isValid + " type = "
                            + srv.type + " status = " + srv.status + " restrictCause = "
                            + srv.restrictCause;
                }
            }
        }

        if (peerAbility != null) {
            for (ServiceStatus srv : peerAbility) {
                if (srv != null) {
                    peerSrvAbility += "isValid = " + srv.isValid + " type = "
                            + srv.type + " status = " + srv.status + " restrictCause = "
                            + srv.restrictCause;
                }
            }
        }

        return (" " + call_type
                + " " + call_domain
                + " " + extrasResult
                + " Local Ability " + localSrvAbility
                + " Peer Ability " + peerSrvAbility);
    }
}
+0 −25
Original line number Diff line number Diff line
@@ -610,28 +610,8 @@ public class CallManager {
     * @exception CallStateException when call is not ringing or waiting
     */
    public void acceptCall(Call ringingCall) throws CallStateException {
        acceptCall(ringingCall, Phone.CALL_TYPE_VOICE);
    }

    /**
     * Answers a ringing or waiting call, with an option to downgrade a Video
     * call Active call, if any, go on hold. If active call can't be held, i.e.,
     * a background call of the same channel exists, the active call will be
     * hang up. Answering occurs asynchronously, and final notification occurs
     * via
     * {@link #registerForPreciseCallStateChanged(android.os.Handler, int, java.lang.Object)
     * registerForPreciseCallStateChanged()}.
     *
     * @param ringingCall The call to answer
     * @param callType The call type to use to answer the call. Values from
     *            Phone.RIL_CALL_TYPE
     * @exception CallStateException when call is not ringing or waiting
     */
    public void acceptCall(Call ringingCall, int callType) throws CallStateException {
        Phone ringingPhone = ringingCall.getPhone();

        if (VDBG) {
            Rlog.d(LOG_TAG, "acceptCall api with calltype " + callType);
            Rlog.d(LOG_TAG, "acceptCall(" +ringingCall + " from " + ringingCall.getPhone() + ")");
            Rlog.d(LOG_TAG, toString());
        }
@@ -671,14 +651,9 @@ public class CallManager {
            }
        }

        if (ringingPhone.getPhoneType() == PhoneConstants.PHONE_TYPE_IMS) {
            ringingPhone.acceptCall(callType);
        } else {
            ringingPhone.acceptCall();
        }

        if (VDBG) {
            Rlog.d(LOG_TAG, "Call type in acceptCall " + callType);
            Rlog.d(LOG_TAG, "End acceptCall(" +ringingCall + ")");
            Rlog.d(LOG_TAG, toString());
        }
+78 −0
Original line number Diff line number Diff line
/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 *  * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *  * Redistributions in binary form must reproduce the above
 *       copyright notice, this list of conditions and the following
 *       disclaimer in the documentation and/or other materials provided
 *       with the distribution.
 *  * Neither the name of The Linux Foundation nor the names of its
 *       contributors may be used to endorse or promote products derived
 *       from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES O
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package com.android.internal.telephony;

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_CANCELLED = 7;
    public static int E_UNUSED = 16;

    public int call_index;

    public CallDetails call_details;

    public int error;

    public CallModify() {
        this(new CallDetails(), 0);
    }

    public CallModify(CallDetails callDetails, int callIndex) {
        this(callDetails, callIndex, E_SUCCESS);
    }

    public CallModify(CallDetails callDetails, int callIndex, int err) {
        call_details = callDetails;
        call_index = callIndex;
        error = err;
    }

    public void setCallDetails(CallDetails calldetails) {
        call_details = new CallDetails(calldetails);
    }

    /**
     * @return true if the message is sent to notify about the error.
     */
    public boolean error() {
        return this.error != E_UNUSED && this.error != E_SUCCESS;
    }

    /**
     * @return string representation.
     */
    @Override
    public String toString() {
        return (" " + call_index
                + " " + call_details
                + " " + error);
    }
}
+33 −2
Original line number Diff line number Diff line
@@ -29,6 +29,11 @@ public abstract class Connection {
    protected String mCnapName;
    protected int mCnapNamePresentation  = PhoneConstants.PRESENTATION_ALLOWED;

    public CallDetails callDetails = new CallDetails();
    public CallModify callModifyRequest = new CallModify();
    public String errorInfo;


    private static String LOG_TAG = "Connection";

    public enum DisconnectCause {
@@ -71,7 +76,9 @@ public abstract class Connection {
        CDMA_PREEMPTED,
        CDMA_NOT_EMERGENCY,              /* not an emergency call */
        CDMA_ACCESS_BLOCKED,            /* Access Blocked by CDMA network */
        ERROR_UNSPECIFIED
        ERROR_UNSPECIFIED,
        /* Ims Disconnect cause grouped from here */
        CALL_FAIL_MISC
    }

    Object mUserData;
@@ -119,6 +126,30 @@ public abstract class Connection {
        return mCnapNamePresentation;
    }

    public CallDetails getCallDetails() {
        return callDetails;
    }

    public CallModify getCallModify() {
        return callModifyRequest;
    }

    public String getErrorInfo() {
        return errorInfo;
    }

    public void setConnectionDetails(CallDetails ConnDetails) {
        callDetails = ConnDetails;
    }

    public void setModifyConnectionDetails(CallModify modifyConn) {
        callModifyRequest = modifyConn;
    }

    public void setErrorInfo(String errorInfo) {
        errorInfo = errorInfo;
    }

    /**
     * @return Call that owns this Connection, or null if none
     */
Loading