Loading src/java/com/android/internal/telephony/RIL.java +43 −24 Original line number Original line Diff line number Diff line Loading @@ -1509,7 +1509,7 @@ public class RIL extends BaseCommands implements CommandsInterface { // ServiceState.RIL_RADIO_TECHNOLOGY_XXXX. // ServiceState.RIL_RADIO_TECHNOLOGY_XXXX. dpi.bearerBitmap = ServiceState.convertNetworkTypeBitmaskToBearerBitmask( dpi.bearerBitmap = ServiceState.convertNetworkTypeBitmaskToBearerBitmask( dp.getBearerBitmask()) << 1; dp.getBearerBitmask()) << 1; dpi.mtu = dp.getMtu(); dpi.mtu = dp.getMtuV4(); dpi.mvnoType = MvnoType.NONE; dpi.mvnoType = MvnoType.NONE; dpi.mvnoMatchData = ""; dpi.mvnoMatchData = ""; Loading Loading @@ -1543,7 +1543,7 @@ public class RIL extends BaseCommands implements CommandsInterface { // ServiceState.RIL_RADIO_TECHNOLOGY_XXXX. // ServiceState.RIL_RADIO_TECHNOLOGY_XXXX. dpi.bearerBitmap = ServiceState.convertNetworkTypeBitmaskToBearerBitmask( dpi.bearerBitmap = ServiceState.convertNetworkTypeBitmaskToBearerBitmask( dp.getBearerBitmask()) << 1; dp.getBearerBitmask()) << 1; dpi.mtu = dp.getMtu(); dpi.mtu = dp.getMtuV4(); dpi.persistent = dp.isPersistent(); dpi.persistent = dp.isPersistent(); dpi.preferred = dp.isPreferred(); dpi.preferred = dp.isPreferred(); Loading @@ -1563,29 +1563,30 @@ public class RIL extends BaseCommands implements CommandsInterface { android.hardware.radio.V1_5.DataProfileInfo dpi = android.hardware.radio.V1_5.DataProfileInfo dpi = new android.hardware.radio.V1_5.DataProfileInfo(); new android.hardware.radio.V1_5.DataProfileInfo(); dpi.base.apn = dp.getApn(); dpi.apn = dp.getApn(); dpi.base.protocol = dp.getProtocolType(); dpi.protocol = dp.getProtocolType(); dpi.base.roamingProtocol = dp.getRoamingProtocolType(); dpi.roamingProtocol = dp.getRoamingProtocolType(); dpi.base.authType = dp.getAuthType(); dpi.authType = dp.getAuthType(); dpi.base.user = dp.getUserName(); dpi.user = dp.getUserName(); dpi.base.password = dp.getPassword(); dpi.password = dp.getPassword(); dpi.base.type = dp.getType(); dpi.type = dp.getType(); dpi.base.maxConnsTime = dp.getMaxConnectionsTime(); dpi.maxConnsTime = dp.getMaxConnectionsTime(); dpi.base.maxConns = dp.getMaxConnections(); dpi.maxConns = dp.getMaxConnections(); dpi.base.waitTime = dp.getWaitTime(); dpi.waitTime = dp.getWaitTime(); dpi.base.enabled = dp.isEnabled(); dpi.enabled = dp.isEnabled(); dpi.supportedApnTypesBitmap = dp.getSupportedApnTypesBitmask(); dpi.supportedApnTypesBitmap = dp.getSupportedApnTypesBitmask(); // Shift by 1 bit due to the discrepancy between // Shift by 1 bit due to the discrepancy between // android.hardware.radio.V1_0.RadioAccessFamily and the bitmask version of // android.hardware.radio.V1_0.RadioAccessFamily and the bitmask version of // ServiceState.RIL_RADIO_TECHNOLOGY_XXXX. // ServiceState.RIL_RADIO_TECHNOLOGY_XXXX. dpi.base.bearerBitmap = ServiceState.convertNetworkTypeBitmaskToBearerBitmask( dpi.bearerBitmap = ServiceState.convertNetworkTypeBitmaskToBearerBitmask( dp.getBearerBitmask()) << 1; dp.getBearerBitmask()) << 1; dpi.base.mtu = dp.getMtu(); dpi.mtuV4 = dp.getMtuV4(); dpi.base.persistent = dp.isPersistent(); dpi.mtuV6 = dp.getMtuV6(); dpi.base.preferred = dp.isPreferred(); dpi.persistent = dp.isPersistent(); dpi.preferred = dp.isPreferred(); // profile id is only meaningful when it's persistent on the modem. // profile id is only meaningful when it's persistent on the modem. dpi.base.profileId = (dpi.base.persistent) ? dp.getProfileId() : DataProfileId.INVALID; dpi.profileId = (dpi.persistent) ? dp.getProfileId() : DataProfileId.INVALID; return dpi; return dpi; } } Loading Loading @@ -6366,7 +6367,7 @@ public class RIL extends BaseCommands implements CommandsInterface { } } /** /** * Convert SetupDataCallResult defined in 1.0 or 1.4/types.hal into DataCallResponse * Convert SetupDataCallResult defined in 1.0, 1.4, or 1.5 types.hal into DataCallResponse * @param dcResult setup data call result * @param dcResult setup data call result * @return converted DataCallResponse object * @return converted DataCallResponse object */ */ Loading @@ -6374,7 +6375,7 @@ public class RIL extends BaseCommands implements CommandsInterface { public static DataCallResponse convertDataCallResult(Object dcResult) { public static DataCallResponse convertDataCallResult(Object dcResult) { if (dcResult == null) return null; if (dcResult == null) return null; int cause, suggestedRetryTime, cid, active, mtu; int cause, suggestedRetryTime, cid, active, mtu, mtuV4, mtuV6; String ifname; String ifname; int protocolType; int protocolType; String[] addresses = null; String[] addresses = null; Loading @@ -6383,7 +6384,7 @@ public class RIL extends BaseCommands implements CommandsInterface { String[] pcscfs = null; String[] pcscfs = null; List<LinkAddress> laList = new ArrayList<>(); List<LinkAddress> laList = new ArrayList<>(); int version = 0; int version; if (dcResult instanceof android.hardware.radio.V1_0.SetupDataCallResult) { if (dcResult instanceof android.hardware.radio.V1_0.SetupDataCallResult) { final android.hardware.radio.V1_0.SetupDataCallResult result = final android.hardware.radio.V1_0.SetupDataCallResult result = Loading @@ -6407,6 +6408,7 @@ public class RIL extends BaseCommands implements CommandsInterface { pcscfs = result.pcscf.split("\\s+"); pcscfs = result.pcscf.split("\\s+"); } } mtu = result.mtu; mtu = result.mtu; mtuV4 = mtuV6 = 0; version = 0; version = 0; } else if (dcResult instanceof android.hardware.radio.V1_4.SetupDataCallResult) { } else if (dcResult instanceof android.hardware.radio.V1_4.SetupDataCallResult) { final android.hardware.radio.V1_4.SetupDataCallResult result = final android.hardware.radio.V1_4.SetupDataCallResult result = Loading @@ -6422,6 +6424,7 @@ public class RIL extends BaseCommands implements CommandsInterface { gateways = result.gateways.stream().toArray(String[]::new); gateways = result.gateways.stream().toArray(String[]::new); pcscfs = result.pcscf.stream().toArray(String[]::new); pcscfs = result.pcscf.stream().toArray(String[]::new); mtu = result.mtu; mtu = result.mtu; mtuV4 = mtuV6 = 0; version = 4; version = 4; } else if (dcResult instanceof android.hardware.radio.V1_5.SetupDataCallResult) { } else if (dcResult instanceof android.hardware.radio.V1_5.SetupDataCallResult) { final android.hardware.radio.V1_5.SetupDataCallResult result = final android.hardware.radio.V1_5.SetupDataCallResult result = Loading @@ -6439,7 +6442,9 @@ public class RIL extends BaseCommands implements CommandsInterface { dnses = result.dnses.stream().toArray(String[]::new); dnses = result.dnses.stream().toArray(String[]::new); gateways = result.gateways.stream().toArray(String[]::new); gateways = result.gateways.stream().toArray(String[]::new); pcscfs = result.pcscf.stream().toArray(String[]::new); pcscfs = result.pcscf.stream().toArray(String[]::new); mtu = result.mtu; mtu = 0; mtuV4 = result.mtuV4; mtuV6 = result.mtuV6; version = 5; version = 5; } else { } else { Rlog.e(RILJ_LOG_TAG, "Unsupported SetupDataCallResult " + dcResult); Rlog.e(RILJ_LOG_TAG, "Unsupported SetupDataCallResult " + dcResult); Loading Loading @@ -6517,8 +6522,22 @@ public class RIL extends BaseCommands implements CommandsInterface { } } } } return new DataCallResponse(cause, suggestedRetryTime, cid, active, protocolType, ifname, return new DataCallResponse.Builder() laList, dnsList, gatewayList, pcscfList, mtu); .setCause(cause) .setSuggestedRetryTime(suggestedRetryTime) .setId(cid) .setLinkStatus(active) .setProtocolType(protocolType) .setInterfaceName(ifname) .setAddresses(laList) .setDnsAddresses(dnsList) .setGatewayAddresses(gatewayList) .setPcscfAddresses(pcscfList) .setMtu(mtu) .setMtuV4(mtuV4) .setMtuV6(mtuV6) .setVersion(version) .build(); } } /** /** Loading src/java/com/android/internal/telephony/dataconnection/DataConnection.java +11 −5 Original line number Original line Diff line number Diff line Loading @@ -643,10 +643,13 @@ public class DataConnection extends StateMachine { // Check if we should fake an error. // Check if we should fake an error. if (mDcTesterFailBringUpAll.getDcFailBringUp().mCounter > 0) { if (mDcTesterFailBringUpAll.getDcFailBringUp().mCounter > 0) { DataCallResponse response = new DataCallResponse( DataCallResponse response = new DataCallResponse.Builder() mDcTesterFailBringUpAll.getDcFailBringUp().mFailCause, .setCause(mDcTesterFailBringUpAll.getDcFailBringUp().mFailCause) mDcTesterFailBringUpAll.getDcFailBringUp().mSuggestedRetryTime, 0, 0, 0, "", .setSuggestedRetryTime( null, null, null, null, PhoneConstants.UNSET_MTU); mDcTesterFailBringUpAll.getDcFailBringUp().mSuggestedRetryTime) .setMtuV4(PhoneConstants.UNSET_MTU) .setMtuV6(PhoneConstants.UNSET_MTU) .build(); Message msg = obtainMessage(EVENT_SETUP_DATA_CONNECTION_DONE, cp); Message msg = obtainMessage(EVENT_SETUP_DATA_CONNECTION_DONE, cp); AsyncResult.forMessage(msg, response, null); AsyncResult.forMessage(msg, response, null); Loading Loading @@ -1473,14 +1476,17 @@ public class DataConnection extends StateMachine { } } for (InetAddress gateway : response.getGatewayAddresses()) { for (InetAddress gateway : response.getGatewayAddresses()) { int mtu = linkProperties.hasGlobalIPv6Address() ? response.getMtuV6() : response.getMtuV4(); // Allow 0.0.0.0 or :: as a gateway; // Allow 0.0.0.0 or :: as a gateway; // this indicates a point-to-point interface. // this indicates a point-to-point interface. linkProperties.addRoute(new RouteInfo(null, gateway, null, linkProperties.addRoute(new RouteInfo(null, gateway, null, RouteInfo.RTN_UNICAST)); RouteInfo.RTN_UNICAST, mtu)); } } // set interface MTU // set interface MTU // this may clobber the setting read from the APN db, but that's ok // this may clobber the setting read from the APN db, but that's ok // TODO: remove once LinkProperties#setMtu is deprecated linkProperties.setMtu(response.getMtu()); linkProperties.setMtu(response.getMtu()); result = SetupResult.SUCCESS; result = SetupResult.SUCCESS; Loading tests/telephonytests/src/com/android/internal/telephony/RILTest.java +19 −10 Original line number Original line Diff line number Diff line Loading @@ -1638,17 +1638,26 @@ public class RILTest extends TelephonyTest { result10.pcscf = "fd00:976a:c206:20::6 fd00:976a:c206:20::9 fd00:976a:c202:1d::9"; result10.pcscf = "fd00:976a:c206:20::6 fd00:976a:c206:20::9 fd00:976a:c202:1d::9"; result10.mtu = 1500; result10.mtu = 1500; DataCallResponse response = new DataCallResponse(0, -1, 0, 2, ApnSetting.PROTOCOL_IPV4V6, DataCallResponse response = new DataCallResponse.Builder() "ifname", .setCause(0) Arrays.asList(new LinkAddress(InetAddresses.parseNumericAddress("10.0.2.15"), 32), .setSuggestedRetryTime(-1) new LinkAddress("2607:fb90:a620:651d:eabe:f8da:c107:44be/64")), .setId(0) Arrays.asList(InetAddresses.parseNumericAddress("10.0.2.3"), .setLinkStatus(2) InetAddresses.parseNumericAddress("fd00:976a::9")), .setProtocolType(ApnSetting.PROTOCOL_IPV4V6) Arrays.asList(InetAddresses.parseNumericAddress("10.0.2.15"), .setInterfaceName("ifname") InetAddresses.parseNumericAddress("fe80::2")), .setAddresses(Arrays.asList( Arrays.asList(InetAddresses.parseNumericAddress("fd00:976a:c206:20::6"), new LinkAddress(InetAddresses.parseNumericAddress("10.0.2.15"), 32), new LinkAddress("2607:fb90:a620:651d:eabe:f8da:c107:44be/64"))) .setDnsAddresses(Arrays.asList(InetAddresses.parseNumericAddress("10.0.2.3"), InetAddresses.parseNumericAddress("fd00:976a::9"))) .setGatewayAddresses(Arrays.asList(InetAddresses.parseNumericAddress("10.0.2.15"), InetAddresses.parseNumericAddress("fe80::2"))) .setPcscfAddresses(Arrays.asList( InetAddresses.parseNumericAddress("fd00:976a:c206:20::6"), InetAddresses.parseNumericAddress("fd00:976a:c206:20::9"), InetAddresses.parseNumericAddress("fd00:976a:c206:20::9"), InetAddresses.parseNumericAddress("fd00:976a:c202:1d::9")), 1500); InetAddresses.parseNumericAddress("fd00:976a:c202:1d::9"))) .setMtu(1500) .build(); assertEquals(response, RIL.convertDataCallResult(result10)); assertEquals(response, RIL.convertDataCallResult(result10)); Loading tests/telephonytests/src/com/android/internal/telephony/dataconnection/DataCallResponseTest.java +67 −30 Original line number Original line Diff line number Diff line Loading @@ -36,13 +36,22 @@ public class DataCallResponseTest extends AndroidTestCase { @SmallTest @SmallTest public void testParcel() throws Exception { public void testParcel() throws Exception { DataCallResponse response = new DataCallResponse(0, -1, 1, 2, DataCallResponse response = new DataCallResponse.Builder() ApnSetting.PROTOCOL_IP, FAKE_IFNAME, .setCause(0) Arrays.asList(new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0)), .setSuggestedRetryTime(-1) Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS)), .setId(1) Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY)), .setLinkStatus(2) Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS)), .setProtocolType(ApnSetting.PROTOCOL_IP) 1440); .setInterfaceName(FAKE_IFNAME) .setAddresses(Arrays.asList( new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0))) .setDnsAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS))) .setGatewayAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY))) .setPcscfAddresses( Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS))) .setMtuV4(1440) .setMtuV6(1440) .build(); Parcel p = Parcel.obtain(); Parcel p = Parcel.obtain(); response.writeToParcel(p, 0); response.writeToParcel(p, 0); Loading @@ -54,34 +63,62 @@ public class DataCallResponseTest extends AndroidTestCase { @SmallTest @SmallTest public void testEquals() throws Exception { public void testEquals() throws Exception { DataCallResponse response = new DataCallResponse(0, -1, 1, 2, DataCallResponse response = new DataCallResponse.Builder() ApnSetting.PROTOCOL_IP, FAKE_IFNAME, .setCause(0) Arrays.asList(new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0)), .setSuggestedRetryTime(-1) Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS)), .setId(1) Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY)), .setLinkStatus(2) Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS)), .setProtocolType(ApnSetting.PROTOCOL_IP) 1440); .setInterfaceName(FAKE_IFNAME) .setAddresses(Arrays.asList( new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0))) .setDnsAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS))) .setGatewayAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY))) .setPcscfAddresses( Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS))) .setMtuV4(1440) .setMtuV6(1400) .build(); DataCallResponse response1 = new DataCallResponse(0, -1, 1, 2, DataCallResponse response1 = new DataCallResponse.Builder() ApnSetting.PROTOCOL_IP, FAKE_IFNAME, .setCause(0) Arrays.asList(new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0)), .setSuggestedRetryTime(-1) Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS)), .setId(1) Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY)), .setLinkStatus(2) Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS)), .setProtocolType(ApnSetting.PROTOCOL_IP) 1440); .setInterfaceName(FAKE_IFNAME) .setAddresses(Arrays.asList( new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0))) .setDnsAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS))) .setGatewayAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY))) .setPcscfAddresses( Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS))) .setMtuV4(1440) .setMtuV6(1400) .build(); assertEquals(response, response); assertEquals(response, response); assertEquals(response, response1); assertEquals(response, response1); DataCallResponse response2 = new DataCallResponse(1, -1, 1, 3, DataCallResponse response2 = new DataCallResponse.Builder() ApnSetting.PROTOCOL_IP, FAKE_IFNAME, .setCause(1) Arrays.asList(new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0)), .setSuggestedRetryTime(-1) Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS), .setId(1) InetAddresses.parseNumericAddress(FAKE_DNS)), .setLinkStatus(3) Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY)), .setProtocolType(ApnSetting.PROTOCOL_IP) Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS), .setInterfaceName(FAKE_IFNAME) InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS)), .setAddresses(Arrays.asList( 1441); new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0))) .setDnsAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS), InetAddresses.parseNumericAddress(FAKE_DNS))) .setGatewayAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY))) .setPcscfAddresses(Arrays.asList( InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS), InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS))) .setMtuV4(1441) .setMtuV6(1440) .build(); assertNotSame(response1, response2); assertNotSame(response1, response2); assertNotSame(response1, null); assertNotSame(response1, null); assertNotSame(response1, new String[1]); assertNotSame(response1, new String[1]); Loading tests/telephonytests/src/com/android/internal/telephony/dataconnection/DataConnectionTest.java +158 −77 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
src/java/com/android/internal/telephony/RIL.java +43 −24 Original line number Original line Diff line number Diff line Loading @@ -1509,7 +1509,7 @@ public class RIL extends BaseCommands implements CommandsInterface { // ServiceState.RIL_RADIO_TECHNOLOGY_XXXX. // ServiceState.RIL_RADIO_TECHNOLOGY_XXXX. dpi.bearerBitmap = ServiceState.convertNetworkTypeBitmaskToBearerBitmask( dpi.bearerBitmap = ServiceState.convertNetworkTypeBitmaskToBearerBitmask( dp.getBearerBitmask()) << 1; dp.getBearerBitmask()) << 1; dpi.mtu = dp.getMtu(); dpi.mtu = dp.getMtuV4(); dpi.mvnoType = MvnoType.NONE; dpi.mvnoType = MvnoType.NONE; dpi.mvnoMatchData = ""; dpi.mvnoMatchData = ""; Loading Loading @@ -1543,7 +1543,7 @@ public class RIL extends BaseCommands implements CommandsInterface { // ServiceState.RIL_RADIO_TECHNOLOGY_XXXX. // ServiceState.RIL_RADIO_TECHNOLOGY_XXXX. dpi.bearerBitmap = ServiceState.convertNetworkTypeBitmaskToBearerBitmask( dpi.bearerBitmap = ServiceState.convertNetworkTypeBitmaskToBearerBitmask( dp.getBearerBitmask()) << 1; dp.getBearerBitmask()) << 1; dpi.mtu = dp.getMtu(); dpi.mtu = dp.getMtuV4(); dpi.persistent = dp.isPersistent(); dpi.persistent = dp.isPersistent(); dpi.preferred = dp.isPreferred(); dpi.preferred = dp.isPreferred(); Loading @@ -1563,29 +1563,30 @@ public class RIL extends BaseCommands implements CommandsInterface { android.hardware.radio.V1_5.DataProfileInfo dpi = android.hardware.radio.V1_5.DataProfileInfo dpi = new android.hardware.radio.V1_5.DataProfileInfo(); new android.hardware.radio.V1_5.DataProfileInfo(); dpi.base.apn = dp.getApn(); dpi.apn = dp.getApn(); dpi.base.protocol = dp.getProtocolType(); dpi.protocol = dp.getProtocolType(); dpi.base.roamingProtocol = dp.getRoamingProtocolType(); dpi.roamingProtocol = dp.getRoamingProtocolType(); dpi.base.authType = dp.getAuthType(); dpi.authType = dp.getAuthType(); dpi.base.user = dp.getUserName(); dpi.user = dp.getUserName(); dpi.base.password = dp.getPassword(); dpi.password = dp.getPassword(); dpi.base.type = dp.getType(); dpi.type = dp.getType(); dpi.base.maxConnsTime = dp.getMaxConnectionsTime(); dpi.maxConnsTime = dp.getMaxConnectionsTime(); dpi.base.maxConns = dp.getMaxConnections(); dpi.maxConns = dp.getMaxConnections(); dpi.base.waitTime = dp.getWaitTime(); dpi.waitTime = dp.getWaitTime(); dpi.base.enabled = dp.isEnabled(); dpi.enabled = dp.isEnabled(); dpi.supportedApnTypesBitmap = dp.getSupportedApnTypesBitmask(); dpi.supportedApnTypesBitmap = dp.getSupportedApnTypesBitmask(); // Shift by 1 bit due to the discrepancy between // Shift by 1 bit due to the discrepancy between // android.hardware.radio.V1_0.RadioAccessFamily and the bitmask version of // android.hardware.radio.V1_0.RadioAccessFamily and the bitmask version of // ServiceState.RIL_RADIO_TECHNOLOGY_XXXX. // ServiceState.RIL_RADIO_TECHNOLOGY_XXXX. dpi.base.bearerBitmap = ServiceState.convertNetworkTypeBitmaskToBearerBitmask( dpi.bearerBitmap = ServiceState.convertNetworkTypeBitmaskToBearerBitmask( dp.getBearerBitmask()) << 1; dp.getBearerBitmask()) << 1; dpi.base.mtu = dp.getMtu(); dpi.mtuV4 = dp.getMtuV4(); dpi.base.persistent = dp.isPersistent(); dpi.mtuV6 = dp.getMtuV6(); dpi.base.preferred = dp.isPreferred(); dpi.persistent = dp.isPersistent(); dpi.preferred = dp.isPreferred(); // profile id is only meaningful when it's persistent on the modem. // profile id is only meaningful when it's persistent on the modem. dpi.base.profileId = (dpi.base.persistent) ? dp.getProfileId() : DataProfileId.INVALID; dpi.profileId = (dpi.persistent) ? dp.getProfileId() : DataProfileId.INVALID; return dpi; return dpi; } } Loading Loading @@ -6366,7 +6367,7 @@ public class RIL extends BaseCommands implements CommandsInterface { } } /** /** * Convert SetupDataCallResult defined in 1.0 or 1.4/types.hal into DataCallResponse * Convert SetupDataCallResult defined in 1.0, 1.4, or 1.5 types.hal into DataCallResponse * @param dcResult setup data call result * @param dcResult setup data call result * @return converted DataCallResponse object * @return converted DataCallResponse object */ */ Loading @@ -6374,7 +6375,7 @@ public class RIL extends BaseCommands implements CommandsInterface { public static DataCallResponse convertDataCallResult(Object dcResult) { public static DataCallResponse convertDataCallResult(Object dcResult) { if (dcResult == null) return null; if (dcResult == null) return null; int cause, suggestedRetryTime, cid, active, mtu; int cause, suggestedRetryTime, cid, active, mtu, mtuV4, mtuV6; String ifname; String ifname; int protocolType; int protocolType; String[] addresses = null; String[] addresses = null; Loading @@ -6383,7 +6384,7 @@ public class RIL extends BaseCommands implements CommandsInterface { String[] pcscfs = null; String[] pcscfs = null; List<LinkAddress> laList = new ArrayList<>(); List<LinkAddress> laList = new ArrayList<>(); int version = 0; int version; if (dcResult instanceof android.hardware.radio.V1_0.SetupDataCallResult) { if (dcResult instanceof android.hardware.radio.V1_0.SetupDataCallResult) { final android.hardware.radio.V1_0.SetupDataCallResult result = final android.hardware.radio.V1_0.SetupDataCallResult result = Loading @@ -6407,6 +6408,7 @@ public class RIL extends BaseCommands implements CommandsInterface { pcscfs = result.pcscf.split("\\s+"); pcscfs = result.pcscf.split("\\s+"); } } mtu = result.mtu; mtu = result.mtu; mtuV4 = mtuV6 = 0; version = 0; version = 0; } else if (dcResult instanceof android.hardware.radio.V1_4.SetupDataCallResult) { } else if (dcResult instanceof android.hardware.radio.V1_4.SetupDataCallResult) { final android.hardware.radio.V1_4.SetupDataCallResult result = final android.hardware.radio.V1_4.SetupDataCallResult result = Loading @@ -6422,6 +6424,7 @@ public class RIL extends BaseCommands implements CommandsInterface { gateways = result.gateways.stream().toArray(String[]::new); gateways = result.gateways.stream().toArray(String[]::new); pcscfs = result.pcscf.stream().toArray(String[]::new); pcscfs = result.pcscf.stream().toArray(String[]::new); mtu = result.mtu; mtu = result.mtu; mtuV4 = mtuV6 = 0; version = 4; version = 4; } else if (dcResult instanceof android.hardware.radio.V1_5.SetupDataCallResult) { } else if (dcResult instanceof android.hardware.radio.V1_5.SetupDataCallResult) { final android.hardware.radio.V1_5.SetupDataCallResult result = final android.hardware.radio.V1_5.SetupDataCallResult result = Loading @@ -6439,7 +6442,9 @@ public class RIL extends BaseCommands implements CommandsInterface { dnses = result.dnses.stream().toArray(String[]::new); dnses = result.dnses.stream().toArray(String[]::new); gateways = result.gateways.stream().toArray(String[]::new); gateways = result.gateways.stream().toArray(String[]::new); pcscfs = result.pcscf.stream().toArray(String[]::new); pcscfs = result.pcscf.stream().toArray(String[]::new); mtu = result.mtu; mtu = 0; mtuV4 = result.mtuV4; mtuV6 = result.mtuV6; version = 5; version = 5; } else { } else { Rlog.e(RILJ_LOG_TAG, "Unsupported SetupDataCallResult " + dcResult); Rlog.e(RILJ_LOG_TAG, "Unsupported SetupDataCallResult " + dcResult); Loading Loading @@ -6517,8 +6522,22 @@ public class RIL extends BaseCommands implements CommandsInterface { } } } } return new DataCallResponse(cause, suggestedRetryTime, cid, active, protocolType, ifname, return new DataCallResponse.Builder() laList, dnsList, gatewayList, pcscfList, mtu); .setCause(cause) .setSuggestedRetryTime(suggestedRetryTime) .setId(cid) .setLinkStatus(active) .setProtocolType(protocolType) .setInterfaceName(ifname) .setAddresses(laList) .setDnsAddresses(dnsList) .setGatewayAddresses(gatewayList) .setPcscfAddresses(pcscfList) .setMtu(mtu) .setMtuV4(mtuV4) .setMtuV6(mtuV6) .setVersion(version) .build(); } } /** /** Loading
src/java/com/android/internal/telephony/dataconnection/DataConnection.java +11 −5 Original line number Original line Diff line number Diff line Loading @@ -643,10 +643,13 @@ public class DataConnection extends StateMachine { // Check if we should fake an error. // Check if we should fake an error. if (mDcTesterFailBringUpAll.getDcFailBringUp().mCounter > 0) { if (mDcTesterFailBringUpAll.getDcFailBringUp().mCounter > 0) { DataCallResponse response = new DataCallResponse( DataCallResponse response = new DataCallResponse.Builder() mDcTesterFailBringUpAll.getDcFailBringUp().mFailCause, .setCause(mDcTesterFailBringUpAll.getDcFailBringUp().mFailCause) mDcTesterFailBringUpAll.getDcFailBringUp().mSuggestedRetryTime, 0, 0, 0, "", .setSuggestedRetryTime( null, null, null, null, PhoneConstants.UNSET_MTU); mDcTesterFailBringUpAll.getDcFailBringUp().mSuggestedRetryTime) .setMtuV4(PhoneConstants.UNSET_MTU) .setMtuV6(PhoneConstants.UNSET_MTU) .build(); Message msg = obtainMessage(EVENT_SETUP_DATA_CONNECTION_DONE, cp); Message msg = obtainMessage(EVENT_SETUP_DATA_CONNECTION_DONE, cp); AsyncResult.forMessage(msg, response, null); AsyncResult.forMessage(msg, response, null); Loading Loading @@ -1473,14 +1476,17 @@ public class DataConnection extends StateMachine { } } for (InetAddress gateway : response.getGatewayAddresses()) { for (InetAddress gateway : response.getGatewayAddresses()) { int mtu = linkProperties.hasGlobalIPv6Address() ? response.getMtuV6() : response.getMtuV4(); // Allow 0.0.0.0 or :: as a gateway; // Allow 0.0.0.0 or :: as a gateway; // this indicates a point-to-point interface. // this indicates a point-to-point interface. linkProperties.addRoute(new RouteInfo(null, gateway, null, linkProperties.addRoute(new RouteInfo(null, gateway, null, RouteInfo.RTN_UNICAST)); RouteInfo.RTN_UNICAST, mtu)); } } // set interface MTU // set interface MTU // this may clobber the setting read from the APN db, but that's ok // this may clobber the setting read from the APN db, but that's ok // TODO: remove once LinkProperties#setMtu is deprecated linkProperties.setMtu(response.getMtu()); linkProperties.setMtu(response.getMtu()); result = SetupResult.SUCCESS; result = SetupResult.SUCCESS; Loading
tests/telephonytests/src/com/android/internal/telephony/RILTest.java +19 −10 Original line number Original line Diff line number Diff line Loading @@ -1638,17 +1638,26 @@ public class RILTest extends TelephonyTest { result10.pcscf = "fd00:976a:c206:20::6 fd00:976a:c206:20::9 fd00:976a:c202:1d::9"; result10.pcscf = "fd00:976a:c206:20::6 fd00:976a:c206:20::9 fd00:976a:c202:1d::9"; result10.mtu = 1500; result10.mtu = 1500; DataCallResponse response = new DataCallResponse(0, -1, 0, 2, ApnSetting.PROTOCOL_IPV4V6, DataCallResponse response = new DataCallResponse.Builder() "ifname", .setCause(0) Arrays.asList(new LinkAddress(InetAddresses.parseNumericAddress("10.0.2.15"), 32), .setSuggestedRetryTime(-1) new LinkAddress("2607:fb90:a620:651d:eabe:f8da:c107:44be/64")), .setId(0) Arrays.asList(InetAddresses.parseNumericAddress("10.0.2.3"), .setLinkStatus(2) InetAddresses.parseNumericAddress("fd00:976a::9")), .setProtocolType(ApnSetting.PROTOCOL_IPV4V6) Arrays.asList(InetAddresses.parseNumericAddress("10.0.2.15"), .setInterfaceName("ifname") InetAddresses.parseNumericAddress("fe80::2")), .setAddresses(Arrays.asList( Arrays.asList(InetAddresses.parseNumericAddress("fd00:976a:c206:20::6"), new LinkAddress(InetAddresses.parseNumericAddress("10.0.2.15"), 32), new LinkAddress("2607:fb90:a620:651d:eabe:f8da:c107:44be/64"))) .setDnsAddresses(Arrays.asList(InetAddresses.parseNumericAddress("10.0.2.3"), InetAddresses.parseNumericAddress("fd00:976a::9"))) .setGatewayAddresses(Arrays.asList(InetAddresses.parseNumericAddress("10.0.2.15"), InetAddresses.parseNumericAddress("fe80::2"))) .setPcscfAddresses(Arrays.asList( InetAddresses.parseNumericAddress("fd00:976a:c206:20::6"), InetAddresses.parseNumericAddress("fd00:976a:c206:20::9"), InetAddresses.parseNumericAddress("fd00:976a:c206:20::9"), InetAddresses.parseNumericAddress("fd00:976a:c202:1d::9")), 1500); InetAddresses.parseNumericAddress("fd00:976a:c202:1d::9"))) .setMtu(1500) .build(); assertEquals(response, RIL.convertDataCallResult(result10)); assertEquals(response, RIL.convertDataCallResult(result10)); Loading
tests/telephonytests/src/com/android/internal/telephony/dataconnection/DataCallResponseTest.java +67 −30 Original line number Original line Diff line number Diff line Loading @@ -36,13 +36,22 @@ public class DataCallResponseTest extends AndroidTestCase { @SmallTest @SmallTest public void testParcel() throws Exception { public void testParcel() throws Exception { DataCallResponse response = new DataCallResponse(0, -1, 1, 2, DataCallResponse response = new DataCallResponse.Builder() ApnSetting.PROTOCOL_IP, FAKE_IFNAME, .setCause(0) Arrays.asList(new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0)), .setSuggestedRetryTime(-1) Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS)), .setId(1) Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY)), .setLinkStatus(2) Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS)), .setProtocolType(ApnSetting.PROTOCOL_IP) 1440); .setInterfaceName(FAKE_IFNAME) .setAddresses(Arrays.asList( new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0))) .setDnsAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS))) .setGatewayAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY))) .setPcscfAddresses( Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS))) .setMtuV4(1440) .setMtuV6(1440) .build(); Parcel p = Parcel.obtain(); Parcel p = Parcel.obtain(); response.writeToParcel(p, 0); response.writeToParcel(p, 0); Loading @@ -54,34 +63,62 @@ public class DataCallResponseTest extends AndroidTestCase { @SmallTest @SmallTest public void testEquals() throws Exception { public void testEquals() throws Exception { DataCallResponse response = new DataCallResponse(0, -1, 1, 2, DataCallResponse response = new DataCallResponse.Builder() ApnSetting.PROTOCOL_IP, FAKE_IFNAME, .setCause(0) Arrays.asList(new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0)), .setSuggestedRetryTime(-1) Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS)), .setId(1) Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY)), .setLinkStatus(2) Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS)), .setProtocolType(ApnSetting.PROTOCOL_IP) 1440); .setInterfaceName(FAKE_IFNAME) .setAddresses(Arrays.asList( new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0))) .setDnsAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS))) .setGatewayAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY))) .setPcscfAddresses( Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS))) .setMtuV4(1440) .setMtuV6(1400) .build(); DataCallResponse response1 = new DataCallResponse(0, -1, 1, 2, DataCallResponse response1 = new DataCallResponse.Builder() ApnSetting.PROTOCOL_IP, FAKE_IFNAME, .setCause(0) Arrays.asList(new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0)), .setSuggestedRetryTime(-1) Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS)), .setId(1) Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY)), .setLinkStatus(2) Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS)), .setProtocolType(ApnSetting.PROTOCOL_IP) 1440); .setInterfaceName(FAKE_IFNAME) .setAddresses(Arrays.asList( new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0))) .setDnsAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS))) .setGatewayAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY))) .setPcscfAddresses( Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS))) .setMtuV4(1440) .setMtuV6(1400) .build(); assertEquals(response, response); assertEquals(response, response); assertEquals(response, response1); assertEquals(response, response1); DataCallResponse response2 = new DataCallResponse(1, -1, 1, 3, DataCallResponse response2 = new DataCallResponse.Builder() ApnSetting.PROTOCOL_IP, FAKE_IFNAME, .setCause(1) Arrays.asList(new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0)), .setSuggestedRetryTime(-1) Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS), .setId(1) InetAddresses.parseNumericAddress(FAKE_DNS)), .setLinkStatus(3) Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY)), .setProtocolType(ApnSetting.PROTOCOL_IP) Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS), .setInterfaceName(FAKE_IFNAME) InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS)), .setAddresses(Arrays.asList( 1441); new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0))) .setDnsAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS), InetAddresses.parseNumericAddress(FAKE_DNS))) .setGatewayAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY))) .setPcscfAddresses(Arrays.asList( InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS), InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS))) .setMtuV4(1441) .setMtuV6(1440) .build(); assertNotSame(response1, response2); assertNotSame(response1, response2); assertNotSame(response1, null); assertNotSame(response1, null); assertNotSame(response1, new String[1]); assertNotSame(response1, new String[1]); Loading
tests/telephonytests/src/com/android/internal/telephony/dataconnection/DataConnectionTest.java +158 −77 File changed.Preview size limit exceeded, changes collapsed. Show changes