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

Commit 1cc844a3 authored by Hunsuk Choi's avatar Hunsuk Choi
Browse files

Notifies the IMS traffic activities to modem

Bug: 219242095
Test: atest CtsTelephonyTestCases:MmTelFeatureTestOnMockModem

Change-Id: I8dc3778e7fd84e349a70b6691ae101eddd9eab17
parent 430e92f2
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ import android.telephony.data.NetworkSliceInfo;
import android.telephony.data.TrafficDescriptor;
import android.telephony.emergency.EmergencyNumber;
import android.telephony.ims.RegistrationManager;
import android.telephony.ims.feature.MmTelFeature;
import android.telephony.ims.stub.ImsRegistrationImplBase;

import com.android.internal.telephony.cdma.CdmaSmsBroadcastConfigInfo;
@@ -2783,7 +2784,7 @@ public interface CommandsInterface {
     public void unregisterForSimPhonebookRecordsReceived(Handler h);

    /**
     * Registers for notifications when connection setup fails.
     * Registers for notifications of connection setup failure.
     *
     * @param h Handler for notification message.
     * @param what User-defined message code.
@@ -2792,7 +2793,7 @@ public interface CommandsInterface {
    default void registerForConnectionSetupFailure(Handler h, int what, Object obj) {}

    /**
     * Unregisters for notifications when connection setup fails.
     * Unregisters for notifications of connection setup failure.
     *
     * @param h Handler to be removed from the registrant list.
     */
@@ -2928,9 +2929,13 @@ public interface CommandsInterface {
     * @param token A nonce to identify the request.
     * @param trafficType IMS traffic type like registration, voice, video, SMS, emergency, and etc.
     * @param accessNetworkType The type of underlying radio access network used.
     * @param trafficDirection Indicates whether traffic is originated by mobile originated or
     *        mobile terminated use case eg. MO/MT call/SMS etc.
     */
    default void startImsTraffic(int token, int trafficType,
    default void startImsTraffic(int token,
            @MmTelFeature.ImsTrafficType int trafficType,
            @AccessNetworkConstants.RadioAccessNetworkType int accessNetworkType,
            @MmTelFeature.ImsTrafficDirection int trafficDirection,
            Message result) {}

    /**
+4 −6
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import static com.android.internal.telephony.RILConstants.RIL_UNSOL_TRIGGER_IMS_

import android.hardware.radio.ims.IRadioImsIndication;
import android.os.AsyncResult;
import android.telephony.ims.feature.ConnectionFailureInfo;

/**
 * Interface declaring unsolicited radio indications for IMS APIs.
@@ -57,14 +58,11 @@ public class ImsIndication extends IRadioImsIndication.Stub {
            android.hardware.radio.ims.ConnectionFailureInfo failureInfo) {
        mRil.processIndication(HAL_SERVICE_IMS, indicationType);

        int[] info = new int[3];
        info[0] = failureInfo.failureReason;
        info[1] = failureInfo.causeCode;
        info[2] = failureInfo.waitTimeMillis;

        Object[] response = new Object[2];
        response[0] = token;
        response[1] = info;
        response[1] = new ConnectionFailureInfo(
                RILUtils.convertHalConnectionFailureReason(failureInfo.failureReason),
                failureInfo.causeCode, failureInfo.waitTimeMillis);

        if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_CONNECTION_SETUP_FAILURE, response);

+6 −8
Original line number Diff line number Diff line
@@ -17,10 +17,12 @@
package com.android.internal.telephony;

import static android.telephony.TelephonyManager.HAL_SERVICE_IMS;
import static android.telephony.ims.feature.MmTelFeature.ImsTrafficSessionCallbackWrapper.INVALID_TOKEN;

import android.hardware.radio.RadioError;
import android.hardware.radio.RadioResponseInfo;
import android.hardware.radio.ims.IRadioImsResponse;
import android.telephony.ims.feature.ConnectionFailureInfo;

/**
 * Interface declaring response functions to solicited radio requests for IMS APIs.
@@ -65,17 +67,13 @@ public class ImsResponse extends IRadioImsResponse.Stub {
        RILRequest rr = mRil.processResponse(HAL_SERVICE_IMS, responseInfo);

        if (rr != null) {
            Object[] response = { "", null };

            Object[] response = { new Integer(INVALID_TOKEN), null };
            if (responseInfo.error == RadioError.NONE) {
                if (failureInfo != null) {
                    int[] info = new int[3];
                    info[0] = failureInfo.failureReason;
                    info[1] = failureInfo.causeCode;
                    info[2] = failureInfo.waitTimeMillis;
                    response[1] = info;
                    response[1] = new ConnectionFailureInfo(
                            RILUtils.convertHalConnectionFailureReason(failureInfo.failureReason),
                            failureInfo.causeCode, failureInfo.waitTimeMillis);
                }

                RadioResponse.sendMessageResponse(rr.mResult, response);
            }
            mRil.processResponseDone(rr, responseInfo, response);
+47 −0
Original line number Diff line number Diff line
@@ -4925,6 +4925,53 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
    public void setTerminalBasedCallWaitingSupported(boolean supported) {
    }

    /**
     * Notifies the NAS and RRC layers of the radio the type of upcoming IMS traffic.
     *
     * @param token A nonce to identify the request.
     * @param trafficType IMS traffic type like registration, voice, video, SMS, emergency, and etc.
     * @param accessNetworkType The type of the radio access network used.
     * @param trafficDirection Indicates whether traffic is originated by mobile originated or
     *        mobile terminated use case eg. MO/MT call/SMS etc.
     * @param response is callback message.
     */
    public void startImsTraffic(int token,
            @MmTelFeature.ImsTrafficType int trafficType,
            @AccessNetworkConstants.RadioAccessNetworkType int accessNetworkType,
            @MmTelFeature.ImsTrafficDirection int trafficDirection, Message response) {
        mCi.startImsTraffic(token, trafficType, accessNetworkType, trafficDirection, response);
    }

    /**
     * Notifies IMS traffic has been stopped.
     *
     * @param token The token assigned by startImsTraffic.
     * @param response is callback message.
     */
    public void stopImsTraffic(int token, Message response) {
        mCi.stopImsTraffic(token, response);
    }

    /**
     * Register for notifications of connection setup failure
     *
     * @param h Handler for notification message.
     * @param what User-defined message code.
     * @param obj User object.
     */
    public void registerForConnectionSetupFailure(Handler h, int what, Object obj) {
        mCi.registerForConnectionSetupFailure(h, what, obj);
    }

    /**
     * Unregister for notifications of connection setup failure
     *
     * @param h Handler to be removed from the registrant list.
     */
    public void unregisterForConnectionSetupFailure(Handler h) {
        mCi.unregisterForConnectionSetupFailure(h);
    }

    /**
     * Triggers the UE initiated EPS fallback procedure.
     *
+27 −5
Original line number Diff line number Diff line
@@ -86,6 +86,7 @@ import android.telephony.data.NetworkSliceInfo;
import android.telephony.data.TrafficDescriptor;
import android.telephony.emergency.EmergencyNumber;
import android.telephony.ims.RegistrationManager;
import android.telephony.ims.feature.ConnectionFailureInfo;
import android.telephony.ims.stub.ImsRegistrationImplBase;
import android.text.TextUtils;
import android.util.SparseArray;
@@ -5306,7 +5307,8 @@ public class RIL extends BaseCommands implements CommandsInterface {
    }

    @Override
    public void startImsTraffic(int token, int trafficType, int accessNetworkType, Message result) {
    public void startImsTraffic(int token,
            int trafficType, int accessNetworkType, int trafficDirection, Message result) {
        RadioImsProxy imsProxy = getRadioServiceProxy(RadioImsProxy.class, result);
        if (imsProxy.isEmpty()) return;
        if (mHalVersion.get(HAL_SERVICE_IMS).greaterOrEqual(RADIO_HAL_VERSION_2_0)) {
@@ -5314,12 +5316,15 @@ public class RIL extends BaseCommands implements CommandsInterface {
                    mRILDefaultWorkSource);

            if (RILJ_LOGD) {
                riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
                riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
                        + "{" + token + ", " + trafficType + ", "
                        + accessNetworkType + ", " + trafficDirection + "}");
            }

            try {
                // TODO(ag/20335448): replace 0 with actual trafficDirection
                imsProxy.startImsTraffic(rr.mSerial, token, trafficType, accessNetworkType, 0);
                imsProxy.startImsTraffic(rr.mSerial, token,
                        RILUtils.convertImsTrafficType(trafficType), accessNetworkType,
                        RILUtils.convertImsTrafficDirection(trafficDirection));
            } catch (RemoteException | RuntimeException e) {
                handleRadioProxyExceptionForRR(HAL_SERVICE_IMS, "startImsTraffic", e);
            }
@@ -5344,7 +5349,8 @@ public class RIL extends BaseCommands implements CommandsInterface {
                    mRILDefaultWorkSource);

            if (RILJ_LOGD) {
                riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
                riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
                        + "{" + token + "}");
            }

            try {
@@ -6282,6 +6288,22 @@ public class RIL extends BaseCommands implements CommandsInterface {
                sb.append("[").append(hwcfg).append("] ");
            }
            s = sb.toString();
        } else if (req == RIL_REQUEST_START_IMS_TRAFFIC
                || req == RIL_UNSOL_CONNECTION_SETUP_FAILURE) {
            sb = new StringBuilder("{");
            Object[] info = (Object[]) ret;
            int token = (Integer) info[0];
            sb.append(token).append(", ");
            if (info[1] != null) {
                ConnectionFailureInfo failureInfo = (ConnectionFailureInfo) info[1];
                sb.append(failureInfo.getReason()).append(", ");
                sb.append(failureInfo.getCauseCode()).append(", ");
                sb.append(failureInfo.getWaitTimeMillis());
            } else {
                sb.append("null");
            }
            sb.append("}");
            s = sb.toString();
        } else {
            // Check if toString() was overridden. Java classes created from HIDL have a built-in
            // toString() method, but AIDL classes only have it if the parcelable contains a
Loading