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

Commit edea8f9f authored by Sarah Chin's avatar Sarah Chin
Browse files

Update setupDataCall and DataCallResponse for 5G slicing

Update setupDataCall and DataCallResponse to take TrafficDescriptor and
matchALlRuleAllowed.
Add new APN ENTERPRISE and populate TrafficDescriptor if ENTERPRISE is
requested.

Bug: 179312227
Test: atest FrameworksTelephonyTests
Change-Id: I94968331eb3049da74b75f3cd29497585d91977b
parent 7eaeea5f
Loading
Loading
Loading
Loading
+20 −4
Original line number Original line Diff line number Diff line
@@ -35,6 +35,7 @@ import android.telephony.TelephonyManager;
import android.telephony.data.DataCallResponse;
import android.telephony.data.DataCallResponse;
import android.telephony.data.DataProfile;
import android.telephony.data.DataProfile;
import android.telephony.data.SliceInfo;
import android.telephony.data.SliceInfo;
import android.telephony.data.TrafficDescriptor;
import android.telephony.emergency.EmergencyNumber;
import android.telephony.emergency.EmergencyNumber;


import com.android.internal.telephony.cdma.CdmaSmsBroadcastConfigInfo;
import com.android.internal.telephony.cdma.CdmaSmsBroadcastConfigInfo;
@@ -1848,18 +1849,33 @@ public interface CommandsInterface {
     * @param linkProperties
     * @param linkProperties
     *            If the reason is for handover, this indicates the link properties of the existing
     *            If the reason is for handover, this indicates the link properties of the existing
     *            data connection
     *            data connection
     * @param result
     * @param pduSessionId the pdu session id to be used for this data call.
     *            Callback message
     *            The standard range of values are 1-15 while 0 means no pdu session id was attached
     *            to this call. Reference: 3GPP TS 24.007 section 11.2.3.1b.
     * @param sliceInfo used within the data connection when a handover occurs from EPDG to 5G.
     * @param sliceInfo used within the data connection when a handover occurs from EPDG to 5G.
     *            The value is null unless the access network is
     *            The value is null unless the access network is
     *            {@link android.telephony.AccessNetworkConstants.AccessNetworkType#NGRAN} and a
     *            {@link android.telephony.AccessNetworkConstants.AccessNetworkType#NGRAN} and a
     *            handover is occurring from EPDG to 5G.  If the slice passed is rejected, then
     *            handover is occurring from EPDG to 5G.  If the slice passed is rejected, then
     *            {@link DataCallResponse#getCause()} is
     *            {@link DataCallResponse#getCause()} is
     *            {@link android.telephony.DataFailCause#SLICE_REJECTED}.
     *            {@link android.telephony.DataFailCause#SLICE_REJECTED}.
     * @param trafficDescriptor TrafficDescriptor for which data connection needs to be established.
     *            It is used for URSP traffic matching as described in 3GPP TS 24.526 Section 4.2.2.
     *            It includes an optional DNN which, if present, must be used for traffic matching;
     *            it does not specify the end point to be used for the data call.
     * @param matchAllRuleAllowed indicates if using default match-all URSP rule for this request is
     *            allowed. If false, this request must not use the match-all URSP rule and if a
     *            non-match-all rule is not found (or if URSP rules are not available) then
     *            {@link DataCallResponse#getCause()} is
     *            {@link android.telephony.DataFailCause#MATCH_ALL_RULE_NOT_ALLOWED}. This is needed
     *            as some requests need to have a hard failure if the intention cannot be met,
     *            for example, a zero-rating slice.
     * @param result
     *            Callback message
     */
     */
    void setupDataCall(int accessNetworkType, DataProfile dataProfile, boolean isRoaming,
    void setupDataCall(int accessNetworkType, DataProfile dataProfile, boolean isRoaming,
                       boolean allowRoaming, int reason, LinkProperties linkProperties,
            boolean allowRoaming, int reason, LinkProperties linkProperties, int pduSessionId,
                       int pduSessionId, SliceInfo sliceInfo, Message result);
            SliceInfo sliceInfo, TrafficDescriptor trafficDescriptor, boolean matchAllRuleAllowed,
            Message result);


    /**
    /**
     * Deactivate packet data connection
     * Deactivate packet data connection
+1 −1
Original line number Original line Diff line number Diff line
@@ -698,7 +698,7 @@ public class GsmCdmaPhone extends Phone {
            ret = PhoneConstants.DataState.DISCONNECTED;
            ret = PhoneConstants.DataState.DISCONNECTED;
        } else if (mSST.getCurrentDataConnectionState() != ServiceState.STATE_IN_SERVICE
        } else if (mSST.getCurrentDataConnectionState() != ServiceState.STATE_IN_SERVICE
                && (isPhoneTypeCdma() || isPhoneTypeCdmaLte() ||
                && (isPhoneTypeCdma() || isPhoneTypeCdmaLte() ||
                (isPhoneTypeGsm() && !apnType.equals(PhoneConstants.APN_TYPE_EMERGENCY)))) {
                (isPhoneTypeGsm() && !apnType.equals(ApnSetting.TYPE_EMERGENCY_STRING)))) {
            // If we're out of service, open TCP sockets may still work
            // If we're out of service, open TCP sockets may still work
            // but no data will flow
            // but no data will flow


+1 −1
Original line number Original line Diff line number Diff line
@@ -3828,7 +3828,7 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
     */
     */
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    public PhoneConstants.DataState getDataConnectionState() {
    public PhoneConstants.DataState getDataConnectionState() {
        return getDataConnectionState(PhoneConstants.APN_TYPE_DEFAULT);
        return getDataConnectionState(ApnSetting.TYPE_DEFAULT_STRING);
    }
    }


    public void notifyCallForwardingIndicator() {
    public void notifyCallForwardingIndicator() {
+1 −0
Original line number Original line Diff line number Diff line
@@ -449,6 +449,7 @@ public class PhoneSwitcher extends Handler {
                .addCapability(NetworkCapabilities.NET_CAPABILITY_IA)
                .addCapability(NetworkCapabilities.NET_CAPABILITY_IA)
                .addCapability(NetworkCapabilities.NET_CAPABILITY_RCS)
                .addCapability(NetworkCapabilities.NET_CAPABILITY_RCS)
                .addCapability(NetworkCapabilities.NET_CAPABILITY_XCAP)
                .addCapability(NetworkCapabilities.NET_CAPABILITY_XCAP)
                .addCapability(NetworkCapabilities.NET_CAPABILITY_ENTERPRISE)
                .addCapability(NetworkCapabilities.NET_CAPABILITY_EIMS)
                .addCapability(NetworkCapabilities.NET_CAPABILITY_EIMS)
                .addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED)
                .addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED)
                .addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
                .addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
+57 −25
Original line number Original line Diff line number Diff line
@@ -56,6 +56,8 @@ import android.hardware.radio.V1_5.AccessNetwork;
import android.hardware.radio.V1_5.IndicationFilter;
import android.hardware.radio.V1_5.IndicationFilter;
import android.hardware.radio.V1_5.PersoSubstate;
import android.hardware.radio.V1_5.PersoSubstate;
import android.hardware.radio.V1_5.RadioAccessNetworks;
import android.hardware.radio.V1_5.RadioAccessNetworks;
import android.hardware.radio.V1_6.OptionalDnn;
import android.hardware.radio.V1_6.OptionalOsAppId;
import android.hardware.radio.V1_6.OptionalSliceInfo;
import android.hardware.radio.V1_6.OptionalSliceInfo;
import android.hardware.radio.V1_6.OptionalTrafficDescriptor;
import android.hardware.radio.V1_6.OptionalTrafficDescriptor;
import android.hardware.radio.deprecated.V1_0.IOemHook;
import android.hardware.radio.deprecated.V1_0.IOemHook;
@@ -109,6 +111,7 @@ import android.telephony.data.DataService;
import android.telephony.data.Qos;
import android.telephony.data.Qos;
import android.telephony.data.QosBearerSession;
import android.telephony.data.QosBearerSession;
import android.telephony.data.SliceInfo;
import android.telephony.data.SliceInfo;
import android.telephony.data.TrafficDescriptor;
import android.telephony.emergency.EmergencyNumber;
import android.telephony.emergency.EmergencyNumber;
import android.text.TextUtils;
import android.text.TextUtils;
import android.util.Log;
import android.util.Log;
@@ -1905,7 +1908,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
        return dpi;
        return dpi;
    }
    }


    private OptionalSliceInfo convertToHalSliceInfo16(@Nullable SliceInfo sliceInfo) {
    private static OptionalSliceInfo convertToHalSliceInfo(@Nullable SliceInfo sliceInfo) {
        OptionalSliceInfo optionalSliceInfo = new OptionalSliceInfo();
        OptionalSliceInfo optionalSliceInfo = new OptionalSliceInfo();
        if (sliceInfo == null) {
        if (sliceInfo == null) {
            return optionalSliceInfo;
            return optionalSliceInfo;
@@ -1920,7 +1923,35 @@ public class RIL extends BaseCommands implements CommandsInterface {
        return optionalSliceInfo;
        return optionalSliceInfo;
    }
    }


    private ArrayList<android.hardware.radio.V1_5.LinkAddress> convertToHalLinkProperties15(
    private static OptionalTrafficDescriptor convertToHalTrafficDescriptor(
            @Nullable TrafficDescriptor trafficDescriptor) {
        OptionalTrafficDescriptor optionalTrafficDescriptor = new OptionalTrafficDescriptor();
        if (trafficDescriptor == null) {
            return optionalTrafficDescriptor;
        }

        android.hardware.radio.V1_6.TrafficDescriptor td =
                new android.hardware.radio.V1_6.TrafficDescriptor();

        OptionalDnn optionalDnn = new OptionalDnn();
        if (trafficDescriptor.getDnn() != null) {
            optionalDnn.value(trafficDescriptor.getDnn());
        }
        td.dnn = optionalDnn;

        OptionalOsAppId optionalOsAppId = new OptionalOsAppId();
        if (trafficDescriptor.getOsAppId() != null) {
            android.hardware.radio.V1_6.OsAppId osAppId = new android.hardware.radio.V1_6.OsAppId();
            osAppId.osAppId = primitiveArrayToArrayList(trafficDescriptor.getOsAppId().getBytes());
            optionalOsAppId.value(osAppId);
        }
        td.osAppId = optionalOsAppId;

        optionalTrafficDescriptor.value(td);
        return optionalTrafficDescriptor;
    }

    private static ArrayList<android.hardware.radio.V1_5.LinkAddress> convertToHalLinkProperties15(
            LinkProperties linkProperties) {
            LinkProperties linkProperties) {
        ArrayList<android.hardware.radio.V1_5.LinkAddress> addresses15 = new ArrayList<>();
        ArrayList<android.hardware.radio.V1_5.LinkAddress> addresses15 = new ArrayList<>();
        if (linkProperties != null) {
        if (linkProperties != null) {
@@ -1997,8 +2028,9 @@ public class RIL extends BaseCommands implements CommandsInterface {


    @Override
    @Override
    public void setupDataCall(int accessNetworkType, DataProfile dataProfile, boolean isRoaming,
    public void setupDataCall(int accessNetworkType, DataProfile dataProfile, boolean isRoaming,
                              boolean allowRoaming, int reason, LinkProperties linkProperties,
            boolean allowRoaming, int reason, LinkProperties linkProperties, int pduSessionId,
                              int pduSessionId, SliceInfo sliceInfo, Message result) {
            SliceInfo sliceInfo, TrafficDescriptor trafficDescriptor, boolean matchAllRuleAllowed,
            Message result) {
        IRadio radioProxy = getRadioProxy(result);
        IRadio radioProxy = getRadioProxy(result);


        if (radioProxy != null) {
        if (radioProxy != null) {
@@ -2027,15 +2059,12 @@ public class RIL extends BaseCommands implements CommandsInterface {
                    android.hardware.radio.V1_5.DataProfileInfo dpi =
                    android.hardware.radio.V1_5.DataProfileInfo dpi =
                            convertToHalDataProfile15(dataProfile);
                            convertToHalDataProfile15(dataProfile);


                    android.hardware.radio.V1_6.OptionalSliceInfo sliceInfo16 =
                    OptionalSliceInfo si = convertToHalSliceInfo(sliceInfo);
                            convertToHalSliceInfo16(sliceInfo);


                    ArrayList<android.hardware.radio.V1_5.LinkAddress> addresses15 =
                    ArrayList<android.hardware.radio.V1_5.LinkAddress> addresses15 =
                            convertToHalLinkProperties15(linkProperties);
                            convertToHalLinkProperties15(linkProperties);


                    OptionalTrafficDescriptor trafficDescriptor16 =
                    OptionalTrafficDescriptor td = convertToHalTrafficDescriptor(trafficDescriptor);
                            new OptionalTrafficDescriptor();
                    boolean matchAllRuleAllowed = true;


                    if (RILJ_LOGD) {
                    if (RILJ_LOGD) {
                        riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
                        riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
@@ -2043,12 +2072,13 @@ public class RIL extends BaseCommands implements CommandsInterface {
                                + AccessNetworkType.toString(accessNetworkType) + ",isRoaming="
                                + AccessNetworkType.toString(accessNetworkType) + ",isRoaming="
                                + isRoaming + ",allowRoaming=" + allowRoaming + "," + dataProfile
                                + isRoaming + ",allowRoaming=" + allowRoaming + "," + dataProfile
                                + ",addresses=" + addresses15 + ",dnses=" + dnses
                                + ",addresses=" + addresses15 + ",dnses=" + dnses
                                + ",pduSessionId=" + pduSessionId + ",sliceInfo=" + sliceInfo16);
                                + ",pduSessionId=" + pduSessionId + ",sliceInfo=" + si
                                + ",trafficDescriptor=" + td + ",matchAllRuleAllowed="
                                + matchAllRuleAllowed);
                    }
                    }


                    radioProxy16.setupDataCall_1_6(rr.mSerial, accessNetworkType, dpi, allowRoaming,
                    radioProxy16.setupDataCall_1_6(rr.mSerial, accessNetworkType, dpi, allowRoaming,
                            reason, addresses15, dnses, pduSessionId, sliceInfo16,
                            reason, addresses15, dnses, pduSessionId, si, td, matchAllRuleAllowed);
                            trafficDescriptor16, matchAllRuleAllowed);
                } else if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_5)) {
                } else if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_5)) {
                    // IRadio V1.5
                    // IRadio V1.5
                    android.hardware.radio.V1_5.IRadio radioProxy15 =
                    android.hardware.radio.V1_5.IRadio radioProxy15 =
@@ -4371,7 +4401,6 @@ public class RIL extends BaseCommands implements CommandsInterface {


    @Override
    @Override
    public void setInitialAttachApn(DataProfile dataProfile, boolean isRoaming, Message result) {
    public void setInitialAttachApn(DataProfile dataProfile, boolean isRoaming, Message result) {

        IRadio radioProxy = getRadioProxy(result);
        IRadio radioProxy = getRadioProxy(result);
        if (radioProxy != null) {
        if (radioProxy != null) {
            RILRequest rr = obtainRequest(RIL_REQUEST_SET_INITIAL_ATTACH_APN, result,
            RILRequest rr = obtainRequest(RIL_REQUEST_SET_INITIAL_ATTACH_APN, result,
@@ -4785,20 +4814,16 @@ public class RIL extends BaseCommands implements CommandsInterface {


    @Override
    @Override
    public void setDataProfile(DataProfile[] dps, boolean isRoaming, Message result) {
    public void setDataProfile(DataProfile[] dps, boolean isRoaming, Message result) {

        IRadio radioProxy = getRadioProxy(result);
        IRadio radioProxy = getRadioProxy(result);
        if (radioProxy != null) {
        if (radioProxy != null) {

            RILRequest rr = obtainRequest(RIL_REQUEST_SET_DATA_PROFILE, result,
            RILRequest rr = null;
                    mRILDefaultWorkSource);
            try {
            try {
                if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_5)) {
                if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_5)) {
                    // V1.5
                    // V1.5
                    android.hardware.radio.V1_5.IRadio radioProxy15 =
                    android.hardware.radio.V1_5.IRadio radioProxy15 =
                            (android.hardware.radio.V1_5.IRadio) radioProxy;
                            (android.hardware.radio.V1_5.IRadio) radioProxy;


                    rr = obtainRequest(RIL_REQUEST_SET_DATA_PROFILE, result,
                            mRILDefaultWorkSource);

                    ArrayList<android.hardware.radio.V1_5.DataProfileInfo> dpis = new ArrayList<>();
                    ArrayList<android.hardware.radio.V1_5.DataProfileInfo> dpis = new ArrayList<>();
                    for (DataProfile dp : dps) {
                    for (DataProfile dp : dps) {
                        dpis.add(convertToHalDataProfile15(dp));
                        dpis.add(convertToHalDataProfile15(dp));
@@ -4818,9 +4843,6 @@ public class RIL extends BaseCommands implements CommandsInterface {
                    android.hardware.radio.V1_4.IRadio radioProxy14 =
                    android.hardware.radio.V1_4.IRadio radioProxy14 =
                            (android.hardware.radio.V1_4.IRadio) radioProxy;
                            (android.hardware.radio.V1_4.IRadio) radioProxy;


                    rr = obtainRequest(RIL_REQUEST_SET_DATA_PROFILE, result,
                            mRILDefaultWorkSource);

                    ArrayList<android.hardware.radio.V1_4.DataProfileInfo> dpis = new ArrayList<>();
                    ArrayList<android.hardware.radio.V1_4.DataProfileInfo> dpis = new ArrayList<>();
                    for (DataProfile dp : dps) {
                    for (DataProfile dp : dps) {
                        dpis.add(convertToHalDataProfile14(dp));
                        dpis.add(convertToHalDataProfile14(dp));
@@ -4847,9 +4869,6 @@ public class RIL extends BaseCommands implements CommandsInterface {
                    }
                    }


                    if (!dpis.isEmpty()) {
                    if (!dpis.isEmpty()) {
                        rr = obtainRequest(RIL_REQUEST_SET_DATA_PROFILE, result,
                                mRILDefaultWorkSource);

                        if (RILJ_LOGD) {
                        if (RILJ_LOGD) {
                            riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
                            riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
                                    + " with data profiles : ");
                                    + " with data profiles : ");
@@ -7438,6 +7457,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
        List<LinkAddress> laList = new ArrayList<>();
        List<LinkAddress> laList = new ArrayList<>();
        List<QosBearerSession> qosSessions = new ArrayList<>();
        List<QosBearerSession> qosSessions = new ArrayList<>();
        SliceInfo sliceInfo = null;
        SliceInfo sliceInfo = null;
        List<TrafficDescriptor> trafficDescriptors = new ArrayList<>();


        if (dcResult instanceof android.hardware.radio.V1_0.SetupDataCallResult) {
        if (dcResult instanceof android.hardware.radio.V1_0.SetupDataCallResult) {
            final android.hardware.radio.V1_0.SetupDataCallResult result =
            final android.hardware.radio.V1_0.SetupDataCallResult result =
@@ -7528,6 +7548,8 @@ public class RIL extends BaseCommands implements CommandsInterface {
            qosSessions = result.qosSessions.stream().map(session ->
            qosSessions = result.qosSessions.stream().map(session ->
                    QosBearerSession.create(session)).collect(Collectors.toList());
                    QosBearerSession.create(session)).collect(Collectors.toList());
            sliceInfo = convertToSliceInfo(result.sliceInfo);
            sliceInfo = convertToSliceInfo(result.sliceInfo);
            trafficDescriptors = result.trafficDescriptors.stream().map(td ->
                    convertToTrafficDescriptor(td)).collect(Collectors.toList());
        } else {
        } else {
            Rlog.e(RILJ_LOG_TAG, "Unsupported SetupDataCallResult " + dcResult);
            Rlog.e(RILJ_LOG_TAG, "Unsupported SetupDataCallResult " + dcResult);
            return null;
            return null;
@@ -7597,6 +7619,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
                .setDefaultQos(defaultQos)
                .setDefaultQos(defaultQos)
                .setQosBearerSessions(qosSessions)
                .setQosBearerSessions(qosSessions)
                .setSliceInfo(sliceInfo)
                .setSliceInfo(sliceInfo)
                .setTrafficDescriptors(trafficDescriptors)
                .build();
                .build();
    }
    }


@@ -7618,6 +7641,15 @@ public class RIL extends BaseCommands implements CommandsInterface {
        return builder.build();
        return builder.build();
    }
    }


    private static TrafficDescriptor convertToTrafficDescriptor(
            android.hardware.radio.V1_6.TrafficDescriptor td) {
        String dnn = td.dnn.getDiscriminator() == OptionalDnn.hidl_discriminator.noinit
                ? null : td.dnn.value();
        String osAppId = td.osAppId.getDiscriminator() == OptionalOsAppId.hidl_discriminator.noinit
                ? null : new String(arrayListToPrimitiveArray(td.osAppId.value().osAppId));
        return new TrafficDescriptor(dnn, osAppId);
    }

    /**
    /**
     * Convert SetupDataCallResult defined in 1.0 or 1.4/types.hal into DataCallResponse
     * Convert SetupDataCallResult defined in 1.0 or 1.4/types.hal into DataCallResponse
     * @param dataCallResultList List of SetupDataCallResult defined in 1.0 or 1.4/types.hal
     * @param dataCallResultList List of SetupDataCallResult defined in 1.0 or 1.4/types.hal
Loading