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

Commit 3378b132 authored by Anju Mathapati's avatar Anju Mathapati Committed by Linux Build Service Account
Browse files

Telephony: IMS changes for VoLTE and VT.

- Additional APIs in CallManager for IMS calls

- Use ImsPhone for IMS specific API calls

- CallManager handles both CS & PS calls

- Add hold, switching and conference capabilities for IMS calls

- VT: Add getCallType api to Phone interface

- Add API to check VT call modify capability

- VT: Add addional call types for VT TX and VT RX

- IMS Conference URI update Call Details

- Supplementary Service Notification support for IMS

- Add ECBM support for ImsPhone

- Expose method to get index of connection

- Add getPhoneInCall utility in CallManager

Change-Id: Iefbe7a8c1ea1f3f45d9fbbd555fe184b170eb242
(cherry picked from commit ff1c808da67f4aa213ef0b0942763830a4eea83a)
(cherry picked from commit ba31037789535ef8ddffe87fcce1f29ded694048)
parent faa3aff6
Loading
Loading
Loading
Loading
+104 −4
Original line number Diff line number Diff line
/*
 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
 * Not a Contribution, Apache license notifications and license are retained
 * for attribution purposes only.
 *
 * Copyright (C) 2010 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
@@ -234,6 +238,14 @@ public final class CallManager {
        return SystemProperties.getBoolean(TelephonyProperties.PROPERTY_CSVT_ENABLED, false);
    }

    /**
     * Returns true if Android supports VoLTE/VT calls on IMS
     */
    public static boolean isCallOnImsEnabled() {
        return SystemProperties.getBoolean(
                TelephonyProperties.CALLS_ON_IMS_ENABLED_PROPERTY, false);
    }

    /**
     * Returns all the registered phone objects.
     * @return all the registered phone objects.
@@ -381,6 +393,22 @@ public final class CallManager {
        return getFirstActiveRingingCall().getPhone();
    }

    /**
     * @return the phone associated with any call
     */
    public Phone getPhoneInCall() {
        Phone phone = null;
        if (!getFirstActiveRingingCall().isIdle()) {
            phone = getFirstActiveRingingCall().getPhone();
        } else if (!getActiveFgCall().isIdle()) {
            phone = getActiveFgCall().getPhone();
        } else {
            // If BG call is idle, we return default phone
            phone = getFirstActiveBgCall().getPhone();
        }
        return phone;
    }

    public void setAudioMode() {
        Context context = getContext();
        if (context == null) return;
@@ -464,7 +492,8 @@ public final class CallManager {
        phone.registerForMmiComplete(mHandler, EVENT_MMI_COMPLETE, null);
        phone.registerForSuppServiceFailed(mHandler, EVENT_SUPP_SERVICE_FAILED, null);
        phone.registerForServiceStateChanged(mHandler, EVENT_SERVICE_STATE_CHANGED, null);
        if (phone.getPhoneType() == PhoneConstants.PHONE_TYPE_GSM) {
        if (phone.getPhoneType() == PhoneConstants.PHONE_TYPE_GSM ||
                phone.getPhoneType() == PhoneConstants.PHONE_TYPE_IMS) {
            phone.registerForSuppServiceNotification(mHandler, EVENT_SUPP_SERVICE_NOTIFY, null);
        }

@@ -481,6 +510,10 @@ public final class CallManager {
            phone.registerForCallWaiting(mHandler, EVENT_CALL_WAITING, null);
            phone.registerForEcmTimerReset(mHandler, EVENT_ECM_TIMER_RESET, null);
        }

        if (phone.getPhoneType() == PhoneConstants.PHONE_TYPE_IMS) {
            phone.registerForEcmTimerReset(mHandler, EVENT_ECM_TIMER_RESET, null);
        }
    }

    private void unregisterForPhoneStates(Phone phone) {
@@ -499,7 +532,8 @@ public final class CallManager {
        phone.unregisterForMmiInitiate(mHandler);
        phone.unregisterForMmiComplete(mHandler);
        phone.unregisterForSuppServiceFailed(mHandler);
        if (phone.getPhoneType() == PhoneConstants.PHONE_TYPE_GSM) {
        if (phone.getPhoneType() == PhoneConstants.PHONE_TYPE_GSM ||
                phone.getPhoneType() == PhoneConstants.PHONE_TYPE_IMS) {
            phone.unregisterForSuppServiceNotification(mHandler);
        }
        phone.unregisterForServiceStateChanged(mHandler);
@@ -517,6 +551,10 @@ public final class CallManager {
            phone.unregisterForCallWaiting(mHandler);
            phone.unregisterForEcmTimerReset(mHandler);
        }

        if (phone.getPhoneType() == PhoneConstants.PHONE_TYPE_IMS) {
            phone.unregisterForEcmTimerReset(mHandler);
        }
    }

    /**
@@ -533,9 +571,28 @@ public final 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());
        }
@@ -575,9 +632,14 @@ public final 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());
        }
@@ -758,6 +820,26 @@ public final class CallManager {
     * handled asynchronously.
     */
    public Connection dial(Phone phone, String dialString) throws CallStateException {
        return dial(phone, dialString, Phone.CALL_TYPE_VOICE, null);
    }

    /**
     * Initiate a new connection. This happens asynchronously, so you cannot
     * assume the audio path is connected (or a call index has been assigned)
     * until PhoneStateChanged notification has occurred.
     *
     * @exception CallStateException if a new outgoing call is not currently
     *                possible because no more call slots exist or a call exists
     *                that is dialing, alerting, ringing, or waiting. Other
     *                errors are handled asynchronously.
     * @param phone The phone to use to place the call
     * @param dialString The phone number or URI that identifies the remote
     *            party
     * @param calldetails
     */
    public Connection dial(Phone phone, String dialString, int callType, String[] extras)
            throws CallStateException {

        Phone basePhone = getPhoneBase(phone);
        Connection result;

@@ -789,7 +871,11 @@ public final class CallManager {
            }
        }

        if (phone.getPhoneType() == PhoneConstants.PHONE_TYPE_IMS) {
            result = basePhone.dial(dialString, callType, extras);
        } else {
            result = basePhone.dial(dialString);
        }

        if (VDBG) {
            Rlog.d(LOG_TAG, "End dial(" + basePhone + ", "+ dialString + ")");
@@ -1766,6 +1852,20 @@ public final class CallManager {
        return false;
    }

    /**
     * @return true if the IMS phone has any active calls. ie. there are active
     *         IMS calls at present
     */
    public boolean isImsPhoneActive() {
        for (Phone phone : mPhones) {
            if (phone.getPhoneType() == PhoneConstants.PHONE_TYPE_IMS
                    && phone.getState() != PhoneConstants.State.IDLE) {
                return true;
            }
        }
        return false;
    }

    private Handler mHandler = new Handler() {

        @Override
+11 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.internal.telephony;

import android.telephony.Rlog;
import android.util.Log;
import com.android.internal.telephony.CallStateException;

/**
 * {@hide}
@@ -296,6 +297,16 @@ public abstract class Connection {
     */
    public abstract UUSInfo getUUSInfo();

    /**
     * Gets connection index associated with connection.
     * @return index or exception if unavailable or phone
     * does not support this API
     */

    public int getIndex() throws CallStateException {
        throw new CallStateException("Connection index not assigned");
    }

    /**
     * Build a human representation of a connection instance, suitable for debugging.
     * Don't log personal stuff unless in debug mode.
+1 −2
Original line number Diff line number Diff line
@@ -36,8 +36,7 @@ public class DefaultPhoneNotifier implements PhoneNotifier {

    private ITelephonyRegistry mRegistry;

    /*package*/
    DefaultPhoneNotifier() {
    protected DefaultPhoneNotifier() {
        mRegistry = ITelephonyRegistry.Stub.asInterface(ServiceManager.getService(
                    "telephony.registry"));
    }
+105 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2012-13, The Linux Foundation. All rights reserved.
 * Not a Contribution, Apache license notifications and license are retained
 * for attribution purposes only.
 *
 * Copyright (C) 2007 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
@@ -182,6 +186,67 @@ public interface Phone {
    public static final int CDMA_OTA_PROVISION_STATUS_OTAPA_STOPPED = 10;
    public static final int CDMA_OTA_PROVISION_STATUS_OTAPA_ABORTED = 11;

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

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

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

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

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

    public static final int CALL_TYPE_VT_NODIR = 4; /*
                                                     * 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_UNKNOWN = 10; /*
                                                     * 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_CS = 1; /*
                                                 * Circuit switched domain
                                                 */
    public static final int CALL_DOMAIN_PS = 2; /*
                                                 * Packet switched domain
                                                 */
    public static final int CALL_DOMAIN_AUTOMATIC = 3; /*
                                                        * 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; /*
                                                      * Init value used
                                                      * internally by telephony
                                                      * until domain is set
                                                      */

    public static final String EXTRAS_IS_CONFERENCE_URI = "isConferenceUri";

    /**
     * Get the current ServiceState. Use
@@ -631,6 +696,32 @@ public interface Phone {
     */
    void acceptCall() throws CallStateException;

    /**
     * Answers a ringing or waiting call. Active calls, if any, go on hold.
     * Answering occurs asynchronously, and final notification occurs via
     * {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
     * java.lang.Object) registerForPreciseCallStateChanged()}.
     *
     * @exception CallStateException when no call is ringing or waiting
     */
    void acceptCall(int callType) throws CallStateException;

    /**
     * Gets call type for IMS calls.
     *
     * @return one of the call types in {@link Phone}
     * @throws CallStateException
     */
    int getCallType(Call call) throws CallStateException;

    /**
     * Gets call domain for IMS calls.
     *
     * @return one of the call domains in {@link Phone}
     * @throws CallStateException
     */
    int getCallDomain(Call call) throws CallStateException;

    /**
     * Reject (ignore) a ringing call. In GSM, this means UDUB
     * (User Determined User Busy). Reject occurs asynchronously,
@@ -791,6 +882,20 @@ public interface Phone {
     */
    Connection dial(String dialString, UUSInfo uusInfo) throws CallStateException;

    /**
     * Initiate a new voice connection with call type and extras for IMS calls.
     * This happens asynchronously, so you cannot assume the audio path is
     * connected (or a call index has been assigned) until PhoneStateChanged
     * notification has occurred.
     *
     * @exception CallStateException if a new outgoing call is not currently
     *                possible because no more call slots exist or a call exists
     *                that is dialing, alerting, ringing, or waiting. Other
     *                errors are handled asynchronously.
     */
    public Connection dial(String dialString, int callType, String[] extras)
            throws CallStateException;

    /**
     * Handles PIN MMI commands (PIN/PIN2/PUK/PUK2), which are initiated
     * without SEND (so <code>dial</code> is not appropriate).
+25 −2
Original line number Diff line number Diff line
/*
 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
 * Not a Contribution.
 * Copyright (c) 2012-13, The Linux Foundation. All rights reserved.
 * Not a Contribution, Apache license notifications and license are retained
 * for attribution purposes only.
 *
 * Copyright (C) 2007 The Android Open Source Project
 *
@@ -217,6 +218,9 @@ public abstract class PhoneBase extends Handler implements Phone {
    protected final RegistrantList mSuppServiceFailedRegistrants
            = new RegistrantList();

    protected final RegistrantList mCallModifyRegistrants
            = new RegistrantList();

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

    protected final Context mContext;
@@ -1475,4 +1479,23 @@ public abstract class PhoneBase extends Handler implements Phone {
    public boolean isRadioOn() {
        return mCi.getRadioState().isOn();
    }
    // IMS APIs - Implemented only in ImsPhone
    public void acceptCall(int callType) throws CallStateException {
        throw new CallStateException("Accept with CallType is not supported in this phone " + this);
    }

    public int getCallType(Call call) throws CallStateException {
        throw new CallStateException("getCallType is not supported in this phone " + this);
    }

    public int getCallDomain(Call call) throws CallStateException {
        throw new CallStateException("getCallDomain is not supported in this phone " + this);
    }

    public Connection dial(String dialString, int CallType, String[] extras)
            throws CallStateException {
        throw new CallStateException("Dial with CallDetails is not supported in this phone "
                + this);
    }

}
Loading