Search in sources :

Example 1 with ImsSmsMessage

use of android.hardware.radio.V1_0.ImsSmsMessage in project android_frameworks_opt_telephony by LineageOS.

the class RILTest method testSendRetryImsCdmaSms.

@FlakyTest
@Test
public void testSendRetryImsCdmaSms() throws Exception {
    CdmaSmsMessage cdmaMsg = new CdmaSmsMessage();
    ImsSmsMessage firstMsg = new ImsSmsMessage();
    firstMsg.tech = RILConstants.CDMA_PHONE;
    firstMsg.retry = false;
    firstMsg.messageRef = 0;
    firstMsg.cdmaMessage.add(cdmaMsg);
    ImsSmsMessage retryMsg = new ImsSmsMessage();
    retryMsg.tech = RILConstants.CDMA_PHONE;
    retryMsg.retry = true;
    retryMsg.messageRef = 0;
    retryMsg.cdmaMessage.add(cdmaMsg);
    int maxRetryCount = 3;
    int firstTransmission = 0;
    byte[] pdu = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    for (int i = 0; i <= maxRetryCount; i++) {
        mRILUnderTest.sendImsCdmaSms(pdu, i, 0, obtainMessage());
        if (i == firstTransmission) {
            verify(mRadioProxy, times(1)).sendImsSms(mSerialNumberCaptor.capture(), eq(firstMsg));
            verifyRILResponse(mRILUnderTest, mSerialNumberCaptor.getValue(), RIL_REQUEST_IMS_SEND_SMS);
        } else {
            verify(mRadioProxy, times(i)).sendImsSms(mSerialNumberCaptor.capture(), eq(retryMsg));
            verifyRILResponse(mRILUnderTest, mSerialNumberCaptor.getValue(), RIL_REQUEST_IMS_SEND_SMS);
        }
    }
}
Also used : CdmaSmsMessage(android.hardware.radio.V1_0.CdmaSmsMessage) ImsSmsMessage(android.hardware.radio.V1_0.ImsSmsMessage) FlakyTest(androidx.test.filters.FlakyTest) FlakyTest(androidx.test.filters.FlakyTest) Test(org.junit.Test)

Example 2 with ImsSmsMessage

use of android.hardware.radio.V1_0.ImsSmsMessage in project android_frameworks_opt_telephony by LineageOS.

the class RILTest method testSendRetryImsGsmSms.

@FlakyTest
@Test
public void testSendRetryImsGsmSms() throws Exception {
    String smscPdu = "smscPdu";
    String pdu = "pdu";
    GsmSmsMessage gsmMsg = new GsmSmsMessage();
    gsmMsg.smscPdu = smscPdu;
    gsmMsg.pdu = pdu;
    ImsSmsMessage firstMsg = new ImsSmsMessage();
    firstMsg.tech = RILConstants.GSM_PHONE;
    firstMsg.retry = false;
    firstMsg.messageRef = 0;
    firstMsg.gsmMessage.add(gsmMsg);
    ImsSmsMessage retryMsg = new ImsSmsMessage();
    retryMsg.tech = RILConstants.GSM_PHONE;
    retryMsg.retry = true;
    retryMsg.messageRef = 0;
    retryMsg.gsmMessage.add(gsmMsg);
    int maxRetryCount = 3;
    int firstTransmission = 0;
    for (int i = 0; i <= maxRetryCount; i++) {
        mRILUnderTest.sendImsGsmSms(smscPdu, pdu, i, 0, obtainMessage());
        if (i == firstTransmission) {
            verify(mRadioProxy, times(1)).sendImsSms(mSerialNumberCaptor.capture(), eq(firstMsg));
            verifyRILResponse(mRILUnderTest, mSerialNumberCaptor.getValue(), RIL_REQUEST_IMS_SEND_SMS);
        } else {
            verify(mRadioProxy, times(i)).sendImsSms(mSerialNumberCaptor.capture(), eq(retryMsg));
            verifyRILResponse(mRILUnderTest, mSerialNumberCaptor.getValue(), RIL_REQUEST_IMS_SEND_SMS);
        }
    }
}
Also used : ImsSmsMessage(android.hardware.radio.V1_0.ImsSmsMessage) GsmSmsMessage(android.hardware.radio.V1_0.GsmSmsMessage) FlakyTest(androidx.test.filters.FlakyTest) FlakyTest(androidx.test.filters.FlakyTest) Test(org.junit.Test)

Example 3 with ImsSmsMessage

use of android.hardware.radio.V1_0.ImsSmsMessage in project android_frameworks_opt_telephony by LineageOS.

the class RIL method sendImsCdmaSms.

@Override
public void sendImsCdmaSms(byte[] pdu, int retry, int messageRef, Message result) {
    IRadio radioProxy = getRadioProxy(result);
    if (radioProxy != null) {
        RILRequest rr = obtainRequest(RIL_REQUEST_IMS_SEND_SMS, result, mRILDefaultWorkSource);
        // Do not log function args for privacy
        if (RILJ_LOGD)
            riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
        ImsSmsMessage msg = new ImsSmsMessage();
        msg.tech = RILConstants.CDMA_PHONE;
        msg.retry = (byte) retry >= 1 ? true : false;
        msg.messageRef = messageRef;
        CdmaSmsMessage cdmaMsg = new CdmaSmsMessage();
        constructCdmaSendSmsRilRequest(cdmaMsg, pdu);
        msg.cdmaMessage.add(cdmaMsg);
        try {
            radioProxy.sendImsSms(rr.mSerial, msg);
            mMetrics.writeRilSendSms(mPhoneId, rr.mSerial, SmsSession.Event.Tech.SMS_IMS, SmsSession.Event.Format.SMS_FORMAT_3GPP2);
        } catch (RemoteException | RuntimeException e) {
            handleRadioProxyExceptionForRR(rr, "sendImsCdmaSms", e);
        }
    }
}
Also used : IRadio(android.hardware.radio.V1_0.IRadio) CdmaSmsMessage(android.hardware.radio.V1_0.CdmaSmsMessage) ImsSmsMessage(android.hardware.radio.V1_0.ImsSmsMessage) RemoteException(android.os.RemoteException)

Example 4 with ImsSmsMessage

use of android.hardware.radio.V1_0.ImsSmsMessage in project android_frameworks_opt_telephony by LineageOS.

the class RIL method sendImsGsmSms.

@Override
public void sendImsGsmSms(String smscPdu, String pdu, int retry, int messageRef, Message result) {
    IRadio radioProxy = getRadioProxy(result);
    if (radioProxy != null) {
        RILRequest rr = obtainRequest(RIL_REQUEST_IMS_SEND_SMS, result, mRILDefaultWorkSource);
        // Do not log function args for privacy
        if (RILJ_LOGD)
            riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
        ImsSmsMessage msg = new ImsSmsMessage();
        msg.tech = RILConstants.GSM_PHONE;
        msg.retry = (byte) retry >= 1 ? true : false;
        msg.messageRef = messageRef;
        GsmSmsMessage gsmMsg = constructGsmSendSmsRilRequest(smscPdu, pdu);
        msg.gsmMessage.add(gsmMsg);
        try {
            radioProxy.sendImsSms(rr.mSerial, msg);
            mMetrics.writeRilSendSms(mPhoneId, rr.mSerial, SmsSession.Event.Tech.SMS_IMS, SmsSession.Event.Format.SMS_FORMAT_3GPP);
        } catch (RemoteException | RuntimeException e) {
            handleRadioProxyExceptionForRR(rr, "sendImsGsmSms", e);
        }
    }
}
Also used : IRadio(android.hardware.radio.V1_0.IRadio) ImsSmsMessage(android.hardware.radio.V1_0.ImsSmsMessage) RemoteException(android.os.RemoteException) GsmSmsMessage(android.hardware.radio.V1_0.GsmSmsMessage)

Aggregations

ImsSmsMessage (android.hardware.radio.V1_0.ImsSmsMessage)4 CdmaSmsMessage (android.hardware.radio.V1_0.CdmaSmsMessage)2 GsmSmsMessage (android.hardware.radio.V1_0.GsmSmsMessage)2 IRadio (android.hardware.radio.V1_0.IRadio)2 RemoteException (android.os.RemoteException)2 FlakyTest (androidx.test.filters.FlakyTest)2 Test (org.junit.Test)2