Loading src/java/com/android/internal/telephony/domainselection/DomainSelectionResolver.java +8 −3 Original line number Diff line number Diff line Loading @@ -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; } Loading tests/telephonytests/src/com/android/internal/telephony/domainselection/DomainSelectionResolverTest.java +27 −1 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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)); Loading Loading
src/java/com/android/internal/telephony/domainselection/DomainSelectionResolver.java +8 −3 Original line number Diff line number Diff line Loading @@ -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; } Loading
tests/telephonytests/src/com/android/internal/telephony/domainselection/DomainSelectionResolverTest.java +27 −1 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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)); Loading