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

Commit 4adacafb authored by Sarah Chin's avatar Sarah Chin
Browse files

DataProfileManager check for MATCH_ALL_APN_SET_ID

Test: atest DataProfileManagerTest fail before/pass after
Bug: 222020651
Change-Id: I4f9e18f711783f231d40069fff0e7672ee115f24
Merged-In: I4f9e18f711783f231d40069fff0e7672ee115f24
parent 34a07171
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -684,7 +684,8 @@ public class DataProfileManager extends Handler {
        return mAllDataProfiles.contains(dataProfile)
                && (dataProfile.getApnSetting() == null
                || dataProfile.getApnSetting().getApnSetId() == mPreferredDataProfileSetId
                || mPreferredDataProfileSetId == Telephony.Carriers.MATCH_ALL_APN_SET_ID);
                || dataProfile.getApnSetting().getApnSetId()
                == Telephony.Carriers.MATCH_ALL_APN_SET_ID);
    }

    /**
+21 −1
Original line number Diff line number Diff line
@@ -677,7 +677,6 @@ public class DataProfileManagerTest extends TelephonyTest {

    @Test
    public void testDedupeDataProfiles2() throws Exception {

        DataProfile dataProfile1 = new DataProfile.Builder()
                .setApnSetting(new ApnSetting.Builder()
                        .setEntryName("general")
@@ -744,4 +743,25 @@ public class DataProfileManagerTest extends TelephonyTest {
        assertThat(dataProfile.getApnSetting().getRoamingProtocol())
                .isEqualTo(ApnSetting.PROTOCOL_IPV4V6);
    }

    @Test
    public void testIsDataProfileValid() {
        TelephonyNetworkRequest tnr = new TelephonyNetworkRequest(new NetworkRequest.Builder()
                .addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
                .build(), mPhone);
        DataProfile dataProfile = mDataProfileManagerUT.getDataProfileForNetworkRequest(
                tnr, TelephonyManager.NETWORK_TYPE_LTE);
        assertThat(dataProfile.getApnSetting().getApnSetId()).isEqualTo(
                Telephony.Carriers.NO_APN_SET_ID);
        assertThat(mDataProfileManagerUT.isDataProfileValid(dataProfile)).isTrue();

        tnr = new TelephonyNetworkRequest(new NetworkRequest.Builder()
                .addCapability(NetworkCapabilities.NET_CAPABILITY_EIMS)
                .build(), mPhone);
        dataProfile = mDataProfileManagerUT.getDataProfileForNetworkRequest(
                tnr, TelephonyManager.NETWORK_TYPE_LTE);
        assertThat(dataProfile.getApnSetting().getApnSetId()).isEqualTo(
                Telephony.Carriers.MATCH_ALL_APN_SET_ID);
        assertThat(mDataProfileManagerUT.isDataProfileValid(dataProfile)).isTrue();
    }
}