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

Commit 364a4acf authored by Hunsuk Choi's avatar Hunsuk Choi Committed by Android (Google) Code Review
Browse files

Merge "Don't check IMS service binding when connecting domain selector" into main

parents b8bee868 18b51c43
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -150,9 +150,14 @@ public class DomainSelectionResolver {
            throw new IllegalStateException("DomainSelection is not supported!");
        }

        if (phone == null || !phone.isImsAvailable()) {
            // If ImsPhone is null or the binder of ImsService is not available,
            // CS domain is used for the telephony services.
        if (phone == null || phone.getImsPhone() == null
                || (!(isEmergency && selectorType == DomainSelectionService.SELECTOR_TYPE_CALLING)
                        && !phone.isImsAvailable())) {
            // In case of emergency calls, to recover the temporary failure in IMS service
            // connection, DomainSelection shall be started even when IMS isn't available.
            // DomainSelector will keep finding next available transport.
            // For other telephony services, if the binder of ImsService is not available,
            // CS domain will be used.
            return null;
        }

+27 −1
Original line number Diff line number Diff line
@@ -135,14 +135,39 @@ public class DomainSelectionResolverTest extends TelephonyTest {
        assertNull(mDsResolver.getDomainSelectionConnection(null, SELECTOR_TYPE_CALLING, true));
    }

    @Test
    @SmallTest
    public void testGetDomainSelectionConnectionWhenImsPhoneNull() throws Exception {
        setUpResolver(true, RADIO_HAL_VERSION_2_1);
        mDsResolver.initialize(mDsService);
        when(mPhone.getImsPhone()).thenReturn(null);

        assertNull(mDsResolver.getDomainSelectionConnection(mPhone, SELECTOR_TYPE_CALLING, true));
    }

    @Test
    @SmallTest
    public void testGetDomainSelectionConnectionWhenImsNotAvailable() throws Exception {
        setUpResolver(true, RADIO_HAL_VERSION_2_1);
        mDsResolver.initialize(mDsService);
        when(mPhone.isImsAvailable()).thenReturn(false);
        when(mPhone.getImsPhone()).thenReturn(mImsPhone);

        assertNull(mDsResolver.getDomainSelectionConnection(mPhone, SELECTOR_TYPE_CALLING, true));
        assertNull(mDsResolver.getDomainSelectionConnection(mPhone, SELECTOR_TYPE_CALLING, false));
    }

    @Test
    @SmallTest
    public void testGetDomainSelectionConnectionWhenImsNotAvailableForEmergencyCall()
            throws Exception {
        setUpResolver(true, RADIO_HAL_VERSION_2_1);
        setUpController();
        mDsResolver.initialize(mDsService);
        when(mPhone.isImsAvailable()).thenReturn(false);
        when(mPhone.getImsPhone()).thenReturn(mImsPhone);

        assertNotNull(mDsResolver.getDomainSelectionConnection(mPhone,
                SELECTOR_TYPE_CALLING, true));
    }

    @Test
@@ -152,6 +177,7 @@ public class DomainSelectionResolverTest extends TelephonyTest {
        setUpController();
        mDsResolver.initialize(mDsService);
        when(mPhone.isImsAvailable()).thenReturn(true);
        when(mPhone.getImsPhone()).thenReturn(mImsPhone);

        assertNotNull(mDsResolver.getDomainSelectionConnection(
                mPhone, SELECTOR_TYPE_CALLING, true));