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

Commit db97c236 authored by Ling Ma's avatar Ling Ma Committed by Automerger Merge Worker
Browse files

Merge "Don't add default IMS data profile before SIM loaded" am: 150930a5...

Merge "Don't add default IMS data profile before SIM loaded" am: 150930a5 am: df667a1b am: ff1f4258

Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/2217562



Change-Id: Iaf878b02f314da92922c9f4180c138de9fd011c5
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents e4f7cca2 ff1f4258
Loading
Loading
Loading
Loading
+19 −15
Original line number Diff line number Diff line
@@ -293,20 +293,9 @@ public class DataProfileManager extends Handler {
            }
        }

        // Check if any of the profile already supports ENTERPRISE, if not, check if DPC has
        // configured one and retrieve the same.
        DataProfile dataProfile = profiles.stream()
                .filter(dp -> dp.canSatisfy(NetworkCapabilities.NET_CAPABILITY_ENTERPRISE))
                .findFirst()
                .orElse(null);
        if (dataProfile == null) {
            dataProfile = getEnterpriseDataProfile();
            if (dataProfile != null) {
                profiles.add(dataProfile);
                log("Added enterprise profile " + dataProfile);
            }
        }
        DataProfile dataProfile;

        if (!profiles.isEmpty()) { // APN database has been read successfully after SIM loaded
            // Check if any of the profile already supports IMS, if not, add the default one.
            dataProfile = profiles.stream()
                    .filter(dp -> dp.canSatisfy(NetworkCapabilities.NET_CAPABILITY_IMS))
@@ -320,6 +309,21 @@ public class DataProfileManager extends Handler {
                        .build());
                log("Added default IMS data profile.");
            }
        }

        // Check if any of the profile already supports ENTERPRISE, if not, check if DPC has
        // configured one and retrieve the same.
        dataProfile = profiles.stream()
                .filter(dp -> dp.canSatisfy(NetworkCapabilities.NET_CAPABILITY_ENTERPRISE))
                .findFirst()
                .orElse(null);
        if (dataProfile == null) {
            dataProfile = getEnterpriseDataProfile();
            if (dataProfile != null) {
                profiles.add(dataProfile);
                log("Added enterprise profile " + dataProfile);
            }
        }

        // Check if any of the profile already supports EIMS, if not, add the default one.
        dataProfile = profiles.stream()
+3 −1
Original line number Diff line number Diff line
@@ -718,6 +718,7 @@ public class DataProfileManagerTest extends TelephonyTest {
                tnr, TelephonyManager.NETWORK_TYPE_LTE);
        assertThat(dataProfile).isNull();

        // expect default EIMS when SIM absent
        tnr = new TelephonyNetworkRequest(
                new NetworkRequest.Builder()
                        .addCapability(NetworkCapabilities.NET_CAPABILITY_EIMS)
@@ -726,13 +727,14 @@ public class DataProfileManagerTest extends TelephonyTest {
                tnr, TelephonyManager.NETWORK_TYPE_LTE);
        assertThat(dataProfile.getApnSetting().getApnName()).isEqualTo("sos");

        // expect no default IMS when SIM absent
        tnr = new TelephonyNetworkRequest(
                new NetworkRequest.Builder()
                        .addCapability(NetworkCapabilities.NET_CAPABILITY_IMS)
                        .build(), mPhone);
        dataProfile = mDataProfileManagerUT.getDataProfileForNetworkRequest(
                tnr, TelephonyManager.NETWORK_TYPE_LTE);
        assertThat(dataProfile.getApnSetting().getApnName()).isEqualTo("ims");
        assertThat(dataProfile).isEqualTo(null);
    }

    @Test