Loading src/java/com/android/internal/telephony/data/DataNetwork.java +2 −2 Original line number Diff line number Diff line Loading @@ -2457,8 +2457,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); } Loading tests/telephonytests/src/com/android/internal/telephony/data/DataNetworkTest.java +26 −0 Original line number Diff line number Diff line Loading @@ -2383,6 +2383,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)); Loading Loading
src/java/com/android/internal/telephony/data/DataNetwork.java +2 −2 Original line number Diff line number Diff line Loading @@ -2457,8 +2457,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); } Loading
tests/telephonytests/src/com/android/internal/telephony/data/DataNetworkTest.java +26 −0 Original line number Diff line number Diff line Loading @@ -2383,6 +2383,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)); Loading