Loading src/java/com/android/internal/telephony/RIL.java +1 −0 Original line number Diff line number Diff line Loading @@ -704,6 +704,7 @@ public class RIL extends BaseCommands implements CommandsInterface { private void handleRadioProxyExceptionForRR(RILRequest rr, String caller, Exception e) { riljLoge(caller + ": " + e); e.printStackTrace(); resetProxyAndRequestList(); } Loading src/java/com/android/internal/telephony/dataconnection/DataConnection.java +7 −5 Original line number Diff line number Diff line Loading @@ -743,9 +743,9 @@ public class DataConnection extends StateMachine { return; } if (apn != null && apn.getMtu() != PhoneConstants.UNSET_MTU) { lp.setMtu(apn.getMtu()); if (DBG) log("MTU set by APN to: " + apn.getMtu()); if (apn != null && apn.getMtuV4() != PhoneConstants.UNSET_MTU) { lp.setMtu(apn.getMtuV4()); if (DBG) log("MTU set by APN to: " + apn.getMtuV4()); return; } Loading Loading @@ -883,8 +883,10 @@ public class DataConnection extends StateMachine { Message msg = obtainMessage(EVENT_SETUP_DATA_CONNECTION_DONE, cp); msg.obj = cp; DataProfile dp = DcTracker.createDataProfile(mApnSetting, cp.mProfileId, cp.mIsPreferredApn); DataProfile dp = new DataProfile.Builder() .setApnSetting(mApnSetting) .setPreferred(cp.mIsPreferredApn) .build(); // We need to use the actual modem roaming state instead of the framework roaming state // here. This flag is only passed down to ril_service for picking the correct protocol (for Loading src/java/com/android/internal/telephony/dataconnection/DcTracker.java +39 −64 Original line number Diff line number Diff line Loading @@ -2016,14 +2016,6 @@ public class DcTracker extends Handler { ArrayList<ApnSetting> dunCandidates = new ArrayList<ApnSetting>(); ArrayList<ApnSetting> retDunSettings = new ArrayList<ApnSetting>(); // Places to look for tether APN in order: TETHER_DUN_APN setting (to be deprecated soon), // APN database String apnData = Settings.Global.getString(mResolver, Settings.Global.TETHER_DUN_APN); if (!TextUtils.isEmpty(apnData)) { dunCandidates.addAll(ApnSetting.arrayFromString(apnData)); if (VDBG) log("fetchDunApns: dunCandidates from Setting: " + dunCandidates); } if (dunCandidates.isEmpty()) { if (!ArrayUtils.isEmpty(mAllApnSettings)) { for (ApnSetting apn : mAllApnSettings) { Loading Loading @@ -2321,8 +2313,10 @@ public class DcTracker extends Handler { if (DBG) log("setInitialAttachApn: X There in no available apn."); } else { if (DBG) log("setInitialAttachApn: X selected APN=" + apnSetting); mDataServiceManager.setInitialAttachApn(createDataProfile(apnSetting, apnSetting.equals(getPreferredApn())), mDataServiceManager.setInitialAttachApn(new DataProfile.Builder() .setApnSetting(apnSetting) .setPreferred(apnSetting.equals(getPreferredApn())) .build(), mPhone.getServiceState().getDataRoamingFromRegistration(), null); } } Loading Loading @@ -3492,7 +3486,10 @@ public class DcTracker extends Handler { for (ApnSetting apn : mAllApnSettings) { if (apn.getApnSetId() == Telephony.Carriers.MATCH_ALL_APN_SET_ID || preferredApnSetId == apn.getApnSetId()) { DataProfile dp = createDataProfile(apn, apn.equals(getPreferredApn())); DataProfile dp = new DataProfile.Builder() .setApnSetting(apn) .setPreferred(apn.equals(getPreferredApn())) .build(); if (!dataProfileList.contains(dp)) { dataProfileList.add(dp); } Loading Loading @@ -3608,15 +3605,37 @@ public class DcTracker extends Handler { int networkTypeBitmask = (dest.getNetworkTypeBitmask() == 0 || src.getNetworkTypeBitmask() == 0) ? 0 : (dest.getNetworkTypeBitmask() | src.getNetworkTypeBitmask()); return ApnSetting.makeApnSetting(id, dest.getOperatorNumeric(), dest.getEntryName(), dest.getApnName(), proxy, port, mmsc, mmsProxy, mmsPort, dest.getUser(), dest.getPassword(), dest.getAuthType(), resultApnType, protocol, roamingProtocol, dest.isEnabled(), networkTypeBitmask, dest.getProfileId(), (dest.isPersistent() || src.isPersistent()), dest.getMaxConns(), dest.getWaitTime(), dest.getMaxConnsTime(), dest.getMtu(), dest.getMvnoType(), dest.getMvnoMatchData(), dest.getApnSetId(), dest.getCarrierId(), dest.getSkip464Xlat()); return new ApnSetting.Builder() .setId(id) .setOperatorNumeric(dest.getOperatorNumeric()) .setEntryName(dest.getEntryName()) .setApnName(dest.getApnName()) .setProxyAddress(proxy) .setProxyPort(port) .setMmsc(mmsc) .setMmsProxyAddress(mmsProxy) .setMmsProxyPort(mmsPort) .setUser(dest.getUser()) .setPassword(dest.getPassword()) .setAuthType(dest.getAuthType()) .setApnTypeBitmask(resultApnType) .setProtocol(protocol) .setRoamingProtocol(roamingProtocol) .setCarrierEnabled(dest.isEnabled()) .setNetworkTypeBitmask(networkTypeBitmask) .setProfileId(dest.getProfileId()) .setModemCognitive(dest.isPersistent() || src.isPersistent()) .setMaxConns(dest.getMaxConns()) .setWaitTime(dest.getWaitTime()) .setMaxConnsTime(dest.getMaxConnsTime()) .setMtuV4(dest.getMtuV4()) .setMtuV6(dest.getMtuV6()) .setMvnoType(dest.getMvnoType()) .setMvnoMatchData(dest.getMvnoMatchData()) .setApnSetId(dest.getApnSetId()) .setCarrierId(dest.getCarrierId()) .setSkip464Xlat(dest.getSkip464Xlat()) .build(); } private DataConnection createDataConnection() { Loading Loading @@ -5489,50 +5508,6 @@ public class DcTracker extends Handler { mWatchdog = false; } private static DataProfile createDataProfile(ApnSetting apn, boolean isPreferred) { return createDataProfile(apn, apn.getProfileId(), isPreferred); } @VisibleForTesting public static DataProfile createDataProfile(ApnSetting apn, int profileId, boolean isPreferred) { int profileType; int networkTypeBitmask = apn.getNetworkTypeBitmask(); if (networkTypeBitmask == 0) { profileType = DataProfile.TYPE_COMMON; } else if ((networkTypeBitmask & TelephonyManager.NETWORK_STANDARDS_FAMILY_BITMASK_3GPP2) == networkTypeBitmask) { profileType = DataProfile.TYPE_3GPP2; } else if ((networkTypeBitmask & TelephonyManager.NETWORK_STANDARDS_FAMILY_BITMASK_3GPP) == networkTypeBitmask) { profileType = DataProfile.TYPE_3GPP; } else { profileType = DataProfile.TYPE_COMMON; } return new DataProfile.Builder() .setProfileId(profileId) .setApn(apn.getApnName()) .setProtocolType(apn.getProtocol()) .setAuthType(apn.getAuthType()) .setUserName(apn.getUser() == null ? "" : apn.getUser()) .setPassword(apn.getPassword() == null ? "" : apn.getPassword()) .setType(profileType) .setMaxConnectionsTime(apn.getMaxConnsTime()) .setMaxConnections(apn.getMaxConns()) .setWaitTime(apn.getWaitTime()) .enable(apn.isEnabled()) .setSupportedApnTypesBitmask(apn.getApnTypeBitmask()) .setRoamingProtocolType(apn.getRoamingProtocol()) .setBearerBitmask(networkTypeBitmask) .setMtu(apn.getMtu()) .setPersistent(apn.isPersistent()) .setPreferred(isPreferred) .build(); } private void onDataServiceBindingChanged(boolean bound) { if (!bound) { if (mTransportType == AccessNetworkConstants.TRANSPORT_TYPE_WLAN) { Loading tests/telephonytests/src/com/android/internal/telephony/RILTest.java +38 −32 Original line number Diff line number Diff line Loading @@ -167,8 +167,6 @@ import android.testing.TestableLooper; import androidx.test.filters.FlakyTest; import com.android.internal.telephony.dataconnection.DcTracker; import org.junit.After; import org.junit.Before; import org.junit.Test; Loading Loading @@ -272,14 +270,14 @@ public class RILTest extends TelephonyTest { private static final int AUTH_TYPE = 0; private static final String USER_NAME = "username"; private static final String PASSWORD = "password"; private static final int TYPE = 0; private static final int MAX_CONNS_TIME = 1; private static final int MAX_CONNS = 3; private static final int WAIT_TIME = 10; private static final int TYPE = DataProfile.TYPE_3GPP; private static final boolean APN_ENABLED = true; private static final int SUPPORTED_APN_TYPES_BITMASK = 123456; private static final int SUPPORTED_APN_TYPES_BITMASK = ApnSetting.TYPE_CBS | ApnSetting.TYPE_IMS; private static final int SUPPORTED_NETWORK_TYPES_BITMASK = (int) (TelephonyManager.NETWORK_TYPE_BITMASK_UMTS | TelephonyManager.NETWORK_TYPE_BITMASK_LTE); private static final int ROAMING_PROTOCOL = ApnSetting.PROTOCOL_IPV6; private static final int BEARER_BITMASK = 123123; private static final int MTU = 1234; private static final boolean PERSISTENT = true; Loading Loading @@ -1024,12 +1022,21 @@ public class RILTest extends TelephonyTest { @FlakyTest @Test public void testSetInitialAttachApn() throws Exception { ApnSetting apnSetting = ApnSetting.makeApnSetting( -1, "22210", "Vodafone IT", "web.omnitel.it", null, -1, null, null, -1, "", "", 0, ApnSetting.TYPE_DUN, ApnSetting.PROTOCOL_IP, ApnSetting.PROTOCOL_IP, true, 0, 0, false, 0, 0, 0, 0, -1, ""); DataProfile dataProfile = DcTracker.createDataProfile( apnSetting, apnSetting.getProfileId(), false); ApnSetting apnSetting = new ApnSetting.Builder() .setId(-1) .setOperatorNumeric("22210") .setEntryName("Vodafone IT") .setApnName("web.omnitel.it") .setApnTypeBitmask(ApnSetting.TYPE_DUN) .setProtocol(ApnSetting.PROTOCOL_IP) .setRoamingProtocol(ApnSetting.PROTOCOL_IP) .setCarrierEnabled(true) .build(); DataProfile dataProfile = new DataProfile.Builder() .setApnSetting(apnSetting) .setPreferred(false) .build(); boolean isRoaming = false; mRILUnderTest.setInitialAttachApn(dataProfile, isRoaming, obtainMessage()); Loading Loading @@ -2588,23 +2595,25 @@ public class RILTest extends TelephonyTest { @Test public void testSetupDataCall() throws Exception { DataProfile dp = new DataProfile.Builder() ApnSetting apn = new ApnSetting.Builder() .setId(1234) .setEntryName(APN) .setApnName(APN) .setApnTypeBitmask(SUPPORTED_APN_TYPES_BITMASK) .setProtocol(ApnSetting.PROTOCOL_IPV6) .setRoamingProtocol(ApnSetting.PROTOCOL_IPV6) .setCarrierEnabled(true) .setProfileId(PROFILE_ID) .setApn(APN) .setProtocolType(PROTOCOL) .setAuthType(AUTH_TYPE) .setUserName(USER_NAME) .setUser(USER_NAME) .setPassword(PASSWORD) .setType(TYPE) .setMaxConnectionsTime(MAX_CONNS_TIME) .setMaxConnections(MAX_CONNS) .setWaitTime(WAIT_TIME) .enable(APN_ENABLED) .setSupportedApnTypesBitmask(SUPPORTED_APN_TYPES_BITMASK) .setRoamingProtocolType(ROAMING_PROTOCOL) .setBearerBitmask(BEARER_BITMASK) .setMtu(MTU) .setPersistent(PERSISTENT) .setNetworkTypeBitmask(SUPPORTED_NETWORK_TYPES_BITMASK) .setMtuV4(MTU) .setModemCognitive(true) .build(); DataProfile dp = new DataProfile.Builder() .setApnSetting(apn) .setPreferred(false) .build(); Loading @@ -2625,14 +2634,11 @@ public class RILTest extends TelephonyTest { 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_APN_TYPES_BITMASK, dpi.supportedApnTypesBitmap); assertEquals(ROAMING_PROTOCOL, ApnSetting.getProtocolIntFromString(dpi.protocol)); assertEquals( BEARER_BITMASK, SUPPORTED_NETWORK_TYPES_BITMASK, ServiceState.convertBearerBitmaskToNetworkTypeBitmask(dpi.bearerBitmap >> 1)); assertEquals(MTU, dpi.mtu); } Loading tests/telephonytests/src/com/android/internal/telephony/dataconnection/ApnContextTest.java +10 −26 Original line number Diff line number Diff line Loading @@ -198,32 +198,16 @@ public class ApnContextTest extends TelephonyTest { public void testProvisionApn() throws Exception { mContextFixture.putResource(R.string.mobile_provisioning_apn, "fake_apn"); ApnSetting myApn = ApnSetting.makeApnSetting( 2163, // id "44010", // numeric "sp-mode", // name "fake_apn", // apn null, // proxy -1, // port null, // mmsc null, // mmsproxy -1, // mmsport "", // user "", // password -1, // authtype ApnSetting.TYPE_DEFAULT | ApnSetting.TYPE_SUPL, // types ApnSetting.PROTOCOL_IP, // protocol ApnSetting.PROTOCOL_IP, // roaming_protocol true, // carrier_enabled 0, // networktype_bismask 0, // profile_id false, // modem_cognitive 0, // max_conns 0, // wait_time 0, // max_conns_time 0, // mtu -1, // mvno_type ""); // mnvo_match_data ApnSetting myApn = new ApnSetting.Builder() .setId(2163) .setOperatorNumeric("44010") .setEntryName("sp-mode") .setApnName("fake_apn") .setApnTypeBitmask(ApnSetting.TYPE_DEFAULT | ApnSetting.TYPE_SUPL) .setProtocol(ApnSetting.PROTOCOL_IP) .setRoamingProtocol(ApnSetting.PROTOCOL_IP) .setCarrierEnabled(true) .build(); mApnContext.setApnSetting(myApn); assertTrue(mApnContext.isProvisioningApn()); Loading Loading
src/java/com/android/internal/telephony/RIL.java +1 −0 Original line number Diff line number Diff line Loading @@ -704,6 +704,7 @@ public class RIL extends BaseCommands implements CommandsInterface { private void handleRadioProxyExceptionForRR(RILRequest rr, String caller, Exception e) { riljLoge(caller + ": " + e); e.printStackTrace(); resetProxyAndRequestList(); } Loading
src/java/com/android/internal/telephony/dataconnection/DataConnection.java +7 −5 Original line number Diff line number Diff line Loading @@ -743,9 +743,9 @@ public class DataConnection extends StateMachine { return; } if (apn != null && apn.getMtu() != PhoneConstants.UNSET_MTU) { lp.setMtu(apn.getMtu()); if (DBG) log("MTU set by APN to: " + apn.getMtu()); if (apn != null && apn.getMtuV4() != PhoneConstants.UNSET_MTU) { lp.setMtu(apn.getMtuV4()); if (DBG) log("MTU set by APN to: " + apn.getMtuV4()); return; } Loading Loading @@ -883,8 +883,10 @@ public class DataConnection extends StateMachine { Message msg = obtainMessage(EVENT_SETUP_DATA_CONNECTION_DONE, cp); msg.obj = cp; DataProfile dp = DcTracker.createDataProfile(mApnSetting, cp.mProfileId, cp.mIsPreferredApn); DataProfile dp = new DataProfile.Builder() .setApnSetting(mApnSetting) .setPreferred(cp.mIsPreferredApn) .build(); // We need to use the actual modem roaming state instead of the framework roaming state // here. This flag is only passed down to ril_service for picking the correct protocol (for Loading
src/java/com/android/internal/telephony/dataconnection/DcTracker.java +39 −64 Original line number Diff line number Diff line Loading @@ -2016,14 +2016,6 @@ public class DcTracker extends Handler { ArrayList<ApnSetting> dunCandidates = new ArrayList<ApnSetting>(); ArrayList<ApnSetting> retDunSettings = new ArrayList<ApnSetting>(); // Places to look for tether APN in order: TETHER_DUN_APN setting (to be deprecated soon), // APN database String apnData = Settings.Global.getString(mResolver, Settings.Global.TETHER_DUN_APN); if (!TextUtils.isEmpty(apnData)) { dunCandidates.addAll(ApnSetting.arrayFromString(apnData)); if (VDBG) log("fetchDunApns: dunCandidates from Setting: " + dunCandidates); } if (dunCandidates.isEmpty()) { if (!ArrayUtils.isEmpty(mAllApnSettings)) { for (ApnSetting apn : mAllApnSettings) { Loading Loading @@ -2321,8 +2313,10 @@ public class DcTracker extends Handler { if (DBG) log("setInitialAttachApn: X There in no available apn."); } else { if (DBG) log("setInitialAttachApn: X selected APN=" + apnSetting); mDataServiceManager.setInitialAttachApn(createDataProfile(apnSetting, apnSetting.equals(getPreferredApn())), mDataServiceManager.setInitialAttachApn(new DataProfile.Builder() .setApnSetting(apnSetting) .setPreferred(apnSetting.equals(getPreferredApn())) .build(), mPhone.getServiceState().getDataRoamingFromRegistration(), null); } } Loading Loading @@ -3492,7 +3486,10 @@ public class DcTracker extends Handler { for (ApnSetting apn : mAllApnSettings) { if (apn.getApnSetId() == Telephony.Carriers.MATCH_ALL_APN_SET_ID || preferredApnSetId == apn.getApnSetId()) { DataProfile dp = createDataProfile(apn, apn.equals(getPreferredApn())); DataProfile dp = new DataProfile.Builder() .setApnSetting(apn) .setPreferred(apn.equals(getPreferredApn())) .build(); if (!dataProfileList.contains(dp)) { dataProfileList.add(dp); } Loading Loading @@ -3608,15 +3605,37 @@ public class DcTracker extends Handler { int networkTypeBitmask = (dest.getNetworkTypeBitmask() == 0 || src.getNetworkTypeBitmask() == 0) ? 0 : (dest.getNetworkTypeBitmask() | src.getNetworkTypeBitmask()); return ApnSetting.makeApnSetting(id, dest.getOperatorNumeric(), dest.getEntryName(), dest.getApnName(), proxy, port, mmsc, mmsProxy, mmsPort, dest.getUser(), dest.getPassword(), dest.getAuthType(), resultApnType, protocol, roamingProtocol, dest.isEnabled(), networkTypeBitmask, dest.getProfileId(), (dest.isPersistent() || src.isPersistent()), dest.getMaxConns(), dest.getWaitTime(), dest.getMaxConnsTime(), dest.getMtu(), dest.getMvnoType(), dest.getMvnoMatchData(), dest.getApnSetId(), dest.getCarrierId(), dest.getSkip464Xlat()); return new ApnSetting.Builder() .setId(id) .setOperatorNumeric(dest.getOperatorNumeric()) .setEntryName(dest.getEntryName()) .setApnName(dest.getApnName()) .setProxyAddress(proxy) .setProxyPort(port) .setMmsc(mmsc) .setMmsProxyAddress(mmsProxy) .setMmsProxyPort(mmsPort) .setUser(dest.getUser()) .setPassword(dest.getPassword()) .setAuthType(dest.getAuthType()) .setApnTypeBitmask(resultApnType) .setProtocol(protocol) .setRoamingProtocol(roamingProtocol) .setCarrierEnabled(dest.isEnabled()) .setNetworkTypeBitmask(networkTypeBitmask) .setProfileId(dest.getProfileId()) .setModemCognitive(dest.isPersistent() || src.isPersistent()) .setMaxConns(dest.getMaxConns()) .setWaitTime(dest.getWaitTime()) .setMaxConnsTime(dest.getMaxConnsTime()) .setMtuV4(dest.getMtuV4()) .setMtuV6(dest.getMtuV6()) .setMvnoType(dest.getMvnoType()) .setMvnoMatchData(dest.getMvnoMatchData()) .setApnSetId(dest.getApnSetId()) .setCarrierId(dest.getCarrierId()) .setSkip464Xlat(dest.getSkip464Xlat()) .build(); } private DataConnection createDataConnection() { Loading Loading @@ -5489,50 +5508,6 @@ public class DcTracker extends Handler { mWatchdog = false; } private static DataProfile createDataProfile(ApnSetting apn, boolean isPreferred) { return createDataProfile(apn, apn.getProfileId(), isPreferred); } @VisibleForTesting public static DataProfile createDataProfile(ApnSetting apn, int profileId, boolean isPreferred) { int profileType; int networkTypeBitmask = apn.getNetworkTypeBitmask(); if (networkTypeBitmask == 0) { profileType = DataProfile.TYPE_COMMON; } else if ((networkTypeBitmask & TelephonyManager.NETWORK_STANDARDS_FAMILY_BITMASK_3GPP2) == networkTypeBitmask) { profileType = DataProfile.TYPE_3GPP2; } else if ((networkTypeBitmask & TelephonyManager.NETWORK_STANDARDS_FAMILY_BITMASK_3GPP) == networkTypeBitmask) { profileType = DataProfile.TYPE_3GPP; } else { profileType = DataProfile.TYPE_COMMON; } return new DataProfile.Builder() .setProfileId(profileId) .setApn(apn.getApnName()) .setProtocolType(apn.getProtocol()) .setAuthType(apn.getAuthType()) .setUserName(apn.getUser() == null ? "" : apn.getUser()) .setPassword(apn.getPassword() == null ? "" : apn.getPassword()) .setType(profileType) .setMaxConnectionsTime(apn.getMaxConnsTime()) .setMaxConnections(apn.getMaxConns()) .setWaitTime(apn.getWaitTime()) .enable(apn.isEnabled()) .setSupportedApnTypesBitmask(apn.getApnTypeBitmask()) .setRoamingProtocolType(apn.getRoamingProtocol()) .setBearerBitmask(networkTypeBitmask) .setMtu(apn.getMtu()) .setPersistent(apn.isPersistent()) .setPreferred(isPreferred) .build(); } private void onDataServiceBindingChanged(boolean bound) { if (!bound) { if (mTransportType == AccessNetworkConstants.TRANSPORT_TYPE_WLAN) { Loading
tests/telephonytests/src/com/android/internal/telephony/RILTest.java +38 −32 Original line number Diff line number Diff line Loading @@ -167,8 +167,6 @@ import android.testing.TestableLooper; import androidx.test.filters.FlakyTest; import com.android.internal.telephony.dataconnection.DcTracker; import org.junit.After; import org.junit.Before; import org.junit.Test; Loading Loading @@ -272,14 +270,14 @@ public class RILTest extends TelephonyTest { private static final int AUTH_TYPE = 0; private static final String USER_NAME = "username"; private static final String PASSWORD = "password"; private static final int TYPE = 0; private static final int MAX_CONNS_TIME = 1; private static final int MAX_CONNS = 3; private static final int WAIT_TIME = 10; private static final int TYPE = DataProfile.TYPE_3GPP; private static final boolean APN_ENABLED = true; private static final int SUPPORTED_APN_TYPES_BITMASK = 123456; private static final int SUPPORTED_APN_TYPES_BITMASK = ApnSetting.TYPE_CBS | ApnSetting.TYPE_IMS; private static final int SUPPORTED_NETWORK_TYPES_BITMASK = (int) (TelephonyManager.NETWORK_TYPE_BITMASK_UMTS | TelephonyManager.NETWORK_TYPE_BITMASK_LTE); private static final int ROAMING_PROTOCOL = ApnSetting.PROTOCOL_IPV6; private static final int BEARER_BITMASK = 123123; private static final int MTU = 1234; private static final boolean PERSISTENT = true; Loading Loading @@ -1024,12 +1022,21 @@ public class RILTest extends TelephonyTest { @FlakyTest @Test public void testSetInitialAttachApn() throws Exception { ApnSetting apnSetting = ApnSetting.makeApnSetting( -1, "22210", "Vodafone IT", "web.omnitel.it", null, -1, null, null, -1, "", "", 0, ApnSetting.TYPE_DUN, ApnSetting.PROTOCOL_IP, ApnSetting.PROTOCOL_IP, true, 0, 0, false, 0, 0, 0, 0, -1, ""); DataProfile dataProfile = DcTracker.createDataProfile( apnSetting, apnSetting.getProfileId(), false); ApnSetting apnSetting = new ApnSetting.Builder() .setId(-1) .setOperatorNumeric("22210") .setEntryName("Vodafone IT") .setApnName("web.omnitel.it") .setApnTypeBitmask(ApnSetting.TYPE_DUN) .setProtocol(ApnSetting.PROTOCOL_IP) .setRoamingProtocol(ApnSetting.PROTOCOL_IP) .setCarrierEnabled(true) .build(); DataProfile dataProfile = new DataProfile.Builder() .setApnSetting(apnSetting) .setPreferred(false) .build(); boolean isRoaming = false; mRILUnderTest.setInitialAttachApn(dataProfile, isRoaming, obtainMessage()); Loading Loading @@ -2588,23 +2595,25 @@ public class RILTest extends TelephonyTest { @Test public void testSetupDataCall() throws Exception { DataProfile dp = new DataProfile.Builder() ApnSetting apn = new ApnSetting.Builder() .setId(1234) .setEntryName(APN) .setApnName(APN) .setApnTypeBitmask(SUPPORTED_APN_TYPES_BITMASK) .setProtocol(ApnSetting.PROTOCOL_IPV6) .setRoamingProtocol(ApnSetting.PROTOCOL_IPV6) .setCarrierEnabled(true) .setProfileId(PROFILE_ID) .setApn(APN) .setProtocolType(PROTOCOL) .setAuthType(AUTH_TYPE) .setUserName(USER_NAME) .setUser(USER_NAME) .setPassword(PASSWORD) .setType(TYPE) .setMaxConnectionsTime(MAX_CONNS_TIME) .setMaxConnections(MAX_CONNS) .setWaitTime(WAIT_TIME) .enable(APN_ENABLED) .setSupportedApnTypesBitmask(SUPPORTED_APN_TYPES_BITMASK) .setRoamingProtocolType(ROAMING_PROTOCOL) .setBearerBitmask(BEARER_BITMASK) .setMtu(MTU) .setPersistent(PERSISTENT) .setNetworkTypeBitmask(SUPPORTED_NETWORK_TYPES_BITMASK) .setMtuV4(MTU) .setModemCognitive(true) .build(); DataProfile dp = new DataProfile.Builder() .setApnSetting(apn) .setPreferred(false) .build(); Loading @@ -2625,14 +2634,11 @@ public class RILTest extends TelephonyTest { 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_APN_TYPES_BITMASK, dpi.supportedApnTypesBitmap); assertEquals(ROAMING_PROTOCOL, ApnSetting.getProtocolIntFromString(dpi.protocol)); assertEquals( BEARER_BITMASK, SUPPORTED_NETWORK_TYPES_BITMASK, ServiceState.convertBearerBitmaskToNetworkTypeBitmask(dpi.bearerBitmap >> 1)); assertEquals(MTU, dpi.mtu); } Loading
tests/telephonytests/src/com/android/internal/telephony/dataconnection/ApnContextTest.java +10 −26 Original line number Diff line number Diff line Loading @@ -198,32 +198,16 @@ public class ApnContextTest extends TelephonyTest { public void testProvisionApn() throws Exception { mContextFixture.putResource(R.string.mobile_provisioning_apn, "fake_apn"); ApnSetting myApn = ApnSetting.makeApnSetting( 2163, // id "44010", // numeric "sp-mode", // name "fake_apn", // apn null, // proxy -1, // port null, // mmsc null, // mmsproxy -1, // mmsport "", // user "", // password -1, // authtype ApnSetting.TYPE_DEFAULT | ApnSetting.TYPE_SUPL, // types ApnSetting.PROTOCOL_IP, // protocol ApnSetting.PROTOCOL_IP, // roaming_protocol true, // carrier_enabled 0, // networktype_bismask 0, // profile_id false, // modem_cognitive 0, // max_conns 0, // wait_time 0, // max_conns_time 0, // mtu -1, // mvno_type ""); // mnvo_match_data ApnSetting myApn = new ApnSetting.Builder() .setId(2163) .setOperatorNumeric("44010") .setEntryName("sp-mode") .setApnName("fake_apn") .setApnTypeBitmask(ApnSetting.TYPE_DEFAULT | ApnSetting.TYPE_SUPL) .setProtocol(ApnSetting.PROTOCOL_IP) .setRoamingProtocol(ApnSetting.PROTOCOL_IP) .setCarrierEnabled(true) .build(); mApnContext.setApnSetting(myApn); assertTrue(mApnContext.isProvisioningApn()); Loading