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

Commit 9a0f082c authored by Jack Yu's avatar Jack Yu Committed by Automerger Merge Worker
Browse files

Merge "Fixed two IMS data profiles sent to modem" into tm-d1-dev am:...

Merge "Fixed two IMS data profiles sent to modem" into tm-d1-dev am: b0837cf7 am: 5f9a8245 am: fe023e7e

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



Change-Id: Ifb8b0fe9730871647e18b77234edc0e1fc565544
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents b545bf9d fe023e7e
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -60,11 +60,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
@@ -403,6 +405,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!");
@@ -894,4 +902,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);
    }
}