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

Commit 6d62af38 authored by Sarah Chin's avatar Sarah Chin
Browse files

Update DataProfileInfo references

Test: atest FrameworksTelephonyTests
Bug: 208651109
Change-Id: I31e0c922887546c9438ce99dc8cfd0acc7dd49b7
parent b9d671a2
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.os.AsyncResult;
import android.os.RemoteException;
import android.telephony.PcoData;
import android.telephony.data.DataCallResponse;
import android.telephony.data.DataProfile;

import com.android.internal.telephony.dataconnection.KeepaliveStatus;

@@ -94,14 +95,16 @@ public class DataIndication extends IRadioDataIndication.Stub {
    /**
     * Stop throttling calls to setupDataCall for the given APN.
     * @param indicationType Type of radio indication
     * @param apn APN to unthrottle
     * @param dpi DataProfileInfo associated with the APN to unthrottle
     * @throws RemoteException
     */
    public void unthrottleApn(int indicationType, String apn) throws RemoteException {
    public void unthrottleApn(int indicationType, android.hardware.radio.data.DataProfileInfo dpi)
            throws RemoteException {
        mRil.processIndication(RIL.DATA_SERVICE, indicationType);
        DataProfile response = RILUtils.convertToDataProfile(dpi);

        if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_UNTHROTTLE_APN, apn);
        if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_UNTHROTTLE_APN, response);

        mRil.mApnUnthrottledRegistrants.notifyRegistrants(new AsyncResult(null, apn, null));
        mRil.mApnUnthrottledRegistrants.notifyRegistrants(new AsyncResult(null, response, null));
    }
}
+38 −0
Original line number Diff line number Diff line
@@ -963,6 +963,8 @@ public class RILUtils {
        dpi.persistent = dp.isPersistent();
        dpi.preferred = dp.isPreferred();
        dpi.alwaysOn = dp.getApnSetting().isAlwaysOn();
        dpi.trafficDescriptor = RILUtils.convertToHalTrafficDescriptorAidl(
                dp.getTrafficDescriptor());

        // profile id is only meaningful when it's persistent on the modem.
        dpi.profileId = (dpi.persistent) ? dp.getProfileId()
@@ -971,6 +973,42 @@ public class RILUtils {
        return dpi;
    }

    /**
     * Convert from DataProfileInfo.aidl to DataProfile
     * @param dpi DataProfileInfo
     * @return The converted DataProfile
     */
    public static DataProfile convertToDataProfile(
            android.hardware.radio.data.DataProfileInfo dpi) {
        ApnSetting apnSetting = new ApnSetting.Builder()
                .setEntryName(dpi.apn)
                .setApnName(dpi.apn)
                .setApnTypeBitmask(dpi.supportedApnTypesBitmap)
                .setAuthType(dpi.authType)
                .setMaxConnsTime(dpi.maxConnsTime)
                .setMaxConns(dpi.maxConns)
                .setWaitTime(dpi.waitTime)
                .setCarrierEnabled(dpi.enabled)
                .setModemCognitive(dpi.persistent)
                .setMtuV4(dpi.mtuV4)
                .setMtuV6(dpi.mtuV6)
                .setNetworkTypeBitmask(ServiceState.convertBearerBitmaskToNetworkTypeBitmask(
                        dpi.bearerBitmap) >> 1)
                .setProfileId(dpi.profileId)
                .setPassword(dpi.password)
                .setProtocol(dpi.protocol)
                .setRoamingProtocol(dpi.roamingProtocol)
                .setUser(dpi.user)
                .setAlwaysOn(dpi.alwaysOn)
                .build();
        return new DataProfile.Builder()
                .setType(dpi.type)
                .setPreferred(dpi.preferred)
                .setTrafficDescriptor(convertHalTrafficDescriptor(dpi.trafficDescriptor))
                .setApnSetting(apnSetting)
                .build();
    }

    /**
     * Convert to OptionalSliceInfo defined in radio/1.6/types.hal
     * @param sliceInfo Slice info
+10 −5
Original line number Diff line number Diff line
@@ -324,11 +324,16 @@ public class RadioDataProxy extends RadioServiceProxy {
            }
        }
        if (isAidl()) {
            mDataProxy.setupDataCall(serial, accessNetwork,
                    RILUtils.convertToHalDataProfile(dataProfileInfo), roamingAllowed, reason,
                    RILUtils.convertToHalLinkProperties(linkProperties), dnsesArr, pduSessionId,
                    RILUtils.convertToHalSliceInfoAidl(sliceInfo),
                    RILUtils.convertToHalTrafficDescriptorAidl(trafficDescriptor),
            // Create a new DataProfile to set the TrafficDescriptor
            DataProfile dp = new DataProfile.Builder()
                    .setType(dataProfileInfo.getType())
                    .setPreferred(dataProfileInfo.isPreferred())
                    .setTrafficDescriptor(trafficDescriptor)
                    .setApnSetting(dataProfileInfo.getApnSetting())
                    .build();
            mDataProxy.setupDataCall(serial, accessNetwork, RILUtils.convertToHalDataProfile(dp),
                    roamingAllowed, reason, RILUtils.convertToHalLinkProperties(linkProperties),
                    dnsesArr, pduSessionId, RILUtils.convertToHalSliceInfoAidl(sliceInfo),
                    matchAllRuleAllowed);
        } else if (mHalVersion.greaterOrEqual(RIL.RADIO_HAL_VERSION_1_6)) {
            ((android.hardware.radio.V1_6.IRadio) mRadioProxy).setupDataCall_1_6(serial,
+11 −0
Original line number Diff line number Diff line
@@ -320,6 +320,7 @@ public class DataServiceManager extends Handler {
            sendCompleteMessage(msg, resultCode);
        }

        @Override
        public void onApnUnthrottled(String apn) {
            if (apn != null) {
                mApnUnthrottledRegistrants.notifyRegistrants(
@@ -328,6 +329,16 @@ public class DataServiceManager extends Handler {
                loge("onApnUnthrottled: apn is null");
            }
        }

        @Override
        public void onDataProfileUnthrottled(DataProfile dataProfile) {
            if (dataProfile != null) {
                mApnUnthrottledRegistrants.notifyRegistrants(
                        new AsyncResult(null, dataProfile, null));
            } else {
                loge("onDataProfileUnthrottled: dataProfile is null");
            }
        }
    }

    /**
+5 −1
Original line number Diff line number Diff line
@@ -121,7 +121,11 @@ public class CellularDataService extends DataService {
                            callback.onHandoverCancelled(toResultCode(ar.exception));
                            break;
                        case APN_UNTHROTTLED:
                            if (ar.result instanceof DataProfile) {
                                notifyDataProfileUnthrottled((DataProfile) ar.result);
                            } else {
                                notifyApnUnthrottled((String) ar.result);
                            }
                            break;
                        default:
                            loge("Unexpected event: " + message.what);
Loading