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

Commit 4ec0f44a authored by Jack Yu's avatar Jack Yu Committed by Gerrit Code Review
Browse files

Merge "Fixed the incorrect MTU value"

parents acc971ef 3e6477c8
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1994,8 +1994,8 @@ public class DataNetwork extends StateMachine {

        // LinkProperties.setMtu should be deprecated. The mtu for each route has been already
        // provided in addRoute() above. For backwards compatibility, we still need to provide
        // a value for the legacy MTU. Use the lower value of v4 and v6 value here.
        linkProperties.setMtu(Math.min(mtuV4, mtuV6));
        // a value for the legacy MTU. Use the higher value of v4 and v6 value here.
        linkProperties.setMtu(Math.max(mtuV4, mtuV6));

        if (mDataProfile.getApnSetting() != null
                && !TextUtils.isEmpty(mDataProfile.getApnSetting().getProxyAddressAsString())) {
+12 −3
Original line number Diff line number Diff line
@@ -190,9 +190,8 @@ public class DataNetworkTest extends TelephonyTest {
                            InetAddresses.parseNumericAddress("fd00:976a:c305:1d::8"),
                            InetAddresses.parseNumericAddress("fd00:976a:c202:1d::7"),
                            InetAddresses.parseNumericAddress("fd00:976a:c305:1d::5")))
                    .setMtu(1500)
                    .setMtuV4(1500)
                    .setMtuV6(1500)
                    .setMtuV4(1234)
                    .setMtuV6(5678)
                    .setPduSessionId(1)
                    .setQosBearerSessions(new ArrayList<>())
                    .setTrafficDescriptors(tds)
@@ -305,6 +304,16 @@ public class DataNetworkTest extends TelephonyTest {
                InetAddresses.parseNumericAddress(IPV4_ADDRESS),
                InetAddresses.parseNumericAddress(IPV6_ADDRESS));

        assertThat(lp.getRoutes()).hasSize(2);
        assertThat(lp.getRoutes().get(0).getGateway()).isEqualTo(
                InetAddresses.parseNumericAddress("10.0.2.15"));
        assertThat(lp.getRoutes().get(0).getMtu()).isEqualTo(1234);
        assertThat(lp.getRoutes().get(1).getGateway()).isEqualTo(
                InetAddresses.parseNumericAddress("fe80::2"));
        assertThat(lp.getRoutes().get(1).getMtu()).isEqualTo(5678);
        // The higher value of v4 and v6 should be used.
        assertThat(lp.getMtu()).isEqualTo(5678);

        ArgumentCaptor<PreciseDataConnectionState> pdcsCaptor =
                ArgumentCaptor.forClass(PreciseDataConnectionState.class);
        verify(mPhone, times(2)).notifyDataConnection(pdcsCaptor.capture());