Search in sources :

Example 1 with DataProfileInfo

use of android.hardware.radio.V1_0.DataProfileInfo in project android_frameworks_opt_telephony by LineageOS.

the class RIL method setupDataCall.

@Override
public void setupDataCall(int radioTechnology, DataProfile dataProfile, boolean isRoaming, boolean allowRoaming, Message result) {
    IRadio radioProxy = getRadioProxy(result);
    if (radioProxy != null) {
        RILRequest rr = obtainRequest(RIL_REQUEST_SETUP_DATA_CALL, result, mRILDefaultWorkSource);
        // Convert to HAL data profile
        DataProfileInfo dpi = convertToHalDataProfile(dataProfile);
        if (RILJ_LOGD) {
            riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + ",radioTechnology=" + radioTechnology + ",isRoaming=" + isRoaming + ",allowRoaming=" + allowRoaming + "," + dataProfile);
        }
        try {
            radioProxy.setupDataCall(rr.mSerial, radioTechnology, dpi, dataProfile.modemCognitive, allowRoaming, isRoaming);
            mMetrics.writeRilSetupDataCall(mPhoneId, rr.mSerial, radioTechnology, dpi.profileId, dpi.apn, dpi.authType, dpi.protocol);
        } catch (RemoteException | RuntimeException e) {
            handleRadioProxyExceptionForRR(rr, "setupDataCall", e);
        }
    }
}
Also used : IRadio(android.hardware.radio.V1_0.IRadio) DataProfileInfo(android.hardware.radio.V1_0.DataProfileInfo) RemoteException(android.os.RemoteException)

Example 2 with DataProfileInfo

use of android.hardware.radio.V1_0.DataProfileInfo in project android_frameworks_opt_telephony by LineageOS.

the class RIL method convertToHalDataProfile.

/**
 * Convert to DataProfileInfo defined in types.hal
 * @param dp Data profile
 * @return A converted data profile
 */
private static DataProfileInfo convertToHalDataProfile(DataProfile dp) {
    DataProfileInfo dpi = new DataProfileInfo();
    dpi.profileId = dp.profileId;
    dpi.apn = dp.apn;
    dpi.protocol = dp.protocol;
    dpi.roamingProtocol = dp.roamingProtocol;
    dpi.authType = dp.authType;
    dpi.user = dp.user;
    dpi.password = dp.password;
    dpi.type = dp.type;
    dpi.maxConnsTime = dp.maxConnsTime;
    dpi.maxConns = dp.maxConns;
    dpi.waitTime = dp.waitTime;
    dpi.enabled = dp.enabled;
    dpi.supportedApnTypesBitmap = dp.supportedApnTypesBitmap;
    dpi.bearerBitmap = dp.bearerBitmap;
    dpi.mtu = dp.mtu;
    dpi.mvnoType = convertToHalMvnoType(dp.mvnoType);
    dpi.mvnoMatchData = dp.mvnoMatchData;
    return dpi;
}
Also used : DataProfileInfo(android.hardware.radio.V1_0.DataProfileInfo)

Example 3 with DataProfileInfo

use of android.hardware.radio.V1_0.DataProfileInfo in project android_frameworks_opt_telephony by LineageOS.

the class RILTest method testSetupDataCall.

@Test
public void testSetupDataCall() throws Exception {
    DataProfile dp = new DataProfile.Builder().setProfileId(PROFILE_ID).setApn(APN).setProtocolType(PROTOCOL).setAuthType(AUTH_TYPE).setUserName(USER_NAME).setPassword(PASSWORD).setType(TYPE).setMaxConnectionsTime(MAX_CONNS_TIME).setMaxConnections(MAX_CONNS).setWaitTime(WAIT_TIME).enable(APN_ENABLED).setSupportedApnTypesBitmask(SUPPORTED_APNT_YPES_BITMAK).setRoamingProtocolType(ROAMING_PROTOCOL).setBearerBitmask(BEARER_BITMASK).setMtu(MTU).setPersistent(PERSISTENT).setPreferred(false).build();
    mRILUnderTest.setupDataCall(AccessNetworkConstants.AccessNetworkType.EUTRAN, dp, false, false, 0, null, obtainMessage());
    ArgumentCaptor<DataProfileInfo> dpiCaptor = ArgumentCaptor.forClass(DataProfileInfo.class);
    verify(mRadioProxy).setupDataCall(mSerialNumberCaptor.capture(), eq(AccessNetworkConstants.AccessNetworkType.EUTRAN), dpiCaptor.capture(), eq(true), eq(false), eq(false));
    verifyRILResponse(mRILUnderTest, mSerialNumberCaptor.getValue(), RIL_REQUEST_SETUP_DATA_CALL);
    DataProfileInfo dpi = dpiCaptor.getValue();
    assertEquals(PROFILE_ID, dpi.profileId);
    assertEquals(APN, dpi.apn);
    assertEquals(PROTOCOL, ApnSetting.getProtocolIntFromString(dpi.protocol));
    assertEquals(AUTH_TYPE, dpi.authType);
    assertEquals(USER_NAME, dpi.user);
    assertEquals(PASSWORD, dpi.password);
    assertEquals(TYPE, dpi.type);
    assertEquals(MAX_CONNS_TIME, dpi.maxConnsTime);
    assertEquals(MAX_CONNS, dpi.maxConns);
    assertEquals(WAIT_TIME, dpi.waitTime);
    assertEquals(APN_ENABLED, dpi.enabled);
    assertEquals(SUPPORTED_APNT_YPES_BITMAK, dpi.supportedApnTypesBitmap);
    assertEquals(ROAMING_PROTOCOL, ApnSetting.getProtocolIntFromString(dpi.protocol));
    assertEquals(BEARER_BITMASK, ServiceState.convertBearerBitmaskToNetworkTypeBitmask(dpi.bearerBitmap >> 1));
    assertEquals(MTU, dpi.mtu);
}
Also used : DataProfile(android.telephony.data.DataProfile) DataProfileInfo(android.hardware.radio.V1_0.DataProfileInfo) FlakyTest(androidx.test.filters.FlakyTest) Test(org.junit.Test)

Example 4 with DataProfileInfo

use of android.hardware.radio.V1_0.DataProfileInfo in project android_frameworks_opt_telephony by LineageOS.

the class RIL method setupDataCall.

@Override
public void setupDataCall(int accessNetworkType, DataProfile dataProfile, boolean isRoaming, boolean allowRoaming, int reason, LinkProperties linkProperties, Message result) {
    IRadio radioProxy = getRadioProxy(result);
    if (radioProxy != null) {
        RILRequest rr = obtainRequest(RIL_REQUEST_SETUP_DATA_CALL, result, mRILDefaultWorkSource);
        ArrayList<String> addresses = new ArrayList<>();
        ArrayList<String> dnses = new ArrayList<>();
        if (linkProperties != null) {
            for (InetAddress address : linkProperties.getAddresses()) {
                addresses.add(address.getHostAddress());
            }
            for (InetAddress dns : linkProperties.getDnsServers()) {
                dnses.add(dns.getHostAddress());
            }
        }
        try {
            if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_5)) {
                // IRadio V1.5
                android.hardware.radio.V1_5.IRadio radioProxy15 = (android.hardware.radio.V1_5.IRadio) radioProxy;
                // Convert to HAL data profile
                android.hardware.radio.V1_5.DataProfileInfo dpi = 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);
                    }
                }
                if (RILJ_LOGD) {
                    riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + ",accessNetworkType=" + AccessNetworkType.toString(accessNetworkType) + ",isRoaming=" + isRoaming + ",allowRoaming=" + allowRoaming + "," + dataProfile + ",addresses=" + addresses15 + ",dnses=" + dnses);
                }
                radioProxy15.setupDataCall_1_5(rr.mSerial, accessNetworkType, dpi, allowRoaming, reason, addresses15, dnses);
            } else if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_4)) {
                // IRadio V1.4
                android.hardware.radio.V1_4.IRadio radioProxy14 = (android.hardware.radio.V1_4.IRadio) radioProxy;
                // Convert to HAL data profile
                android.hardware.radio.V1_4.DataProfileInfo dpi = convertToHalDataProfile14(dataProfile);
                if (RILJ_LOGD) {
                    riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + ",accessNetworkType=" + AccessNetworkType.toString(accessNetworkType) + ",isRoaming=" + isRoaming + ",allowRoaming=" + allowRoaming + "," + dataProfile + ",addresses=" + addresses + ",dnses=" + dnses);
                }
                radioProxy14.setupDataCall_1_4(rr.mSerial, accessNetworkType, dpi, allowRoaming, reason, addresses, dnses);
            } else if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_2)) {
                // IRadio V1.2 and IRadio V1.3
                android.hardware.radio.V1_2.IRadio radioProxy12 = (android.hardware.radio.V1_2.IRadio) radioProxy;
                // Convert to HAL data profile
                android.hardware.radio.V1_0.DataProfileInfo dpi = convertToHalDataProfile10(dataProfile);
                if (RILJ_LOGD) {
                    riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + ",accessNetworkType=" + AccessNetworkType.toString(accessNetworkType) + ",isRoaming=" + isRoaming + ",allowRoaming=" + allowRoaming + "," + dataProfile + ",addresses=" + addresses + ",dnses=" + dnses);
                }
                radioProxy12.setupDataCall_1_2(rr.mSerial, accessNetworkType, dpi, dataProfile.isPersistent(), allowRoaming, isRoaming, reason, addresses, dnses);
            } else {
                // IRadio V1.0 and IRadio V1.1
                // Convert to HAL data profile
                android.hardware.radio.V1_0.DataProfileInfo dpi = convertToHalDataProfile10(dataProfile);
                // Getting data RAT here is just a workaround to support the older 1.0
                // vendor RIL. The new data service interface passes access network type
                // instead of RAT for setup data request. It is impossible to convert access
                // network type back to RAT here, so we directly get the data RAT from
                // phone.
                int dataRat = ServiceState.RIL_RADIO_TECHNOLOGY_UNKNOWN;
                Phone phone = PhoneFactory.getPhone(mPhoneId);
                if (phone != null) {
                    ServiceState ss = phone.getServiceState();
                    if (ss != null) {
                        dataRat = ss.getRilDataRadioTechnology();
                    }
                }
                if (RILJ_LOGD) {
                    riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + ",dataRat=" + dataRat + ",isRoaming=" + isRoaming + ",allowRoaming=" + allowRoaming + "," + dataProfile);
                }
                radioProxy.setupDataCall(rr.mSerial, dataRat, dpi, dataProfile.isPersistent(), allowRoaming, isRoaming);
            }
        } catch (RemoteException | RuntimeException e) {
            handleRadioProxyExceptionForRR(rr, "setupDataCall", e);
        }
    }
}
Also used : ArrayList(java.util.ArrayList) LinkAddress(android.net.LinkAddress) ServiceState(android.telephony.ServiceState) IRadio(android.hardware.radio.V1_0.IRadio) RemoteException(android.os.RemoteException) InetAddress(java.net.InetAddress)

Example 5 with DataProfileInfo

use of android.hardware.radio.V1_0.DataProfileInfo in project android_frameworks_opt_telephony by LineageOS.

the class RIL method setDataProfile.

@Override
public void setDataProfile(DataProfile[] dps, boolean isRoaming, Message result) {
    IRadio radioProxy = getRadioProxy(result);
    if (radioProxy != null) {
        RILRequest rr = null;
        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));
                }
                if (RILJ_LOGD) {
                    riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " with data profiles : ");
                    for (DataProfile profile : dps) {
                        riljLog(profile.toString());
                    }
                }
                radioProxy15.setDataProfile_1_5(rr.mSerial, dpis);
            } else if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_4)) {
                // V1.4
                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));
                }
                if (RILJ_LOGD) {
                    riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " with data profiles : ");
                    for (DataProfile profile : dps) {
                        riljLog(profile.toString());
                    }
                }
                radioProxy14.setDataProfile_1_4(rr.mSerial, dpis);
            } else {
                // V1.0, 1.1, 1,2 and 1.3
                ArrayList<android.hardware.radio.V1_0.DataProfileInfo> dpis = new ArrayList<>();
                for (DataProfile dp : dps) {
                    // (a.k.a modem cognitive) bit set to true.
                    if (dp.isPersistent()) {
                        dpis.add(convertToHalDataProfile10(dp));
                    }
                }
                if (!dpis.isEmpty()) {
                    rr = obtainRequest(RIL_REQUEST_SET_DATA_PROFILE, result, mRILDefaultWorkSource);
                    if (RILJ_LOGD) {
                        riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " with data profiles : ");
                        for (DataProfile profile : dps) {
                            riljLog(profile.toString());
                        }
                    }
                    radioProxy.setDataProfile(rr.mSerial, dpis, isRoaming);
                }
            }
        } catch (RemoteException | RuntimeException e) {
            handleRadioProxyExceptionForRR(rr, "setDataProfile", e);
        }
    }
}
Also used : ArrayList(java.util.ArrayList) IRadio(android.hardware.radio.V1_0.IRadio) DataProfile(android.telephony.data.DataProfile) RemoteException(android.os.RemoteException)

Aggregations

DataProfileInfo (android.hardware.radio.V1_0.DataProfileInfo)4 IRadio (android.hardware.radio.V1_0.IRadio)3 RemoteException (android.os.RemoteException)3 DataProfile (android.telephony.data.DataProfile)3 FlakyTest (androidx.test.filters.FlakyTest)2 ArrayList (java.util.ArrayList)2 Test (org.junit.Test)2 LinkAddress (android.net.LinkAddress)1 ServiceState (android.telephony.ServiceState)1 ApnSetting (android.telephony.data.ApnSetting)1 InetAddress (java.net.InetAddress)1