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

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

Update matchAllRuleAllowed flag condition

To satisfy LTE/NR private networks where both APN name and traffic descriptor are empty.

Fix: 291528906
Test: manual phone call + data browsing
Test: daily test b/296088621
Change-Id: I01bf371038393b08382a8924aeecfc089ed17718
parent 442836f8
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -1351,7 +1351,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
@@ -185,6 +185,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();

    private final Qos mDefaultQos = new EpsQos(
            new Qos.QosBandwidth(1000, 1),
            new Qos.QosBandwidth(1000, 0),
@@ -1823,6 +1845,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();