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

Commit b5710413 authored by Ling Ma's avatar Ling Ma
Browse files

Remove MMS cap only for diff apn

When wifi is available, only remove the MMS capability from the default APN if the alternative candidate has a different apn name.

Fix: 330573041
Test: basic voice + data
Change-Id: Icf276f8b88662b7ba666bf0f9169e91791633b7a
parent d44abe0b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -2443,8 +2443,8 @@ public class DataNetwork extends StateMachine {
                // If we find another data data profile that can support MMS on IWLAN, then remove
                // the MMS capability from this cellular network. This will allow IWLAN to be
                // brought up for MMS later.
                if (dataProfile != null && !dataProfile.equals(mDataProfile)) {
                    log("Found a different data profile " + mDataProfile.getApn()
                if (dataProfile != null && !dataProfile.getApn().equals(mDataProfile.getApn())) {
                    log("Found a different apn name " + mDataProfile.getApn()
                            + " that can serve MMS on IWLAN.");
                    builder.removeCapability(NetworkCapabilities.NET_CAPABILITY_MMS);
                }
+26 −0
Original line number Diff line number Diff line
@@ -2332,6 +2332,32 @@ public class DataNetworkTest extends TelephonyTest {
        // Now QNS prefers MMS on IWLAN
        doReturn(AccessNetworkConstants.TRANSPORT_TYPE_WLAN).when(mAccessNetworksManager)
                .getPreferredTransportByNetworkCapability(NetworkCapabilities.NET_CAPABILITY_MMS);
        // Verify an mms apn that shares the same apn name doesn't count as an alternative.
        ApnSetting mmsApnWithSameApn = new ApnSetting.Builder()
                .setId(2164)
                .setOperatorNumeric("12345")
                .setEntryName("fake_mms_apn")
                .setApnName("fake_apn")
                .setApnTypeBitmask(ApnSetting.TYPE_MMS)
                .setProtocol(ApnSetting.PROTOCOL_IPV6)
                .setRoamingProtocol(ApnSetting.PROTOCOL_IP)
                .setCarrierEnabled(true)
                .setNetworkTypeBitmask((int) TelephonyManager.NETWORK_TYPE_BITMASK_IWLAN)
                .build();
        doReturn(new DataProfile.Builder().setApnSetting(mmsApnWithSameApn)
                .setTrafficDescriptor(new TrafficDescriptor("fake_apn", null))
                .build()).when(mDataProfileManager).getDataProfileForNetworkRequest(
                any(TelephonyNetworkRequest.class),
                eq(TelephonyManager.NETWORK_TYPE_IWLAN), eq(false), eq(false), eq(false));
        accessNetworksManagerCallbackArgumentCaptor.getValue()
                .onPreferredTransportChanged(NetworkCapabilities.NET_CAPABILITY_MMS, false);
        processAllMessages();

        // Check if MMS capability remains intact.
        assertThat(mDataNetworkUT.getNetworkCapabilities()
                .hasCapability(NetworkCapabilities.NET_CAPABILITY_MMS)).isTrue();

        // Verify MMS capability is removed if using a valid MMS alternative APN.
        doReturn(mMmsDataProfile).when(mDataProfileManager).getDataProfileForNetworkRequest(
                any(TelephonyNetworkRequest.class),
                    eq(TelephonyManager.NETWORK_TYPE_IWLAN), eq(false), eq(false), eq(false));