Loading src/java/com/android/internal/telephony/data/DataProfileManager.java +1 −1 Original line number Diff line number Diff line Loading @@ -273,7 +273,7 @@ public class DataProfileManager extends Handler { } // Check if any of the profile already supports IMS, if not, add the default one. DataProfile dataProfile = profiles.stream() dataProfile = profiles.stream() .filter(dp -> dp.canSatisfy(NetworkCapabilities.NET_CAPABILITY_IMS)) .findFirst() .orElse(null); Loading tests/telephonytests/src/com/android/internal/telephony/data/DataProfileManagerTest.java +19 −0 Original line number Diff line number Diff line Loading @@ -59,11 +59,13 @@ import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Mockito; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; @RunWith(AndroidTestingRunner.class) @TestableLooper.RunWithLooper Loading Loading @@ -400,6 +402,12 @@ public class DataProfileManagerTest extends TelephonyTest { method.invoke(mDataProfileManagerUT, dataProfiles); } private @NonNull List<DataProfile> getAllDataProfiles() throws Exception { Field field = DataProfileManager.class.getDeclaredField("mAllDataProfiles"); field.setAccessible(true); return (List<DataProfile>) field.get(mDataProfileManagerUT); } @Before public void setUp() throws Exception { logd("DataProfileManagerTest +Setup!"); Loading Loading @@ -886,4 +894,15 @@ public class DataProfileManagerTest extends TelephonyTest { assertThat(mDataProfileManagerUT.isTetheringDataProfileExisting( TelephonyManager.NETWORK_TYPE_NR)).isFalse(); } @Test public void testNoDefaultIms() throws Exception { List<DataProfile> dataProfiles = getAllDataProfiles(); // Since the database already had IMS, there should not be default IMS created in the // database. assertThat(dataProfiles.stream() .filter(dp -> dp.canSatisfy(NetworkCapabilities.NET_CAPABILITY_IMS)) .collect(Collectors.toList())).hasSize(1); } } Loading
src/java/com/android/internal/telephony/data/DataProfileManager.java +1 −1 Original line number Diff line number Diff line Loading @@ -273,7 +273,7 @@ public class DataProfileManager extends Handler { } // Check if any of the profile already supports IMS, if not, add the default one. DataProfile dataProfile = profiles.stream() dataProfile = profiles.stream() .filter(dp -> dp.canSatisfy(NetworkCapabilities.NET_CAPABILITY_IMS)) .findFirst() .orElse(null); Loading
tests/telephonytests/src/com/android/internal/telephony/data/DataProfileManagerTest.java +19 −0 Original line number Diff line number Diff line Loading @@ -59,11 +59,13 @@ import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Mockito; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; @RunWith(AndroidTestingRunner.class) @TestableLooper.RunWithLooper Loading Loading @@ -400,6 +402,12 @@ public class DataProfileManagerTest extends TelephonyTest { method.invoke(mDataProfileManagerUT, dataProfiles); } private @NonNull List<DataProfile> getAllDataProfiles() throws Exception { Field field = DataProfileManager.class.getDeclaredField("mAllDataProfiles"); field.setAccessible(true); return (List<DataProfile>) field.get(mDataProfileManagerUT); } @Before public void setUp() throws Exception { logd("DataProfileManagerTest +Setup!"); Loading Loading @@ -886,4 +894,15 @@ public class DataProfileManagerTest extends TelephonyTest { assertThat(mDataProfileManagerUT.isTetheringDataProfileExisting( TelephonyManager.NETWORK_TYPE_NR)).isFalse(); } @Test public void testNoDefaultIms() throws Exception { List<DataProfile> dataProfiles = getAllDataProfiles(); // Since the database already had IMS, there should not be default IMS created in the // database. assertThat(dataProfiles.stream() .filter(dp -> dp.canSatisfy(NetworkCapabilities.NET_CAPABILITY_IMS)) .collect(Collectors.toList())).hasSize(1); } }