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

Commit 973c6b8f authored by Jack Yu's avatar Jack Yu Committed by Automerger Merge Worker
Browse files

Merge changes Icfb050d8,I678d5d8b am: a6d7c4f8

parents 2dbb1c0d a6d7c4f8
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -753,6 +753,13 @@ public class SmsController extends ISmsImplBase {
    public void sendVisualVoicemailSmsForSubscriber(String callingPackage,
            String callingAttributionTag, int subId, String number, int port, String text,
            PendingIntent sentIntent) {
        // Do not send non-emergency SMS in ECBM as it forces device to exit ECBM.
        if(getPhone(subId).isInEcm()) {
            Rlog.d(LOG_TAG, "sendVisualVoicemailSmsForSubscriber: Do not send non-emergency "
                + "SMS in ECBM as it forces device to exit ECBM.");
            return;
        }

        if (port == 0) {
            sendTextForSubscriberWithSelfPermissionsInternal(subId, callingPackage,
                    callingAttributionTag, number, null, text, sentIntent, null, false,
+27 −0
Original line number Diff line number Diff line
@@ -31,9 +31,14 @@ import org.mockito.Mockito;

import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.anyInt;
import static org.mockito.Mockito.anyString;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.eq;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;


import java.util.ArrayList;

@@ -165,4 +170,26 @@ public class SmsControllerTest extends TelephonyTest {
        // Clean up
        fdnCheckCleanup();
    }

    @Test
    public void sendVisualVoicemailSmsForSubscriber_phoneIsNotInEcm() {
        assertFalse(mPhone.isInEcm());

        mSmsControllerUT.sendVisualVoicemailSmsForSubscriber(mCallingPackage,null ,
                1, null, 0, null, null);
        verify(mIccSmsInterfaceManager).sendTextWithSelfPermissions(any(),
                any(), any(), any(), any(), any(), any(), eq(false), eq(true));
    }

    @Test
    public void sendVisualVoicemailSmsForSubscriber_phoneIsInEcm() {
        doReturn(true).when(mPhone).isInEcm();

        mSmsControllerUT.sendVisualVoicemailSmsForSubscriber(mCallingPackage,null ,
                1, null, 0, null, null);
        verify(mIccSmsInterfaceManager, never()).sendTextWithSelfPermissions(any(),
                any(), any(), any(), any(), any(), any(), eq(false), eq(true));

        doReturn(false).when(mPhone).isInEcm();
    }
}
 No newline at end of file