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

Commit 96f386e3 authored by Chinmay Dhodapkar's avatar Chinmay Dhodapkar Committed by Automerger Merge Worker
Browse files

Fix shouldProcessCall in ImsManager am: 2838d390 am: 3c6ae79d

parents a7853859 3c6ae79d
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -3035,7 +3035,8 @@ public class ImsManager implements FeatureUpdates {
    public @MmTelFeature.ProcessCallResult int shouldProcessCall(boolean isEmergency,
    public @MmTelFeature.ProcessCallResult int shouldProcessCall(boolean isEmergency,
            String[] numbers) throws ImsException {
            String[] numbers) throws ImsException {
        try {
        try {
            return mMmTelConnectionRef.get().shouldProcessCall(isEmergency, numbers);
            MmTelFeatureConnection c = getOrThrowExceptionIfServiceUnavailable();
            return c.shouldProcessCall(isEmergency, numbers);
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            throw new ImsException("shouldProcessCall()", e,
            throw new ImsException("shouldProcessCall()", e,
                    ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN);
                    ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN);
+16 −0
Original line number Original line Diff line number Diff line
@@ -22,6 +22,7 @@ import static android.telephony.ims.stub.ImsRegistrationImplBase.REGISTRATION_TE
import static android.telephony.ims.stub.ImsRegistrationImplBase.REGISTRATION_TECH_LTE;
import static android.telephony.ims.stub.ImsRegistrationImplBase.REGISTRATION_TECH_LTE;


import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThrows;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.anyInt;
import static org.mockito.Mockito.anyInt;
@@ -968,6 +969,21 @@ public class ImsManagerTest extends ImsTestBase {
                anyInt());
                anyInt());
    }
    }


    @Test @SmallTest
    public void testShouldProcessCall_ThrowsExceptionIfServiceIsStillInitializing() {
        ImsManager imsManager = getImsManagerAndInitProvisionedValues();
        doReturn(-1).when(mMmTelFeatureConnection).getSubId();
        assertThrows(ImsException.class, () -> imsManager.shouldProcessCall(true, new String[1]));
    }

    @Test @SmallTest
    public void testShouldProcessCall_DoesNotThrowExceptionWhenServiceInitialized()
        throws Exception {
        ImsManager imsManager = getImsManagerAndInitProvisionedValues();
        int ret = imsManager.shouldProcessCall(true, new String[1]);
        assertEquals(MmTelFeature.PROCESS_CALL_IMS, ret);
    }

    /**
    /**
     * Tests the operation of setWfcRoamingSetting and ensures that the user setting for WFC roaming
     * Tests the operation of setWfcRoamingSetting and ensures that the user setting for WFC roaming
     * and the ImsConfig setting are both called properly.
     * and the ImsConfig setting are both called properly.