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

Commit 4bc5d08b authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Update matchAllRuleAllowed flag condition" into udc-qpr-dev

parents 9550ecc5 fa19a50f
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -2239,7 +2239,11 @@ public class DataNetwork extends StateMachine {

        TrafficDescriptor trafficDescriptor = mDataProfile.getTrafficDescriptor();
        final boolean matchAllRuleAllowed = trafficDescriptor == null
                || !TextUtils.isEmpty(trafficDescriptor.getDataNetworkName());
                || !TextUtils.isEmpty(trafficDescriptor.getDataNetworkName())
                // Both OsAppId and APN name are null. This helps for modem to handle when we
                // are on 5G or LTE with URSP support in falling back to default network.
                || (TextUtils.isEmpty(trafficDescriptor.getDataNetworkName())
                && trafficDescriptor.getOsAppId() == null);

        int accessNetwork = DataUtils.networkTypeToAccessNetworkType(dataNetworkType);

+44 −0
Original line number Diff line number Diff line
@@ -182,6 +182,28 @@ public class DataNetworkTest extends TelephonyTest {
                            "CBS", 1).getBytes()))
            .build();

    private final DataProfile m5gDataProfile = new DataProfile.Builder()
            .setApnSetting(new ApnSetting.Builder()
                    .setId(2163)
                    .setOperatorNumeric("12345")
                    .setEntryName("fake_apn")
                    .setApnName(null /*empty name*/)
                    .setUser("user")
                    .setPassword("passwd")
                    .setApnTypeBitmask(ApnSetting.TYPE_DEFAULT | ApnSetting.TYPE_SUPL)
                    .setProtocol(ApnSetting.PROTOCOL_IPV6)
                    .setRoamingProtocol(ApnSetting.PROTOCOL_IP)
                    .setCarrierEnabled(true)
                    .setNetworkTypeBitmask((int) (TelephonyManager.NETWORK_TYPE_BITMASK_LTE
                            | TelephonyManager.NETWORK_TYPE_BITMASK_NR))
                    .setProfileId(1234)
                    .setMaxConns(321)
                    .setWaitTime(456)
                    .setMaxConnsTime(789)
                    .build())
            .setTrafficDescriptor(new TrafficDescriptor(null, null))
            .build();

    // Mocked classes
    private DataNetworkCallback mDataNetworkCallback;
    private DataCallSessionStats mDataCallSessionStats;
@@ -1776,6 +1798,28 @@ public class DataNetworkTest extends TelephonyTest {
                InetAddresses.parseNumericAddress(IPV4_ADDRESS));
    }

    @Test
    public void testPrivateNetwork() throws Exception {
        NetworkRequestList networkRequestList = new NetworkRequestList();
        networkRequestList.add(new TelephonyNetworkRequest(new NetworkRequest.Builder()
                .addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
                .build(), mPhone));
        mDataNetworkUT = new DataNetwork(mPhone, Looper.myLooper(), mDataServiceManagers,
                m5gDataProfile, networkRequestList,
                AccessNetworkConstants.TRANSPORT_TYPE_WWAN, DataAllowedReason.NORMAL,
                mDataNetworkCallback);
        replaceInstance(DataNetwork.class, "mDataCallSessionStats",
                mDataNetworkUT, mDataCallSessionStats);
        processAllMessages();

        verify(mMockedWwanDataServiceManager).setupDataCall(anyInt(),
                eq(m5gDataProfile), eq(false), eq(false),
                eq(DataService.REQUEST_REASON_NORMAL), nullable(LinkProperties.class),
                eq(DataCallResponse.PDU_SESSION_ID_NOT_SET), nullable(NetworkSliceInfo.class),
                // Verify matchAllRuleAllowed is flagged true
                any(TrafficDescriptor.class), eq(true), any(Message.class));
    }

    @Test
    public void testLinkStatusUpdate() throws Exception {
        setupDataNetwork();