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

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

Remove WLAN MMS related deadcode

The deadcode was added in ag/24326258 to allow bring up WLAN mms network even when a
default network that's capable of mms already exists. This code is no
longer used because once QNS preferrs on WLAN, the MMS capability of the
existing network is removed, hence new WLAN MMS network will be brought
up naturally

Test: voice call + data browsing
Bug: cleanup
Change-Id: I7f94e11e968444f1ded8d88d413321291acc04e8
parent e6312915
Loading
Loading
Loading
Loading
+2 −7
Original line number Diff line number Diff line
@@ -1097,12 +1097,7 @@ public class DataNetwork extends StateMachine {
                mPhone.getPhoneId());
        final NetworkProvider provider = (null == factory) ? null : factory.getProvider();

        // Always prefer IWLAN network for MMS designated network.
        // TODO(b/293656884) Proper use of primary transport to avoid conflicting with DSDA.
        boolean isPreferred = mTransport == AccessNetworkConstants.TRANSPORT_TYPE_WLAN
                && getApnTypeNetworkCapability() == NetworkCapabilities.NET_CAPABILITY_MMS;

        mNetworkScore = new NetworkScore.Builder().setTransportPrimary(isPreferred)
        mNetworkScore = new NetworkScore.Builder()
               .setKeepConnectedReason(isHandoverInProgress()
                        ? NetworkScore.KEEP_CONNECTED_FOR_HANDOVER
                        : NetworkScore.KEEP_CONNECTED_NONE).build();
+0 −22
Original line number Diff line number Diff line
@@ -1359,28 +1359,6 @@ public class DataNetworkController extends Handler {
            // When reaching here, it means this data network can satisfy all the network requests.
            logv("Found a compatible data network " + dataNetwork + ". Attaching "
                    + requestList);

            // If WLAN preferred, see whether a more suitable data profile shall be used to satisfy
            // a short-lived request that doesn't perform handover.
            int capability = requestList.getFirst().getApnTypeNetworkCapability();
            int preferredTransport = mAccessNetworksManager
                    .getPreferredTransportByNetworkCapability(capability);
            if (capability == NetworkCapabilities.NET_CAPABILITY_MMS
                    && preferredTransport != dataNetwork.getTransport()
                    && preferredTransport == AccessNetworkConstants.TRANSPORT_TYPE_WLAN) {
                DataProfile candidate = mDataProfileManager
                        .getDataProfileForNetworkRequest(requestList.getFirst(),
                                TelephonyManager.NETWORK_TYPE_IWLAN,
                                mServiceState.isUsingNonTerrestrialNetwork(),
                                isEsimBootStrapProvisioningActivated(),
                                false/*ignorePermanentFailure*/);
                if (candidate != null && !dataNetwork.getDataProfile().equals(candidate)) {
                    logv("But skipped because found better data profile " + candidate
                            + DataUtils.networkCapabilityToString(capability) + " preferred on "
                            + AccessNetworkConstants.transportTypeToString(preferredTransport));
                    continue;
                }
            }
            return dataNetwork.attachNetworkRequests(requestList);
        }
        return false;
+1 −40
Original line number Diff line number Diff line
@@ -393,17 +393,6 @@ public class DataNetworkControllerTest extends TelephonyTest {
                            "PRIORITIZE_LATENCY", 1).getBytes()))
            .build();

    private final DataProfile mMmsOnWlanDataProfile = new DataProfile.Builder()
            .setApnSetting(new ApnSetting.Builder()
                    .setEntryName("mms_wlan")
                    .setApnName("mms_wlan")
                    .setApnTypeBitmask(ApnSetting.TYPE_MMS)
                    .setCarrierEnabled(true)
                    .setNetworkTypeBitmask((int) TelephonyManager.NETWORK_TYPE_BITMASK_IWLAN)
                    .build())
            .setPreferred(false)
            .build();

    private final DataProfile mNtnDataProfile = new DataProfile.Builder()
            .setApnSetting(new ApnSetting.Builder()
                    .setEntryName("ntn")
@@ -1002,7 +991,7 @@ public class DataNetworkControllerTest extends TelephonyTest {
        List<DataProfile> profiles = List.of(mGeneralPurposeDataProfile,
                mGeneralPurposeDataProfileAlternative, mImsCellularDataProfile,
                mImsIwlanDataProfile, mEmergencyDataProfile, mFotaDataProfile,
                mTetheringDataProfile, mMmsOnWlanDataProfile, mLowLatencyDataProfile,
                mTetheringDataProfile, mLowLatencyDataProfile,
                mNtnDataProfile, mEsimBootstrapDataProfile,
                mEsimBootstrapImsProfile, mEsimBootstrapRcsInfraStructureProfile);

@@ -5036,34 +5025,6 @@ public class DataNetworkControllerTest extends TelephonyTest {
                NetworkCapabilities.NET_CAPABILITY_PRIORITIZE_LATENCY)).isTrue();
    }

    @Test
    public void testAllowBringUpWithDifferentDataProfileForWlan() throws Exception {
        // Mock MMS preferred on WLAN
        doReturn(AccessNetworkConstants.TRANSPORT_TYPE_WLAN).when(mAccessNetworksManager)
                .getPreferredTransportByNetworkCapability(NetworkCapabilities.NET_CAPABILITY_MMS);

        // Setup a default cellular network that's capable of MMS
        mDataNetworkControllerUT.addNetworkRequest(
                createNetworkRequest(NetworkCapabilities.NET_CAPABILITY_INTERNET));
        mDataNetworkControllerUT.addNetworkRequest(
                createNetworkRequest(NetworkCapabilities.NET_CAPABILITY_IMS));
        processAllMessages();
        verifyConnectedNetworkHasDataProfile(mGeneralPurposeDataProfile);

        // Mock the designated MMS profile when WLAN is preferred
        doReturn(mMmsOnWlanDataProfile).when(mDataProfileManager).getDataProfileForNetworkRequest(
                any(TelephonyNetworkRequest.class), eq(TelephonyManager.NETWORK_TYPE_IWLAN),
                anyBoolean(), anyBoolean(), anyBoolean());
        setSuccessfulSetupDataResponse(mMockedWlanDataServiceManager,
                createDataCallResponse(2, DataCallResponse.LINK_STATUS_ACTIVE));

        // Verify the designated MMS profile is used to satisfy MMS request
        mDataNetworkControllerUT.addNetworkRequest(
                createNetworkRequest(NetworkCapabilities.NET_CAPABILITY_MMS));
        processAllMessages();
        verifyConnectedNetworkHasDataProfile(mMmsOnWlanDataProfile);
    }

    @Test
    public void testNonTerrestrialNetwork() throws Exception {
        mIsNonTerrestrialNetwork = true;