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

Commit a2cc639b 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 am: db97c236

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



Change-Id: I0ae2ce9031e8828515199f8fe20b073243066bfa
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 1495c0af db97c236
Loading
Loading
Loading
Loading
+19 −15
Original line number Original line 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
        DataProfile dataProfile;
        // 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);
            }
        }


        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.
            // Check if any of the profile already supports IMS, if not, add the default one.
            dataProfile = profiles.stream()
            dataProfile = profiles.stream()
                    .filter(dp -> dp.canSatisfy(NetworkCapabilities.NET_CAPABILITY_IMS))
                    .filter(dp -> dp.canSatisfy(NetworkCapabilities.NET_CAPABILITY_IMS))
@@ -320,6 +309,21 @@ public class DataProfileManager extends Handler {
                        .build());
                        .build());
                log("Added default IMS data profile.");
                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.
        // Check if any of the profile already supports EIMS, if not, add the default one.
        dataProfile = profiles.stream()
        dataProfile = profiles.stream()
+3 −1
Original line number Original line Diff line number Diff line
@@ -718,6 +718,7 @@ public class DataProfileManagerTest extends TelephonyTest {
                tnr, TelephonyManager.NETWORK_TYPE_LTE);
                tnr, TelephonyManager.NETWORK_TYPE_LTE);
        assertThat(dataProfile).isNull();
        assertThat(dataProfile).isNull();


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


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


    @Test
    @Test