Loading src/java/com/android/internal/telephony/ims/ImsServiceController.java +12 −5 Original line number Diff line number Diff line Loading @@ -221,6 +221,9 @@ public class ImsServiceController { private static final int REBIND_START_DELAY_MS = 2 * 1000; // 2 seconds private static final int REBIND_MAXIMUM_DELAY_MS = 60 * 1000; // 1 minute private static final long CHANGE_PERMISSION_TIMEOUT_MS = 15 * 1000; // 15 seconds // Enforce ImsService has both MMTEL and RCS supported in order to enable SIP transport API. // Enable ImsServiceControllerTest and SipDelegateManagerTest cases if this is re-enabled. private static final boolean ENFORCE_SINGLE_SERVICE_FOR_SIP_TRANSPORT = false; private final ComponentName mComponentName; private final HandlerThread mHandlerThread = new HandlerThread("ImsServiceControllerHandler"); private final PermissionManager mPermissionManager; Loading Loading @@ -643,12 +646,16 @@ public class ImsServiceController { caps |= ImsService.CAPABILITY_EMERGENCY_OVER_MMTEL; } if (ENFORCE_SINGLE_SERVICE_FOR_SIP_TRANSPORT) { if (!featureTypes.contains(ImsFeature.FEATURE_MMTEL) || !featureTypes.contains(ImsFeature.FEATURE_RCS)) { // Only allow SipDelegate creation if this ImsService is providing both MMTEL and RCS // features. // Only allow SipDelegate creation if this ImsService is providing both MMTEL and // RCS features. caps &= ~(ImsService.CAPABILITY_SIP_DELEGATE_CREATION); } } else { Log.i(LOG_TAG, "skipping single service enforce check..."); } return caps; } Loading tests/telephonytests/src/com/android/internal/telephony/ims/ImsServiceControllerTest.java +11 −1 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ import com.android.ims.internal.IImsServiceFeatureCallback; import org.junit.After; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; Loading Loading @@ -262,6 +263,7 @@ public class ImsServiceControllerTest extends ImsTestBase { * Tests ImsServiceController loses SIP delegate creation flag if MMTEL and RCS are not both * supported. */ @Ignore("Disabling for integration b/175766573") @SmallTest @Test public void testBindServiceSipDelegateCapabilityLost() throws RemoteException { Loading @@ -279,7 +281,7 @@ public class ImsServiceControllerTest extends ImsTestBase { verify(mMockCallbacks).imsServiceFeatureCreated(eq(SLOT_0), eq(ImsFeature.FEATURE_MMTEL), eq(mTestImsServiceController)); // verify CAPABILITY_SIP_DELEGATE_CREATION is not set because MMTEL and RCS are not set. validateMmTelFeatureContainerExists(SLOT_0); validateFeatureContainerDoesNotHaveSipDelegate(ImsFeature.FEATURE_MMTEL, SLOT_0); } /** Loading Loading @@ -951,6 +953,14 @@ public class ImsServiceControllerTest extends ImsTestBase { assertTrue((ImsService.CAPABILITY_SIP_DELEGATE_CREATION | fc.getCapabilities()) > 0); } private void validateFeatureContainerDoesNotHaveSipDelegate(int featureType, int slotId) { ImsFeatureContainer fc = mRepo.getIfExists(slotId, featureType).orElse(null); assertNotNull("FeatureContainer should not be null", fc); assertEquals(0, (ImsService.CAPABILITY_SIP_DELEGATE_CREATION & fc.getCapabilities())); } private void validateMmTelFeatureExistsInCallback(int slotId, long expectedCaps) { TestCallback cb = new TestCallback(); mRepo.registerForConnectionUpdates(slotId, ImsFeature.FEATURE_MMTEL, cb, Runnable::run); Loading Loading
src/java/com/android/internal/telephony/ims/ImsServiceController.java +12 −5 Original line number Diff line number Diff line Loading @@ -221,6 +221,9 @@ public class ImsServiceController { private static final int REBIND_START_DELAY_MS = 2 * 1000; // 2 seconds private static final int REBIND_MAXIMUM_DELAY_MS = 60 * 1000; // 1 minute private static final long CHANGE_PERMISSION_TIMEOUT_MS = 15 * 1000; // 15 seconds // Enforce ImsService has both MMTEL and RCS supported in order to enable SIP transport API. // Enable ImsServiceControllerTest and SipDelegateManagerTest cases if this is re-enabled. private static final boolean ENFORCE_SINGLE_SERVICE_FOR_SIP_TRANSPORT = false; private final ComponentName mComponentName; private final HandlerThread mHandlerThread = new HandlerThread("ImsServiceControllerHandler"); private final PermissionManager mPermissionManager; Loading Loading @@ -643,12 +646,16 @@ public class ImsServiceController { caps |= ImsService.CAPABILITY_EMERGENCY_OVER_MMTEL; } if (ENFORCE_SINGLE_SERVICE_FOR_SIP_TRANSPORT) { if (!featureTypes.contains(ImsFeature.FEATURE_MMTEL) || !featureTypes.contains(ImsFeature.FEATURE_RCS)) { // Only allow SipDelegate creation if this ImsService is providing both MMTEL and RCS // features. // Only allow SipDelegate creation if this ImsService is providing both MMTEL and // RCS features. caps &= ~(ImsService.CAPABILITY_SIP_DELEGATE_CREATION); } } else { Log.i(LOG_TAG, "skipping single service enforce check..."); } return caps; } Loading
tests/telephonytests/src/com/android/internal/telephony/ims/ImsServiceControllerTest.java +11 −1 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ import com.android.ims.internal.IImsServiceFeatureCallback; import org.junit.After; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; Loading Loading @@ -262,6 +263,7 @@ public class ImsServiceControllerTest extends ImsTestBase { * Tests ImsServiceController loses SIP delegate creation flag if MMTEL and RCS are not both * supported. */ @Ignore("Disabling for integration b/175766573") @SmallTest @Test public void testBindServiceSipDelegateCapabilityLost() throws RemoteException { Loading @@ -279,7 +281,7 @@ public class ImsServiceControllerTest extends ImsTestBase { verify(mMockCallbacks).imsServiceFeatureCreated(eq(SLOT_0), eq(ImsFeature.FEATURE_MMTEL), eq(mTestImsServiceController)); // verify CAPABILITY_SIP_DELEGATE_CREATION is not set because MMTEL and RCS are not set. validateMmTelFeatureContainerExists(SLOT_0); validateFeatureContainerDoesNotHaveSipDelegate(ImsFeature.FEATURE_MMTEL, SLOT_0); } /** Loading Loading @@ -951,6 +953,14 @@ public class ImsServiceControllerTest extends ImsTestBase { assertTrue((ImsService.CAPABILITY_SIP_DELEGATE_CREATION | fc.getCapabilities()) > 0); } private void validateFeatureContainerDoesNotHaveSipDelegate(int featureType, int slotId) { ImsFeatureContainer fc = mRepo.getIfExists(slotId, featureType).orElse(null); assertNotNull("FeatureContainer should not be null", fc); assertEquals(0, (ImsService.CAPABILITY_SIP_DELEGATE_CREATION & fc.getCapabilities())); } private void validateMmTelFeatureExistsInCallback(int slotId, long expectedCaps) { TestCallback cb = new TestCallback(); mRepo.registerForConnectionUpdates(slotId, ImsFeature.FEATURE_MMTEL, cb, Runnable::run); Loading