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

Commit fee5062c authored by Sarah Chin's avatar Sarah Chin Committed by Gerrit Code Review
Browse files

Merge "Update setupDataCall and DataCallResponse for 5G slicing"

parents 4ad7b629 838ebf1c
Loading
Loading
Loading
Loading
+20 −4
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ import android.telephony.TelephonyManager;
import android.telephony.data.DataCallResponse;
import android.telephony.data.DataProfile;
import android.telephony.data.SliceInfo;
import android.telephony.data.TrafficDescriptor;
import android.telephony.emergency.EmergencyNumber;

import com.android.internal.telephony.cdma.CdmaSmsBroadcastConfigInfo;
@@ -1848,18 +1849,33 @@ public interface CommandsInterface {
     * @param linkProperties
     *            If the reason is for handover, this indicates the link properties of the existing
     *            data connection
     * @param result
     *            Callback message
     * @param pduSessionId the pdu session id to be used for this data call.
     *            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.
     *            The value is null unless the access network is
     *            {@link android.telephony.AccessNetworkConstants.AccessNetworkType#NGRAN} and a
     *            handover is occurring from EPDG to 5G.  If the slice passed is rejected, then
     *            {@link DataCallResponse#getCause()} is
     *            {@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,
                       boolean allowRoaming, int reason, LinkProperties linkProperties,
                       int pduSessionId, SliceInfo sliceInfo, Message result);
            boolean allowRoaming, int reason, LinkProperties linkProperties, int pduSessionId,
            SliceInfo sliceInfo, TrafficDescriptor trafficDescriptor, boolean matchAllRuleAllowed,
            Message result);

    /**
     * Deactivate packet data connection
+1 −1
Original line number Diff line number Diff line
@@ -691,7 +691,7 @@ public class GsmCdmaPhone extends Phone {
            ret = PhoneConstants.DataState.DISCONNECTED;
        } else if (mSST.getCurrentDataConnectionState() != ServiceState.STATE_IN_SERVICE
                && (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
            // but no data will flow

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

    public void notifyCallForwardingIndicator() {
+1 −0
Original line number Diff line number Diff line
@@ -410,6 +410,7 @@ public class PhoneSwitcher extends Handler {
                .addCapability(NetworkCapabilities.NET_CAPABILITY_IA)
                .addCapability(NetworkCapabilities.NET_CAPABILITY_RCS)
                .addCapability(NetworkCapabilities.NET_CAPABILITY_XCAP)
                .addCapability(NetworkCapabilities.NET_CAPABILITY_ENTERPRISE)
                .addCapability(NetworkCapabilities.NET_CAPABILITY_EIMS)
                .addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED)
                .addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
+57 −25
Original line number 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.PersoSubstate;
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.OptionalTrafficDescriptor;
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.QosBearerSession;
import android.telephony.data.SliceInfo;
import android.telephony.data.TrafficDescriptor;
import android.telephony.emergency.EmergencyNumber;
import android.text.TextUtils;
import android.util.Log;
@@ -1904,7 +1907,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
        return dpi;
    }

    private OptionalSliceInfo convertToHalSliceInfo16(@Nullable SliceInfo sliceInfo) {
    private static OptionalSliceInfo convertToHalSliceInfo(@Nullable SliceInfo sliceInfo) {
        OptionalSliceInfo optionalSliceInfo = new OptionalSliceInfo();
        if (sliceInfo == null) {
            return optionalSliceInfo;
@@ -1919,7 +1922,35 @@ public class RIL extends BaseCommands implements CommandsInterface {
        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) {
        ArrayList<android.hardware.radio.V1_5.LinkAddress> addresses15 = new ArrayList<>();
        if (linkProperties != null) {
@@ -1996,8 +2027,9 @@ public class RIL extends BaseCommands implements CommandsInterface {

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

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

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

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

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

                    if (RILJ_LOGD) {
                        riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
@@ -2042,12 +2071,13 @@ public class RIL extends BaseCommands implements CommandsInterface {
                                + AccessNetworkType.toString(accessNetworkType) + ",isRoaming="
                                + isRoaming + ",allowRoaming=" + allowRoaming + "," + dataProfile
                                + ",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,
                            reason, addresses15, dnses, pduSessionId, sliceInfo16,
                            trafficDescriptor16, matchAllRuleAllowed);
                            reason, addresses15, dnses, pduSessionId, si, td, matchAllRuleAllowed);
                } else if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_5)) {
                    // IRadio V1.5
                    android.hardware.radio.V1_5.IRadio radioProxy15 =
@@ -4372,7 +4402,6 @@ public class RIL extends BaseCommands implements CommandsInterface {

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

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

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

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

            RILRequest rr = null;
            RILRequest rr = obtainRequest(RIL_REQUEST_SET_DATA_PROFILE, result,
                    mRILDefaultWorkSource);
            try {
                if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_5)) {
                    // V1.5
                    android.hardware.radio.V1_5.IRadio radioProxy15 =
                            (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<>();
                    for (DataProfile dp : dps) {
                        dpis.add(convertToHalDataProfile15(dp));
@@ -4819,9 +4844,6 @@ public class RIL extends BaseCommands implements CommandsInterface {
                    android.hardware.radio.V1_4.IRadio radioProxy14 =
                            (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<>();
                    for (DataProfile dp : dps) {
                        dpis.add(convertToHalDataProfile14(dp));
@@ -4848,9 +4870,6 @@ public class RIL extends BaseCommands implements CommandsInterface {
                    }

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

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

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

@@ -7616,6 +7639,15 @@ public class RIL extends BaseCommands implements CommandsInterface {
        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
     * @param dataCallResultList List of SetupDataCallResult defined in 1.0 or 1.4/types.hal
Loading