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

Commit e567e85b authored by Brad Ebinger's avatar Brad Ebinger
Browse files

Disable SipTransport single ImsService enforcement

Add a flag to disable enforcement of both MMTEL and RCS features
before SipTransport can be enabled for single registration.

Bug: 175766573
Test: atest FrameworksTelephonyTests:ImsServiceControllerTest
Change-Id: I49cdc439255328679a6d42324647d80a420c2136
parent 9f721942
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -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;
@@ -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;
    }

+11 −1
Original line number Diff line number Diff line
@@ -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;
@@ -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 {
@@ -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);
    }

    /**
@@ -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);