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

Commit 8e9d1e60 authored by Jack Yu's avatar Jack Yu
Browse files

Data call refactoring and hidlization

Support the new HIDL interface for data call APIs.
The affacted APIs are RIL_REQUEST_SETUP_DATA_CALL,
RIL_REQUEST_SET_DATA_PROFILE, RIL_REQUEST_SET_INITIAL_ATTACH_APN
More parameters are passing down to the modem to address some
issues we had earlier.

bug: 32224135, 30173958, 33561503, 30282096, 32020264
Test: Telephony sanity tests, unit tests

Change-Id: I239baa144bcee413f67e77c6b79b4ae5278077e8
parent ce54c82b
Loading
Loading
Loading
Loading
+16 −33
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@ import com.android.internal.telephony.uicc.IccCardStatus;

import java.util.List;


/**
 * {@hide}
 */
@@ -1605,26 +1604,17 @@ public interface CommandsInterface {
     *
     * @param radioTechnology
     *            Radio technology to use. Values is one of RIL_RADIO_TECHNOLOGY_*
     * @param profile
     *            Profile Number. Values is one of DATA_PROFILE_*
     * @param apn
     *            the APN to connect to if radio technology is GSM/UMTS.
     *            Otherwise null for CDMA.
     * @param user
     *            the username for APN, or NULL
     * @param password
     *            the password for APN, or NULL
     * @param authType
     *            the PAP / CHAP auth type. Values is one of SETUP_DATA_AUTH_*
     * @param protocol
     *            one of the PDP_type values in TS 27.007 section 10.1.1.
     *            For example, "IP", "IPV6", "IPV4V6", or "PPP".
     * @param dataProfile
     *            Data profile for data call setup
     * @param isRoaming
     *            Device is roaming or not
     * @param allowRoaming
     *            Flag indicating data roaming is enabled or not
     * @param result
     *            Callback message
     */
    public void setupDataCall(int radioTechnology, int profile,
            String apn, String user, String password, int authType,
            String protocol, Message result);
    void setupDataCall(int radioTechnology, DataProfile dataProfile, boolean isRoaming,
                       boolean allowRoaming, Message result);

    /**
     * Deactivate packet data connection
@@ -1764,33 +1754,26 @@ public interface CommandsInterface {
    /**
     * Set Initial Attach Apn
     *
     * @param apn
     *            the APN to connect to if radio technology is GSM/UMTS.
     * @param protocol
     *            one of the PDP_type values in TS 27.007 section 10.1.1.
     *            For example, "IP", "IPV6", "IPV4V6", or "PPP".
     * @param authType
     *            authentication protocol used for this PDP context
     *            (None: 0, PAP: 1, CHAP: 2, PAP&CHAP: 3)
     * @param username
     *            the username for APN, or NULL
     * @param password
     *            the password for APN, or NULL
     * @param dataProfile
     *            data profile for initial APN attach
     * @param isRoaming
     *            indicating the device is roaming or not
     * @param result
     *            callback message contains the information of SUCCESS/FAILURE
     */
    public void setInitialAttachApn(String apn, String protocol, int authType, String username,
            String password, Message result);
    void setInitialAttachApn(DataProfile dataProfile, boolean isRoaming, Message result);

    /**
     * Set data profiles in modem
     *
     * @param dps
     *            Array of the data profiles set to modem
     * @param isRoaming
     *            Indicating if the device is roaming or not
     * @param result
     *            callback message contains the information of SUCCESS/FAILURE
     */
    public void setDataProfile(DataProfile[] dps, Message result);
    void setDataProfile(DataProfile[] dps, boolean isRoaming, Message result);

    /**
     * Notifiy that we are testing an emergency call
+97 −434

File changed.

Preview size limit exceeded, changes collapsed.

+6 −1
Original line number Diff line number Diff line
@@ -231,7 +231,12 @@ public class RadioIndication extends IRadioIndication.Stub {
    public void dataCallListChanged(int indicationType, ArrayList<SetupDataCallResult> dcList) {
        mRil.processIndication(indicationType);

        ArrayList<DataCallResponse> response = RIL.convertHalDcList(dcList);
        ArrayList<DataCallResponse> response = new ArrayList<>();

        for (SetupDataCallResult dcResult : dcList) {
            response.add(RIL.convertDataCallResult(dcResult));
        }

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

        mRil.mDataCallListChangedRegistrants.notifyRegistrants(
+25 −13
Original line number Diff line number Diff line
@@ -328,9 +328,14 @@ public class RadioResponse extends IRadioResponse.Stub {
        responseSms(responseInfo, sms);
    }

    /**
     * @param responseInfo Response info struct containing response type, serial no. and error
     * @param setupDataCallResult Response to data call setup as defined by setupDataCallResult in
     *                            types.hal
     */
    public void setupDataCallResponse(RadioResponseInfo responseInfo,
                                      SetupDataCallResult dcResponse) {
        responseSetupDataCall(responseInfo, dcResponse);
                                      SetupDataCallResult setupDataCallResult) {
        responseSetupDataCall(responseInfo, setupDataCallResult);
    }

    /**
@@ -551,9 +556,14 @@ public class RadioResponse extends IRadioResponse.Stub {
        responseInts(responseInfo, status);
    }

    /**
     * @param responseInfo Response info struct containing response type, serial no. and error
     * @param dataCallResultList Response to get data call list as defined by setupDataCallResult in
     *                           types.hal
     */
    public void getDataCallListResponse(RadioResponseInfo responseInfo,
                                        ArrayList<SetupDataCallResult> dcResponse) {
        responseDataCallList(responseInfo, dcResponse);
                                        ArrayList<SetupDataCallResult> dataCallResultList) {
        responseDataCallList(responseInfo, dataCallResultList);
    }

    public void sendOemRilRequestRawResponse(RadioResponseInfo responseInfo,
@@ -1429,13 +1439,12 @@ public class RadioResponse extends IRadioResponse.Stub {
    }

    private void responseSetupDataCall(RadioResponseInfo responseInfo,
                                       SetupDataCallResult dcResponse) {
                                       SetupDataCallResult setupDataCallResult) {
        RILRequest rr = mRil.processResponse(responseInfo);

        if (rr != null) {
            DataCallResponse ret = null;
            DataCallResponse ret = RIL.convertDataCallResult(setupDataCallResult);
            if (responseInfo.error == RadioError.NONE) {
                ret = RIL.convertHalDc(dcResponse);
                sendMessageResponse(rr.mResult, ret);
            }
            mRil.processResponseDone(rr, responseInfo, ret);
@@ -1479,7 +1488,7 @@ public class RadioResponse extends IRadioResponse.Stub {
        }
    }

    private String convertOpertatorInfoToString(int status) {
    private static String convertOpertatorInfoToString(int status) {
        if (status == android.hardware.radio.V1_0.OperatorStatus.UNKNOWN) {
            return "unknown";
        } else if (status == android.hardware.radio.V1_0.OperatorStatus.AVAILABLE) {
@@ -1514,16 +1523,19 @@ public class RadioResponse extends IRadioResponse.Stub {
    }

    private void responseDataCallList(RadioResponseInfo responseInfo,
                                      ArrayList<SetupDataCallResult> dcResponse) {
                                      ArrayList<SetupDataCallResult> dataCallResultList) {
        RILRequest rr = mRil.processResponse(responseInfo);

        if (rr != null) {
            ArrayList<DataCallResponse> ret = null;
            ArrayList<DataCallResponse> dcResponseList = null;
            if (responseInfo.error == RadioError.NONE) {
                ret = RIL.convertHalDcList(dcResponse);
                sendMessageResponse(rr.mResult, ret);
                dcResponseList = new ArrayList<>();
                for (SetupDataCallResult dcResult : dataCallResultList) {
                    dcResponseList.add(RIL.convertDataCallResult(dcResult));
                }
            mRil.processResponseDone(rr, responseInfo, ret);
                sendMessageResponse(rr.mResult, dcResponseList);
            }
            mRil.processResponseDone(rr, responseInfo, dcResponseList);
        }
    }

+58 −35
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.internal.telephony.dataconnection;

import android.content.Context;
import android.hardware.radio.V1_0.ApnTypes;
import android.os.PersistableBundle;
import android.telephony.CarrierConfigManager;
import android.telephony.Rlog;
@@ -29,10 +30,8 @@ import com.android.internal.telephony.uicc.IccRecords;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;

/**
 * This class represents a apn setting for create PDP link
@@ -57,6 +56,7 @@ public class ApnSetting {
    public final String password;
    public final int authType;
    public final String[] types;
    public final int typesBitmap;
    public final int id;
    public final String numeric;
    public final String protocol;
@@ -117,8 +117,9 @@ public class ApnSetting {
                      String mmsc, String mmsProxy, String mmsPort,
                      String user, String password, int authType, String[] types,
                      String protocol, String roamingProtocol, boolean carrierEnabled, int bearer,
            int bearerBitmask, int profileId, boolean modemCognitive, int maxConns, int waitTime,
            int maxConnsTime, int mtu, String mvnoType, String mvnoMatchData) {
                      int bearerBitmask, int profileId, boolean modemCognitive, int maxConns,
                      int waitTime, int maxConnsTime, int mtu, String mvnoType,
                      String mvnoMatchData) {
        this.id = id;
        this.numeric = numeric;
        this.carrier = carrier;
@@ -132,9 +133,12 @@ public class ApnSetting {
        this.password = password;
        this.authType = authType;
        this.types = new String[types.length];
        int apnBitmap = 0;
        for (int i = 0; i < types.length; i++) {
            this.types[i] = types[i].toLowerCase(Locale.ROOT);
            this.types[i] = types[i].toLowerCase();
            apnBitmap |= getApnBitmask(this.types[i]);
        }
        this.typesBitmap = apnBitmap;
        this.protocol = protocol;
        this.roamingProtocol = roamingProtocol;
        this.carrierEnabled = carrierEnabled;
@@ -479,31 +483,50 @@ public class ApnSetting {

        ApnSetting other = (ApnSetting) o;

        return carrier.equals(other.carrier) &&
                id == other.id &&
                numeric.equals(other.numeric) &&
                apn.equals(other.apn) &&
                proxy.equals(other.proxy) &&
                mmsc.equals(other.mmsc) &&
                mmsProxy.equals(other.mmsProxy) &&
                TextUtils.equals(mmsPort, other.mmsPort) &&
                port.equals(other.port) &&
                TextUtils.equals(user, other.user) &&
                TextUtils.equals(password, other.password) &&
                authType == other.authType &&
                Arrays.deepEquals(types, other.types) &&
                protocol.equals(other.protocol) &&
                roamingProtocol.equals(other.roamingProtocol) &&
                carrierEnabled == other.carrierEnabled &&
                bearer == other.bearer &&
                bearerBitmask == other.bearerBitmask &&
                profileId == other.profileId &&
                modemCognitive == other.modemCognitive &&
                maxConns == other.maxConns &&
                waitTime == other.waitTime &&
                maxConnsTime == other.maxConnsTime &&
                mtu == other.mtu &&
                mvnoType.equals(other.mvnoType) &&
                mvnoMatchData.equals(other.mvnoMatchData);
        return carrier.equals(other.carrier)
                && id == other.id
                && numeric.equals(other.numeric)
                && apn.equals(other.apn)
                && proxy.equals(other.proxy)
                && mmsc.equals(other.mmsc)
                && mmsProxy.equals(other.mmsProxy)
                && TextUtils.equals(mmsPort, other.mmsPort)
                && port.equals(other.port)
                && TextUtils.equals(user, other.user)
                && TextUtils.equals(password, other.password)
                && authType == other.authType
                && Arrays.deepEquals(types, other.types)
                && typesBitmap == other.typesBitmap
                && protocol.equals(other.protocol)
                && roamingProtocol.equals(other.roamingProtocol)
                && carrierEnabled == other.carrierEnabled
                && bearer == other.bearer
                && bearerBitmask == other.bearerBitmask
                && profileId == other.profileId
                && modemCognitive == other.modemCognitive
                && maxConns == other.maxConns
                && waitTime == other.waitTime
                && maxConnsTime == other.maxConnsTime
                && mtu == other.mtu
                && mvnoType.equals(other.mvnoType)
                && mvnoMatchData.equals(other.mvnoMatchData);
    }

    // Helper function to convert APN string into a 32-bit bitmask.
    private static int getApnBitmask(String apn) {
        switch (apn) {
            case PhoneConstants.APN_TYPE_DEFAULT: return ApnTypes.DEFAULT;
            case PhoneConstants.APN_TYPE_MMS: return ApnTypes.MMS;
            case PhoneConstants.APN_TYPE_SUPL: return ApnTypes.SUPL;
            case PhoneConstants.APN_TYPE_DUN: return ApnTypes.DUN;
            case PhoneConstants.APN_TYPE_HIPRI: return ApnTypes.HIPRI;
            case PhoneConstants.APN_TYPE_FOTA: return ApnTypes.FOTA;
            case PhoneConstants.APN_TYPE_IMS: return ApnTypes.IMS;
            case PhoneConstants.APN_TYPE_CBS: return ApnTypes.CBS;
            case PhoneConstants.APN_TYPE_IA: return ApnTypes.IA;
            case PhoneConstants.APN_TYPE_EMERGENCY: return ApnTypes.EMERGENCY;
            case PhoneConstants.APN_TYPE_ALL: return ApnTypes.ALL;
            default: return ApnTypes.NONE;
        }
    }
}
Loading