Loading src/java/com/android/internal/telephony/data/DataProfileManager.java +19 −15 Original line number Diff line number Diff line Loading @@ -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)) Loading @@ -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() Loading tests/telephonytests/src/com/android/internal/telephony/data/DataProfileManagerTest.java +3 −1 Original line number Diff line number Diff line Loading @@ -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) Loading @@ -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 Loading Loading
src/java/com/android/internal/telephony/data/DataProfileManager.java +19 −15 Original line number Diff line number Diff line Loading @@ -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)) Loading @@ -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() Loading
tests/telephonytests/src/com/android/internal/telephony/data/DataProfileManagerTest.java +3 −1 Original line number Diff line number Diff line Loading @@ -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) Loading @@ -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 Loading