Search in sources :

Example 1 with GsmSmsMessage

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

the class RIL method sendSMS.

@Override
public void sendSMS(String smscPdu, String pdu, Message result) {
    IRadio radioProxy = getRadioProxy(result);
    if (radioProxy != null) {
        RILRequest rr = obtainRequest(RIL_REQUEST_SEND_SMS, result, mRILDefaultWorkSource);
        // Do not log function args for privacy
        if (RILJ_LOGD)
            riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
        GsmSmsMessage msg = constructGsmSendSmsRilRequest(smscPdu, pdu);
        try {
            radioProxy.sendSms(rr.mSerial, msg);
            mMetrics.writeRilSendSms(mPhoneId, rr.mSerial, SmsSession.Event.Tech.SMS_GSM, SmsSession.Event.Format.SMS_FORMAT_3GPP);
        } catch (RemoteException | RuntimeException e) {
            handleRadioProxyExceptionForRR(rr, "sendSMS", e);
        }
    }
}
Also used : IRadio(android.hardware.radio.V1_0.IRadio) RemoteException(android.os.RemoteException) GsmSmsMessage(android.hardware.radio.V1_0.GsmSmsMessage)

Example 2 with GsmSmsMessage

use of android.hardware.radio.V1_0.GsmSmsMessage 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 GsmSmsMessage

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

the class RILTest method testSendSMSExpectMore.

@FlakyTest
@Test
public void testSendSMSExpectMore() throws Exception {
    String smscPdu = "smscPdu";
    String pdu = "pdu";
    GsmSmsMessage msg = new GsmSmsMessage();
    msg.smscPdu = smscPdu;
    msg.pdu = pdu;
    mRILUnderTest.sendSMSExpectMore(smscPdu, pdu, obtainMessage());
    verify(mRadioProxy).sendSMSExpectMore(mSerialNumberCaptor.capture(), eq(msg));
    verifyRILResponse(mRILUnderTest, mSerialNumberCaptor.getValue(), RIL_REQUEST_SEND_SMS_EXPECT_MORE);
}
Also used : GsmSmsMessage(android.hardware.radio.V1_0.GsmSmsMessage) FlakyTest(androidx.test.filters.FlakyTest) FlakyTest(androidx.test.filters.FlakyTest) Test(org.junit.Test)

Example 4 with GsmSmsMessage

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

the class RIL method sendSMSExpectMore.

@Override
public void sendSMSExpectMore(String smscPdu, String pdu, Message result) {
    IRadio radioProxy = getRadioProxy(result);
    if (radioProxy != null) {
        RILRequest rr = obtainRequest(RIL_REQUEST_SEND_SMS_EXPECT_MORE, result, mRILDefaultWorkSource);
        // Do not log function arg for privacy
        if (RILJ_LOGD)
            riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
        GsmSmsMessage msg = constructGsmSendSmsRilRequest(smscPdu, pdu);
        try {
            radioProxy.sendSMSExpectMore(rr.mSerial, msg);
            mMetrics.writeRilSendSms(mPhoneId, rr.mSerial, SmsSession.Event.Tech.SMS_GSM, SmsSession.Event.Format.SMS_FORMAT_3GPP);
        } catch (RemoteException | RuntimeException e) {
            handleRadioProxyExceptionForRR(rr, "sendSMSExpectMore", e);
        }
    }
}
Also used : IRadio(android.hardware.radio.V1_0.IRadio) RemoteException(android.os.RemoteException) GsmSmsMessage(android.hardware.radio.V1_0.GsmSmsMessage)

Example 5 with GsmSmsMessage

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

the class RILTest method testSendSMS.

@FlakyTest
@Test
public void testSendSMS() throws Exception {
    String smscPdu = "smscPdu";
    String pdu = "pdu";
    GsmSmsMessage msg = new GsmSmsMessage();
    msg.smscPdu = smscPdu;
    msg.pdu = pdu;
    mRILUnderTest.sendSMS(smscPdu, pdu, obtainMessage());
    verify(mRadioProxy).sendSms(mSerialNumberCaptor.capture(), eq(msg));
    verifyRILResponse(mRILUnderTest, mSerialNumberCaptor.getValue(), RIL_REQUEST_SEND_SMS);
}
Also used : GsmSmsMessage(android.hardware.radio.V1_0.GsmSmsMessage) FlakyTest(androidx.test.filters.FlakyTest) FlakyTest(androidx.test.filters.FlakyTest) Test(org.junit.Test)

Aggregations

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