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

Commit 4112c21f authored by Ling Ma's avatar Ling Ma Committed by Jack Yu
Browse files

Implement carrier config key KEY_KEEP_PDN_UP_IN_NO_VOPS_BOOL

If the config key is true, allow IMS network linger when UE enter from VoPS area to NoVoPS area.

Bug: 252906532
Test: atest + basic placing phone call + data browsing
Merged-In: Ib149939dadee04f9a9e71656c1d9f02fe7400ca9
Change-Id: Ib149939dadee04f9a9e71656c1d9f02fe7400ca9
parent 55d51be9
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -321,6 +321,8 @@ public class DataConfigManager extends Handler {
            new ConcurrentHashMap<>();
    /** Rules for handover between IWLAN and cellular network. */
    private @NonNull final List<HandoverRule> mHandoverRuleList = new ArrayList<>();
    /** {@code True} keep IMS network in case of moving to non VOPS area; {@code false} otherwise.*/
    private boolean mShouldKeepNetworkUpInNonVops = false;

    /**
     * Constructor
@@ -482,6 +484,7 @@ public class DataConfigManager extends Handler {
        updateDataRetryRules();
        updateMeteredApnTypes();
        updateSingleDataNetworkTypeAndCapabilityExemption();
        updateVopsConfig();
        updateUnmeteredNetworkTypes();
        updateBandwidths();
        updateTcpBuffers();
@@ -692,6 +695,16 @@ public class DataConfigManager extends Handler {
        }
    }

    /**
     * Update the voice over PS related config from the carrier config.
     */
    private void updateVopsConfig() {
        synchronized (this) {
            mShouldKeepNetworkUpInNonVops = mCarrierConfig.getBoolean(CarrierConfigManager
                    .Ims.KEY_KEEP_PDN_UP_IN_NO_VOPS_BOOL);
        }
    }

    /**
     * @return The list of {@link NetworkType} that only supports single data networks
     */
@@ -707,6 +720,11 @@ public class DataConfigManager extends Handler {
        return Collections.unmodifiableSet(mCapabilitiesExemptFromSingleDataList);
    }

    /** {@code True} keep IMS network in case of moving to non VOPS area; {@code false} otherwise.*/
    public boolean shouldKeepNetworkUpInNonVops() {
        return mShouldKeepNetworkUpInNonVops;
    }

    /**
     * @return Whether {@link NetworkCapabilities#NET_CAPABILITY_TEMPORARILY_NOT_METERED}
     * is supported by the carrier.
@@ -1338,6 +1356,7 @@ public class DataConfigManager extends Handler {
        pw.println("Capabilities exempt from single PDN=" + mCapabilitiesExemptFromSingleDataList
                .stream().map(DataUtils::networkCapabilityToString)
                .collect(Collectors.joining(",")));
        pw.println("mShouldKeepNetworkUpInNoVops=" + mShouldKeepNetworkUpInNonVops);
        pw.println("Unmetered network types=" + String.join(",", mUnmeteredNetworkTypes));
        pw.println("Roaming unmetered network types="
                + String.join(",", mRoamingUnmeteredNetworkTypes));
+2 −1
Original line number Diff line number Diff line
@@ -1896,7 +1896,8 @@ public class DataNetwork extends StateMachine {
                        DataSpecificRegistrationInfo dsri = nri.getDataSpecificInfo();
                        // Check if the network is non-VoPS.
                        if (dsri != null && dsri.getVopsSupportInfo() != null
                                && !dsri.getVopsSupportInfo().isVopsSupported()) {
                                && !dsri.getVopsSupportInfo().isVopsSupported()
                                && !mDataConfigManager.shouldKeepNetworkUpInNonVops()) {
                            builder.removeCapability(NetworkCapabilities.NET_CAPABILITY_MMTEL);
                        }
                        log("updateNetworkCapabilities: dsri=" + dsri);
+4 −2
Original line number Diff line number Diff line
@@ -1755,7 +1755,8 @@ public class DataNetworkController extends Handler {
                    if (nri != null) {
                        DataSpecificRegistrationInfo dsri = nri.getDataSpecificInfo();
                        if (dsri != null && dsri.getVopsSupportInfo() != null
                                && !dsri.getVopsSupportInfo().isVopsSupported()) {
                                && !dsri.getVopsSupportInfo().isVopsSupported()
                                && !mDataConfigManager.shouldKeepNetworkUpInNonVops()) {
                            evaluation.addDataDisallowedReason(
                                    DataDisallowedReason.VOPS_NOT_SUPPORTED);
                        }
@@ -1916,7 +1917,8 @@ public class DataNetworkController extends Handler {
                    DataSpecificRegistrationInfo dsri = nri.getDataSpecificInfo();
                    // Check if the network is non-VoPS.
                    if (dsri != null && dsri.getVopsSupportInfo() != null
                            && !dsri.getVopsSupportInfo().isVopsSupported()) {
                            && !dsri.getVopsSupportInfo().isVopsSupported()
                            && !mDataConfigManager.shouldKeepNetworkUpInNonVops()) {
                        dataEvaluation.addDataDisallowedReason(
                                DataDisallowedReason.VOPS_NOT_SUPPORTED);
                    }
+82 −0
Original line number Diff line number Diff line
@@ -3045,6 +3045,10 @@ public class DataNetworkControllerTest extends TelephonyTest {

    @Test
    public void testNonVoPStoVoPSImsSetup() throws Exception {
        // Even allow lingering when NoVops, should have no effect on NoVops -> Vops
        mCarrierConfig.putBoolean(CarrierConfigManager.Ims.KEY_KEEP_PDN_UP_IN_NO_VOPS_BOOL, true);
        carrierConfigChanged();

        // VOPS not supported
        DataSpecificRegistrationInfo dsri = new DataSpecificRegistrationInfo(8, false, true, true,
                new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED,
@@ -3556,6 +3560,70 @@ public class DataNetworkControllerTest extends TelephonyTest {
        verifyAllDataDisconnected();
    }

    @Test
    public void testHandoverDataNetworkNonVopsAllowLingeringVoPS() throws Exception {
        // Allow lingering IMS PDN when enter area VoPS -> no VoPS
        mCarrierConfig.putBoolean(CarrierConfigManager.Ims.KEY_KEEP_PDN_UP_IN_NO_VOPS_BOOL, true);
        carrierConfigChanged();

        ServiceState ss = new ServiceState();

        DataSpecificRegistrationInfo dsri = new DataSpecificRegistrationInfo(8, false, true, true,
                new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED,
                        LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED));

        ss.addNetworkRegistrationInfo(new NetworkRegistrationInfo.Builder()
                .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
                .setAccessNetworkTechnology(TelephonyManager.NETWORK_TYPE_LTE)
                .setRegistrationState(NetworkRegistrationInfo.REGISTRATION_STATE_HOME)
                .setDomain(NetworkRegistrationInfo.DOMAIN_PS)
                .setDataSpecificInfo(dsri)
                .build());

        ss.addNetworkRegistrationInfo(new NetworkRegistrationInfo.Builder()
                .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WLAN)
                .setAccessNetworkTechnology(TelephonyManager.NETWORK_TYPE_IWLAN)
                .setRegistrationState(NetworkRegistrationInfo.REGISTRATION_STATE_HOME)
                .setDomain(NetworkRegistrationInfo.DOMAIN_PS)
                .build());

        ss.addNetworkRegistrationInfo(new NetworkRegistrationInfo.Builder()
                .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
                .setAccessNetworkTechnology(TelephonyManager.NETWORK_TYPE_LTE)
                .setRegistrationState(NetworkRegistrationInfo.REGISTRATION_STATE_HOME)
                .setDomain(NetworkRegistrationInfo.DOMAIN_CS)
                .build());
        processServiceStateRegStateForTest(ss);
        doReturn(ss).when(mSST).getServiceState();
        doReturn(ss).when(mPhone).getServiceState();

        doReturn(AccessNetworkConstants.TRANSPORT_TYPE_WLAN).when(mAccessNetworksManager)
                .getPreferredTransportByNetworkCapability(NetworkCapabilities.NET_CAPABILITY_IMS);

        mDataNetworkControllerUT.obtainMessage(17/*EVENT_SERVICE_STATE_CHANGED*/).sendToTarget();
        processAllMessages();

        mDataNetworkControllerUT.addNetworkRequest(
                createNetworkRequest(NetworkCapabilities.NET_CAPABILITY_IMS,
                        NetworkCapabilities.NET_CAPABILITY_MMTEL));
        processAllMessages();
        verifyConnectedNetworkHasCapabilities(NetworkCapabilities.NET_CAPABILITY_IMS,
                NetworkCapabilities.NET_CAPABILITY_MMTEL);

        // Change the preference to cellular
        updateTransport(NetworkCapabilities.NET_CAPABILITY_IMS,
                AccessNetworkConstants.TRANSPORT_TYPE_WWAN);

        // Verify that handover is not performed.
        verify(mMockedWwanDataServiceManager).setupDataCall(anyInt(),
                any(DataProfile.class), anyBoolean(), anyBoolean(), anyInt(), any(), anyInt(),
                any(), any(), anyBoolean(), any(Message.class));

        // IMS network still alive.
        verifyConnectedNetworkHasCapabilities(NetworkCapabilities.NET_CAPABILITY_IMS,
                NetworkCapabilities.NET_CAPABILITY_MMTEL);
    }

    @Test
    public void testNonMmtelImsHandoverDataNetworkNonVops() throws Exception {
        ServiceState ss = new ServiceState();
@@ -3621,6 +3689,10 @@ public class DataNetworkControllerTest extends TelephonyTest {

    @Test
    public void testMmtelImsDataNetworkMovingToNonVops() throws Exception {
        // Allow lingering IMS PDN when enter area VoPS -> no VoPS
        mCarrierConfig.putBoolean(CarrierConfigManager.Ims.KEY_KEEP_PDN_UP_IN_NO_VOPS_BOOL, true);
        carrierConfigChanged();

        ServiceState ss = new ServiceState();

        // VoPS network
@@ -3703,6 +3775,16 @@ public class DataNetworkControllerTest extends TelephonyTest {
        mDataNetworkControllerUT.obtainMessage(17/*EVENT_SERVICE_STATE_CHANGED*/).sendToTarget();
        processAllMessages();

        // The IMS network is alive due to KEY_KEEP_PDN_UP_IN_NO_VOPS_BOOL = true
        verifyConnectedNetworkHasCapabilities(NetworkCapabilities.NET_CAPABILITY_IMS,
                NetworkCapabilities.NET_CAPABILITY_MMTEL);

        mCarrierConfig.putBoolean(CarrierConfigManager.Ims.KEY_KEEP_PDN_UP_IN_NO_VOPS_BOOL, false);
        carrierConfigChanged();
        mDataNetworkControllerUT.obtainMessage(16/*EVENT_REEVALUATE_EXISTING_DATA_NETWORKS*/)
                .sendToTarget();
        processAllMessages();

        // The IMS network should be torn down by data network controller.
        verifyNoConnectedNetworkHasCapability(NetworkCapabilities.NET_CAPABILITY_IMS);
        verifyNoConnectedNetworkHasCapability(NetworkCapabilities.NET_CAPABILITY_MMTEL);