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

Commit 9a9f83ec authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "DataProfileManager check for MATCH_ALL_APN_SET_ID"

parents e7fa69ec 4adacafb
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
@@ -689,7 +689,6 @@ public class DataProfileManagerTest extends TelephonyTest {

    @Test
    public void testDedupeDataProfiles2() throws Exception {

        DataProfile dataProfile1 = new DataProfile.Builder()
                .setApnSetting(new ApnSetting.Builder()
                        .setEntryName("general")
@@ -756,4 +755,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();
    }
}