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

Commit f9dd93a4 authored by Daniel Bright's avatar Daniel Bright Committed by Gerrit Code Review
Browse files

Merge "Add S-NSSAI"

parents 8d7db4a0 8411b40d
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -32,7 +32,9 @@ import android.telephony.NetworkScanRequest;
import android.telephony.RadioAccessSpecifier;
import android.telephony.SignalThresholdInfo;
import android.telephony.TelephonyManager;
import android.telephony.data.DataCallResponse;
import android.telephony.data.DataProfile;
import android.telephony.data.SliceInfo;
import android.telephony.emergency.EmergencyNumber;

import com.android.internal.telephony.cdma.CdmaSmsBroadcastConfigInfo;
@@ -1848,10 +1850,16 @@ public interface CommandsInterface {
     *            data connection
     * @param result
     *            Callback message
     * @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}.
     */
    void setupDataCall(int accessNetworkType, DataProfile dataProfile, boolean isRoaming,
                       boolean allowRoaming, int reason, LinkProperties linkProperties,
                       int pduSessionId, Message result);
                       int pduSessionId, SliceInfo sliceInfo, Message result);

    /**
     * Deactivate packet data connection
+63 −28
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ 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.OptionalSliceInfo;
import android.hardware.radio.deprecated.V1_0.IOemHook;
import android.net.InetAddresses;
import android.net.KeepalivePacketData;
@@ -106,6 +107,7 @@ import android.telephony.data.DataProfile;
import android.telephony.data.DataService;
import android.telephony.data.Qos;
import android.telephony.data.QosSession;
import android.telephony.data.SliceInfo;
import android.telephony.emergency.EmergencyNumber;
import android.text.TextUtils;
import android.util.Log;
@@ -1883,6 +1885,38 @@ public class RIL extends BaseCommands implements CommandsInterface {
        return dpi;
    }

    private OptionalSliceInfo convertToHalSliceInfo16(@Nullable SliceInfo sliceInfo) {
        OptionalSliceInfo optionalSliceInfo = new OptionalSliceInfo();
        if (sliceInfo == null) {
            return optionalSliceInfo;
        }

        android.hardware.radio.V1_6.SliceInfo si = new android.hardware.radio.V1_6.SliceInfo();
        si.sst = (byte) sliceInfo.getSliceServiceType();
        si.mappedHplmnSst = (byte) sliceInfo.getMappedHplmnSliceServiceType();
        si.sliceDifferentiator = sliceInfo.getSliceDifferentiator();
        si.mappedHplmnSD = sliceInfo.getMappedHplmnSliceDifferentiator();
        optionalSliceInfo.value(si);
        return optionalSliceInfo;
    }

    private ArrayList<android.hardware.radio.V1_5.LinkAddress> convertToHalLinkProperties15(
            LinkProperties linkProperties) {
        ArrayList<android.hardware.radio.V1_5.LinkAddress> addresses15 = new ArrayList<>();
        if (linkProperties != null) {
            for (LinkAddress la : linkProperties.getAllLinkAddresses()) {
                android.hardware.radio.V1_5.LinkAddress linkAddress =
                        new android.hardware.radio.V1_5.LinkAddress();
                linkAddress.address = la.getAddress().getHostAddress();
                linkAddress.properties = la.getFlags();
                linkAddress.deprecationTime = la.getDeprecationTime();
                linkAddress.expirationTime = la.getExpirationTime();
                addresses15.add(linkAddress);
            }
        }
        return addresses15;
    }

    /**
     * Convert to DataProfileInfo defined in radio/1.5/types.hal
     * @param dp Data profile
@@ -1944,7 +1978,7 @@ 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, Message result) {
                              int pduSessionId, SliceInfo sliceInfo, Message result) {
        IRadio radioProxy = getRadioProxy(result);

        if (radioProxy != null) {
@@ -1973,19 +2007,11 @@ 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);

                    ArrayList<android.hardware.radio.V1_5.LinkAddress> addresses15 =
                            new ArrayList<>();
                    if (linkProperties != null) {
                        for (LinkAddress la : linkProperties.getAllLinkAddresses()) {
                            android.hardware.radio.V1_5.LinkAddress linkAddress =
                                    new android.hardware.radio.V1_5.LinkAddress();
                            linkAddress.address = la.getAddress().getHostAddress();
                            linkAddress.properties = la.getFlags();
                            linkAddress.deprecationTime = la.getDeprecationTime();
                            linkAddress.expirationTime = la.getExpirationTime();
                            addresses15.add(linkAddress);
                        }
                    }
                            convertToHalLinkProperties15(linkProperties);

                    if (RILJ_LOGD) {
                        riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
@@ -1993,11 +2019,11 @@ public class RIL extends BaseCommands implements CommandsInterface {
                                + AccessNetworkType.toString(accessNetworkType) + ",isRoaming="
                                + isRoaming + ",allowRoaming=" + allowRoaming + "," + dataProfile
                                + ",addresses=" + addresses15 + ",dnses=" + dnses
                                + ",pduSessionId=" + pduSessionId);
                                + ",pduSessionId=" + pduSessionId + ",sliceInfo=" + sliceInfo16);
                    }

                    radioProxy16.setupDataCall_1_6(rr.mSerial, accessNetworkType, dpi, allowRoaming,
                            reason, addresses15, dnses, pduSessionId);
                            reason, addresses15, dnses, pduSessionId, sliceInfo16);
                } else if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_5)) {
                    // IRadio V1.5
                    android.hardware.radio.V1_5.IRadio radioProxy15 =
@@ -2008,18 +2034,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
                            convertToHalDataProfile15(dataProfile);

                    ArrayList<android.hardware.radio.V1_5.LinkAddress> addresses15 =
                            new ArrayList<>();
                    if (linkProperties != null) {
                        for (LinkAddress la : linkProperties.getAllLinkAddresses()) {
                            android.hardware.radio.V1_5.LinkAddress linkAddress =
                                    new android.hardware.radio.V1_5.LinkAddress();
                            linkAddress.address = la.getAddress().getHostAddress();
                            linkAddress.properties = la.getFlags();
                            linkAddress.deprecationTime = la.getDeprecationTime();
                            linkAddress.expirationTime = la.getExpirationTime();
                            addresses15.add(linkAddress);
                        }
                    }
                            convertToHalLinkProperties15(linkProperties);

                    if (RILJ_LOGD) {
                        riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
@@ -7367,6 +7382,7 @@ public class RIL extends BaseCommands implements CommandsInterface {

        List<LinkAddress> laList = new ArrayList<>();
        List<QosSession> qosSessions = new ArrayList<>();
        SliceInfo sliceInfo = null;

        if (dcResult instanceof android.hardware.radio.V1_0.SetupDataCallResult) {
            final android.hardware.radio.V1_0.SetupDataCallResult result =
@@ -7445,7 +7461,6 @@ public class RIL extends BaseCommands implements CommandsInterface {
            laList = result.addresses.stream().map(la -> createLinkAddressFromString(
                    la.address, la.properties, la.deprecationTime, la.expirationTime))
                    .collect(Collectors.toList());

            dnses = result.dnses.stream().toArray(String[]::new);
            gateways = result.gateways.stream().toArray(String[]::new);
            pcscfs = result.pcscf.stream().toArray(String[]::new);
@@ -7457,6 +7472,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
            defaultQos = Qos.create(result.defaultQos);
            qosSessions = result.qosSessions.stream().map(session ->
                    QosSession.create(session)).collect(Collectors.toList());
            sliceInfo = convertToSliceInfo(result.sliceInfo);
        } else {
            Rlog.e(RILJ_LOG_TAG, "Unsupported SetupDataCallResult " + dcResult);
            return null;
@@ -7525,9 +7541,28 @@ public class RIL extends BaseCommands implements CommandsInterface {
                .setPduSessionId(pduSessionId)
                .setDefaultQos(defaultQos)
                .setQosSessions(qosSessions)
                .setSliceInfo(sliceInfo)
                .build();
    }

    private static SliceInfo convertToSliceInfo(OptionalSliceInfo optionalSliceInfo) {
        if (optionalSliceInfo.getDiscriminator() == OptionalSliceInfo.hidl_discriminator.noinit) {
            return null;
        }

        android.hardware.radio.V1_6.SliceInfo si = optionalSliceInfo.value();
        SliceInfo.Builder builder =
                new SliceInfo.Builder()
                .setSliceServiceType(si.sst)
                .setMappedHplmnSliceServiceType(si.mappedHplmnSst);
        if (si.sliceDifferentiator != SliceInfo.SLICE_DIFFERENTIATOR_NO_SLICE) {
            builder
                .setSliceDifferentiator(si.sliceDifferentiator)
                .setMappedHplmnSliceDifferentiator(si.mappedHplmnSD);
        }
        return builder.build();
    }

    /**
     * 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
+3 −2
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.telephony.data.DataCallResponse;
import android.telephony.data.DataProfile;
import android.telephony.data.DataService;
import android.telephony.data.DataServiceCallback;
import android.telephony.data.SliceInfo;

import com.android.internal.telephony.CommandException;
import com.android.internal.telephony.Phone;
@@ -158,7 +159,7 @@ public class CellularDataService extends DataService {
        @Override
        public void setupDataCall(int accessNetworkType, DataProfile dataProfile,
                boolean isRoaming, boolean allowRoaming, int reason, LinkProperties linkProperties,
                int pduSessionId, DataServiceCallback callback) {
                int pduSessionId, SliceInfo sliceInfo, DataServiceCallback callback) {
            if (DBG) log("setupDataCall " + getSlotIndex());

            Message message = null;
@@ -170,7 +171,7 @@ public class CellularDataService extends DataService {
            }

            mPhone.mCi.setupDataCall(accessNetworkType, dataProfile, isRoaming, allowRoaming,
                    reason, linkProperties, pduSessionId, message);
                    reason, linkProperties, pduSessionId, sliceInfo, message);
        }

        @Override
+17 −0
Original line number Diff line number Diff line
@@ -68,6 +68,7 @@ import android.telephony.data.DataService;
import android.telephony.data.DataServiceCallback;
import android.telephony.data.Qos;
import android.telephony.data.QosSession;
import android.telephony.data.SliceInfo;
import android.text.TextUtils;
import android.util.LocalLog;
import android.util.Pair;
@@ -301,6 +302,7 @@ public class DataConnection extends StateMachine {
    private int mUplinkBandwidth = 14;
    private Qos mDefaultQos = null;
    private List<QosSession> mQosSessions = new ArrayList<>();
    private SliceInfo mSliceInfo;

    /** The corresponding network agent for this data connection. */
    private DcNetworkAgent mNetworkAgent;
@@ -598,11 +600,23 @@ public class DataConnection extends StateMachine {
        return mPduSessionId;
    }

    public SliceInfo getSliceInfo() {
        return mSliceInfo;
    }

    public void updateQosParameters(DataCallResponse response) {
        mDefaultQos = response.getDefaultQos();
        mQosSessions = response.getQosSessions();
    }

    /**
     * Update the latest slice info on this data connection with
     * {@link DataCallResponse#getSliceInfo}.
     */
    public void updateSliceInfo(DataCallResponse response) {
        mSliceInfo = response.getSliceInfo();
    }

    @VisibleForTesting
    public UpdateLinkPropertyResult updateLinkProperty(DataCallResponse newState) {
        UpdateLinkPropertyResult result = new UpdateLinkPropertyResult(mLinkProperties);
@@ -861,6 +875,7 @@ public class DataConnection extends StateMachine {
                reason,
                linkProperties,
                DataCallResponse.PDU_SESSION_ID_NOT_SET,
                null,
                msg);
        TelephonyMetrics.getInstance().writeSetupDataCall(mPhone.getPhoneId(), cp.mRilRat,
                dp.getProfileId(), dp.getApn(), dp.getProtocolType());
@@ -937,6 +952,7 @@ public class DataConnection extends StateMachine {
                reason,
                linkProperties,
                srcDc.getPduSessionId(),
                srcDc.getSliceInfo(),
                msg);
        TelephonyMetrics.getInstance().writeSetupDataCall(mPhone.getPhoneId(), cp.mRilRat,
                dp.getProfileId(), dp.getApn(), dp.getProtocolType());
@@ -1216,6 +1232,7 @@ public class DataConnection extends StateMachine {
            mCid = response.getId();
            updatePcscfAddr(response);
            updateQosParameters(response);
            updateSliceInfo(response);
            result = updateLinkProperty(response).setupResult;

            setPduSessionId(response.getPduSessionId());
+7 −2
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ import android.telephony.data.DataService;
import android.telephony.data.DataServiceCallback;
import android.telephony.data.IDataService;
import android.telephony.data.IDataServiceCallback;
import android.telephony.data.SliceInfo;
import android.text.TextUtils;

import com.android.internal.telephony.Phone;
@@ -613,12 +614,15 @@ public class DataServiceManager extends Handler {
     * @param pduSessionId The pdu session id to be used for this data call.  A value of -1 means
     *                     no pdu session id was attached to this call.
     *                     Reference: 3GPP TS 24.007 section 11.2.3.1b
     * @param sliceInfo The slice that represents S-NSSAI.
     *                  Reference: 3GPP TS 24.501
     * @param onCompleteMessage The result message for this request. Null if the client does not
     *        care about the result.
     */
    public void setupDataCall(int accessNetworkType, DataProfile dataProfile, boolean isRoaming,
                              boolean allowRoaming, int reason, LinkProperties linkProperties,
                              int pduSessionId, Message onCompleteMessage) {
                              int pduSessionId, @Nullable  SliceInfo sliceInfo,
                              Message onCompleteMessage) {
        if (DBG) log("setupDataCall");
        if (!mBound) {
            loge("setupDataCall: Data service not bound.");
@@ -634,7 +638,8 @@ public class DataServiceManager extends Handler {
            sendMessageDelayed(obtainMessage(EVENT_WATCHDOG_TIMEOUT, callback),
                    REQUEST_UNRESPONDED_TIMEOUT);
            mIDataService.setupDataCall(mPhone.getPhoneId(), accessNetworkType, dataProfile,
                    isRoaming, allowRoaming, reason, linkProperties, pduSessionId, callback);
                    isRoaming, allowRoaming, reason, linkProperties, pduSessionId, sliceInfo,
                    callback);
        } catch (RemoteException e) {
            loge("setupDataCall: Cannot invoke setupDataCall on data service.");
            mMessageMap.remove(callback.asBinder());
Loading