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

Commit 0eafbc47 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Fixed IMS handover behavior on roaming network" into tm-dev am:...

Merge "Fixed IMS handover behavior on roaming network" into tm-dev am: 632d12c8 am: e7a5d3f0 am: b0fb2ecb

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/17831656



Change-Id: Ie29a77c974cafe7de1f119a6624a6fb316e3f8d5
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents b36eda15 b0fb2ecb
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -1831,8 +1831,13 @@ public class DataNetworkController extends Handler {

            // Matching the rules by the configured order. Bail out if find first matching rule.
            for (HandoverRule rule : handoverRules) {
                // Check if the rule is only for roaming and we are not roaming.
                if (rule.isOnlyForRoaming && !mServiceState.getDataRoaming()) continue;
                // Check if the rule is only for roaming and we are not roaming. Use the real
                // roaming state reported by modem instead of using the overridden roaming state.
                if (rule.isOnlyForRoaming && !mServiceState.getDataRoamingFromRegistration()) {
                    // If the rule is for roaming only, and the device is not roaming, then bypass
                    // this rule.
                    continue;
                }

                if (rule.sourceAccessNetworks.contains(sourceAccessNetwork)
                        && rule.targetAccessNetworks.contains(targetAccessNetwork)) {
+51 −0
Original line number Diff line number Diff line
@@ -461,6 +461,8 @@ public class DataNetworkControllerTest extends TelephonyTest {
                .setRegistrationState(regState)
                .setDomain(NetworkRegistrationInfo.DOMAIN_CS)
                .build());
        ss.setDataRoamingFromRegistration(regState
                == NetworkRegistrationInfo.REGISTRATION_STATE_ROAMING);
        doReturn(ss).when(mSST).getServiceState();
        doReturn(ss).when(mPhone).getServiceState();

@@ -1728,6 +1730,55 @@ public class DataNetworkControllerTest extends TelephonyTest {
                any());
    }

    @Test
    public void testHandoverDataNetworkNotAllowedByRoamingPolicy() throws Exception {
        mCarrierConfig.putStringArray(CarrierConfigManager.KEY_IWLAN_HANDOVER_POLICY_STRING_ARRAY,
                new String[]{"source=EUTRAN|NGRAN|IWLAN, target=EUTRAN|NGRAN|IWLAN, roaming=true, "
                        + "type=disallowed, capabilities=IMS"});
        serviceStateChanged(TelephonyManager.NETWORK_TYPE_LTE,
                NetworkRegistrationInfo.REGISTRATION_STATE_ROAMING);
        // Force data config manager to reload the carrier config.
        mDataNetworkControllerUT.getDataConfigManager().obtainMessage(
                1/*EVENT_CARRIER_CONFIG_CHANGED*/).sendToTarget();
        doReturn(AccessNetworkConstants.TRANSPORT_TYPE_WLAN).when(mAccessNetworksManager)
                .getPreferredTransportByNetworkCapability(NetworkCapabilities.NET_CAPABILITY_IMS);

        processAllMessages();

        // Bring up IMS PDN on IWLAN
        testSetupImsDataNetwork();

        doReturn(AccessNetworkConstants.TRANSPORT_TYPE_WWAN).when(mAccessNetworksManager)
                .getPreferredTransportByNetworkCapability(NetworkCapabilities.NET_CAPABILITY_IMS);
        mAccessNetworksManagerCallback.onPreferredTransportChanged(
                NetworkCapabilities.NET_CAPABILITY_IMS);

        // Verify IMS PDN is connected.
        verifyConnectedNetworkHasCapabilities(NetworkCapabilities.NET_CAPABILITY_IMS);

        // After this, IMS data network should be disconnected, and DNC should attempt to
        // establish a new one on cellular
        processAllMessages();

        // Verify all data disconnected.
        verify(mMockedDataNetworkControllerCallback).onAnyDataNetworkExistingChanged(eq(false));

        // Should setup a new one instead of handover.
        verify(mMockedWwanDataServiceManager).setupDataCall(anyInt(), any(DataProfile.class),
                anyBoolean(), anyBoolean(), eq(DataService.REQUEST_REASON_NORMAL), any(), anyInt(),
                any(), any(), anyBoolean(), any(Message.class));


        // A new data network should be connected on IWLAN
        List<DataNetwork> dataNetworkList = getDataNetworks();
        assertThat(dataNetworkList).hasSize(1);
        assertThat(dataNetworkList.get(0).isConnected()).isTrue();
        assertThat(dataNetworkList.get(0).getNetworkCapabilities().hasCapability(
                NetworkCapabilities.NET_CAPABILITY_IMS)).isTrue();
        assertThat(dataNetworkList.get(0).getTransport())
                .isEqualTo(AccessNetworkConstants.TRANSPORT_TYPE_WWAN);
    }

    @Test
    public void testHandoverDataNetworkRetry() throws Exception {
        testSetupImsDataNetwork();