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

Commit 69167e9d authored by Jack Yu's avatar Jack Yu Committed by Android (Google) Code Review
Browse files

Merge "Supported UNKNOWN in IWLAN handover rule" into tm-d1-dev

parents 33527944 28ba158a
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -710,9 +710,9 @@ public class DataNetworkController extends Handler {
                        + "\"" + ruleString + "\"");
            }

            if (source.contains(AccessNetworkType.UNKNOWN)) {
                throw new IllegalArgumentException("Source access networks contains unknown. "
                        + "\"" + ruleString + "\"");
            if (source.contains(AccessNetworkType.UNKNOWN) && type != RULE_TYPE_DISALLOWED) {
                throw new IllegalArgumentException("Unknown access network can be only specified in"
                        + " the disallowed rule. \"" + ruleString + "\"");
            }

            if (target.contains(AccessNetworkType.UNKNOWN)) {
+50 −0
Original line number Diff line number Diff line
@@ -1585,6 +1585,16 @@ public class DataNetworkControllerTest extends TelephonyTest {
                NetworkCapabilities.NET_CAPABILITY_IMS, NetworkCapabilities.NET_CAPABILITY_EIMS);
        assertThat(handoverRule.isOnlyForRoaming).isTrue();

        handoverRule = new HandoverRule("source=EUTRAN|NGRAN|IWLAN|UNKNOWN, "
                + "target=EUTRAN|NGRAN|IWLAN, type=disallowed, capabilities = IMS|EIMS");
        assertThat(handoverRule.sourceAccessNetworks).containsExactly(AccessNetworkType.EUTRAN,
                AccessNetworkType.NGRAN, AccessNetworkType.IWLAN, AccessNetworkType.UNKNOWN);
        assertThat(handoverRule.targetAccessNetworks).containsExactly(AccessNetworkType.EUTRAN,
                AccessNetworkType.NGRAN, AccessNetworkType.IWLAN);
        assertThat(handoverRule.type).isEqualTo(HandoverRule.RULE_TYPE_DISALLOWED);
        assertThat(handoverRule.networkCapabilities).containsExactly(
                NetworkCapabilities.NET_CAPABILITY_IMS, NetworkCapabilities.NET_CAPABILITY_EIMS);

        assertThrows(IllegalArgumentException.class,
                () -> new HandoverRule("V2hhdCBUaGUgRnVjayBpcyB0aGlzIQ=="));

@@ -1594,6 +1604,14 @@ public class DataNetworkControllerTest extends TelephonyTest {
        assertThrows(IllegalArgumentException.class,
                () -> new HandoverRule("source=GERAN|UTRAN|EUTRAN|NGRAN|IWLAN, type=allowed"));

        assertThrows(IllegalArgumentException.class,
                () -> new HandoverRule("source=GERAN, target=UNKNOWN, type=disallowed, "
                        + "capabilities=IMS"));

        assertThrows(IllegalArgumentException.class,
                () -> new HandoverRule("source=UNKNOWN, target=IWLAN, type=allowed, "
                        + "capabilities=IMS"));

        assertThrows(IllegalArgumentException.class,
                () -> new HandoverRule("source=GERAN, target=IWLAN, type=wtf"));

@@ -2851,6 +2869,38 @@ public class DataNetworkControllerTest extends TelephonyTest {
        verifyAllDataDisconnected();
    }

    @Test
    public void testHandoverDataNetworkSourceOos() throws Exception {
        testSetupImsDataNetwork();
        // Configured handover is allowed from OOS to 4G/5G/IWLAN.
        mCarrierConfig.putStringArray(
                CarrierConfigManager.KEY_IWLAN_HANDOVER_POLICY_STRING_ARRAY,
                new String[]{
                        "source=EUTRAN|NGRAN|IWLAN|UNKNOWN, target=EUTRAN|NGRAN|IWLAN, "
                                + "type=disallowed, capabilities=IMS|EIMS|MMS|XCAP|CBS"
                });
        carrierConfigChanged();
        serviceStateChanged(TelephonyManager.NETWORK_TYPE_LTE,
                NetworkRegistrationInfo.REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING);

        updateTransport(NetworkCapabilities.NET_CAPABILITY_IMS,
                AccessNetworkConstants.TRANSPORT_TYPE_WLAN);

        // Verify IMS network was torn down on source first.
        verify(mMockedWwanDataServiceManager).deactivateDataCall(anyInt(),
                eq(DataService.REQUEST_REASON_NORMAL), any(Message.class));

        // Verify that IWLAN is brought up again on IWLAN.
        verify(mMockedWlanDataServiceManager).setupDataCall(anyInt(),
                any(DataProfile.class), anyBoolean(), anyBoolean(),
                eq(DataService.REQUEST_REASON_NORMAL), any(), anyInt(), any(), any(), anyBoolean(),
                any(Message.class));

        DataNetwork dataNetwork = getDataNetworks().get(0);
        assertThat(dataNetwork.getTransport()).isEqualTo(
                AccessNetworkConstants.TRANSPORT_TYPE_WLAN);
    }

    @Test
    public void testHandoverDataNetworkNonVops() throws Exception {
        ServiceState ss = new ServiceState();