Loading src/java/com/android/internal/telephony/RIL.java +84 −36 Original line number Diff line number Diff line Loading @@ -1670,16 +1670,29 @@ public class RIL extends BaseCommands implements CommandsInterface { if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); GsmSmsMessage msg = constructGsmSendSmsRilRequest(smscPdu, pdu); if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_6)) { try { android.hardware.radio.V1_6.IRadio radioProxy16 = (android.hardware.radio.V1_6.IRadio) radioProxy; radioProxy16.sendSms_1_6(rr.mSerial, msg); mMetrics.writeRilSendSms(mPhoneId, rr.mSerial, SmsSession.Event.Tech.SMS_GSM, SmsSession.Event.Format.SMS_FORMAT_3GPP, getOutgoingSmsMessageId(result)); } catch (RemoteException | RuntimeException e) { handleRadioProxyExceptionForRR(rr, "sendSMS", e); } } else { try { radioProxy.sendSms(rr.mSerial, msg); mMetrics.writeRilSendSms(mPhoneId, rr.mSerial, SmsSession.Event.Tech.SMS_GSM, SmsSession.Event.Format.SMS_FORMAT_3GPP, getOutgoingSmsMessageId(result)); SmsSession.Event.Format.SMS_FORMAT_3GPP, getOutgoingSmsMessageId(result)); } catch (RemoteException | RuntimeException e) { handleRadioProxyExceptionForRR(rr, "sendSMS", e); } } } } /** * Extract the outgoing sms messageId from the tracker, if there is one. This is specifically Loading Loading @@ -1709,16 +1722,29 @@ public class RIL extends BaseCommands implements CommandsInterface { if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); GsmSmsMessage msg = constructGsmSendSmsRilRequest(smscPdu, pdu); if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_6)) { try { android.hardware.radio.V1_6.IRadio radioProxy16 = (android.hardware.radio.V1_6.IRadio) radioProxy; radioProxy16.sendSMSExpectMore_1_6(rr.mSerial, msg); mMetrics.writeRilSendSms(mPhoneId, rr.mSerial, SmsSession.Event.Tech.SMS_GSM, SmsSession.Event.Format.SMS_FORMAT_3GPP, getOutgoingSmsMessageId(result)); } catch (RemoteException | RuntimeException e) { handleRadioProxyExceptionForRR(rr, "sendSMSExpectMore", e); } } else { try { radioProxy.sendSMSExpectMore(rr.mSerial, msg); mMetrics.writeRilSendSms(mPhoneId, rr.mSerial, SmsSession.Event.Tech.SMS_GSM, SmsSession.Event.Format.SMS_FORMAT_3GPP, getOutgoingSmsMessageId(result)); SmsSession.Event.Format.SMS_FORMAT_3GPP, getOutgoingSmsMessageId(result)); } catch (RemoteException | RuntimeException e) { handleRadioProxyExceptionForRR(rr, "sendSMSExpectMore", e); } } } } /** * Convert MVNO type string into MvnoType defined in types.hal. Loading Loading @@ -3664,12 +3690,8 @@ public class RIL extends BaseCommands implements CommandsInterface { @Override public void sendCdmaSMSExpectMore(byte[] pdu, Message result) { if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_5)) { IRadio radioProxy = getRadioProxy(result); // IRadio V1.5 android.hardware.radio.V1_5.IRadio radioProxy15 = (android.hardware.radio.V1_5.IRadio) radioProxy; if (radioProxy15 != null) { if (radioProxy != null) { RILRequest rr = obtainRequest(RIL_REQUEST_CDMA_SEND_SMS_EXPECT_MORE, result, mRILDefaultWorkSource); Loading @@ -3678,20 +3700,33 @@ public class RIL extends BaseCommands implements CommandsInterface { CdmaSmsMessage msg = new CdmaSmsMessage(); constructCdmaSendSmsRilRequest(msg, pdu); if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_6)) { android.hardware.radio.V1_6.IRadio radioProxy16 = (android.hardware.radio.V1_6.IRadio) radioProxy; try { radioProxy15.sendCdmaSmsExpectMore(rr.mSerial, msg); radioProxy16.sendCdmaSmsExpectMore_1_6(rr.mSerial, msg); mMetrics.writeRilSendSms(mPhoneId, rr.mSerial, SmsSession.Event.Tech.SMS_CDMA, SmsSession.Event.Format.SMS_FORMAT_3GPP2, getOutgoingSmsMessageId(result)); } catch (RemoteException | RuntimeException e) { handleRadioProxyExceptionForRR(rr, "sendCdmaSMSExpectMore", e); } } else if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_5)) { android.hardware.radio.V1_5.IRadio radioProxy15 = (android.hardware.radio.V1_5.IRadio) radioProxy; try { radioProxy15.sendCdmaSmsExpectMore(rr.mSerial, msg); mMetrics.writeRilSendSms(mPhoneId, rr.mSerial, SmsSession.Event.Tech.SMS_CDMA, SmsSession.Event.Format.SMS_FORMAT_3GPP2, getOutgoingSmsMessageId(result)); } catch (RemoteException | RuntimeException e) { handleRadioProxyExceptionForRR(rr, "sendCdmaSMSExpectMore", e); } } else { sendCdmaSms(pdu, result); } } } @Override public void sendCdmaSms(byte[] pdu, Message result) { Loading @@ -3705,16 +3740,29 @@ public class RIL extends BaseCommands implements CommandsInterface { CdmaSmsMessage msg = new CdmaSmsMessage(); constructCdmaSendSmsRilRequest(msg, pdu); if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_6)) { try { android.hardware.radio.V1_6.IRadio radioProxy16 = (android.hardware.radio.V1_6.IRadio) radioProxy; radioProxy16.sendCdmaSms_1_6(rr.mSerial, msg); mMetrics.writeRilSendSms(mPhoneId, rr.mSerial, SmsSession.Event.Tech.SMS_CDMA, SmsSession.Event.Format.SMS_FORMAT_3GPP2, getOutgoingSmsMessageId(result)); } catch (RemoteException | RuntimeException e) { handleRadioProxyExceptionForRR(rr, "sendCdmaSms", e); } } else { try { radioProxy.sendCdmaSms(rr.mSerial, msg); mMetrics.writeRilSendSms(mPhoneId, rr.mSerial, SmsSession.Event.Tech.SMS_CDMA, SmsSession.Event.Format.SMS_FORMAT_3GPP2, getOutgoingSmsMessageId(result)); SmsSession.Event.Format.SMS_FORMAT_3GPP2, getOutgoingSmsMessageId(result)); } catch (RemoteException | RuntimeException e) { handleRadioProxyExceptionForRR(rr, "sendCdmaSms", e); } } } } @Override public void acknowledgeLastIncomingCdmaSms(boolean success, int cause, Message result) { Loading src/java/com/android/internal/telephony/RadioResponse.java +57 −0 Original line number Diff line number Diff line Loading @@ -499,6 +499,16 @@ public class RadioResponse extends IRadioResponse.Stub { responseSms(responseInfo, sms); } /** * @param responseInfo Response info struct containing response type, serial no. and error which * is defined in 1.6/types.hal * @param sms Response to sms sent as defined by SendSmsResult in types.hal */ public void sendSmsResponse_1_6(android.hardware.radio.V1_6.RadioResponseInfo responseInfo, SendSmsResult sms) { responseSms_1_6(responseInfo, sms); } /** * @param responseInfo Response info struct containing response type, serial no. and error * @param sms Response to sms sent as defined by SendSmsResult in types.hal Loading @@ -508,6 +518,17 @@ public class RadioResponse extends IRadioResponse.Stub { responseSms(responseInfo, sms); } /** * @param responseInfo Response info struct containing response type, serial no. and error which * is defined in 1.6/types.hal * @param sms Response to sms sent as defined by SendSmsResult in 1.6/types.hal */ public void sendSMSExpectMoreResponse_1_6( android.hardware.radio.V1_6.RadioResponseInfo responseInfo, SendSmsResult sms) { responseSms_1_6(responseInfo, sms); } /** * @param responseInfo Response info struct containing response type, serial no. and error * @param setupDataCallResult Response to data call setup as defined by setupDataCallResult in Loading Loading @@ -1038,6 +1059,17 @@ public class RadioResponse extends IRadioResponse.Stub { responseSms(responseInfo, sms); } /** * * @param responseInfo Response info struct containing response type, serial no. and error which * is defined in 1.6/types.hal * @param sms Sms result struct as defined by SendSmsResult in types.hal */ public void sendCdmaSmsResponse_1_6(android.hardware.radio.V1_6.RadioResponseInfo responseInfo, SendSmsResult sms) { responseSms_1_6(responseInfo, sms); } /** * * @param responseInfo Response info struct containing response type, serial no. and error Loading @@ -1047,6 +1079,17 @@ public class RadioResponse extends IRadioResponse.Stub { responseSms(responseInfo, sms); } /** * * @param responseInfo Response info struct containing response type, serial no. and error which * is defined in 1.6/types.hal * @param sms Sms result struct as defined by SendSmsResult in types.hal */ public void sendCdmaSMSExpectMoreResponse_1_6( android.hardware.radio.V1_6.RadioResponseInfo responseInfo, SendSmsResult sms) { responseSms_1_6(responseInfo, sms); } /** * @param responseInfo Response info struct containing response type, serial no. and error */ Loading Loading @@ -2211,6 +2254,20 @@ public class RadioResponse extends IRadioResponse.Stub { } } private void responseSms_1_6(android.hardware.radio.V1_6.RadioResponseInfo responseInfo, SendSmsResult sms) { RILRequest rr = mRil.processResponse_1_6(responseInfo); if (rr != null) { long messageId = RIL.getOutgoingSmsMessageId(rr.mResult); SmsResponse ret = new SmsResponse(sms.messageRef, sms.ackPDU, sms.errorCode, messageId); if (responseInfo.error == RadioError.NONE) { sendMessageResponse(rr.mResult, ret); } mRil.processResponseDone_1_6(rr, responseInfo, ret); } } private void responseSetupDataCall(RadioResponseInfo responseInfo, Object setupDataCallResult) { RILRequest rr = mRil.processResponse(responseInfo); Loading tests/telephonytests/src/com/android/internal/telephony/RILTest.java +110 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ package com.android.internal.telephony; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_ALLOW_DATA; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_CDMA_GET_SUBSCRIPTION_SOURCE; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_CDMA_SEND_SMS; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_CDMA_SEND_SMS_EXPECT_MORE; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_CHANGE_SIM_PIN; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_CHANGE_SIM_PIN2; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_CONFERENCE; Loading Loading @@ -168,6 +170,9 @@ import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Mock; import java.io.ByteArrayInputStream; import java.io.DataInputStream; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; Loading Loading @@ -752,6 +757,24 @@ public class RILTest extends TelephonyTest { verifyRILResponse(mRILUnderTest, mSerialNumberCaptor.getValue(), RIL_REQUEST_SEND_SMS); } @FlakyTest @Test public void testSendSMS_1_6() throws Exception { // Use Radio HAL v1.6 try { replaceInstance(RIL.class, "mRadioVersion", mRILUnderTest, mRadioVersionV16); } catch (Exception e) { } String smscPdu = "smscPdu"; String pdu = "pdu"; GsmSmsMessage msg = new GsmSmsMessage(); msg.smscPdu = smscPdu; msg.pdu = pdu; mRILUnderTest.sendSMS(smscPdu, pdu, obtainMessage()); verify(mRadioProxy).sendSms_1_6(mSerialNumberCaptor.capture(), eq(msg)); verifyRILResponse(mRILUnderTest, mSerialNumberCaptor.getValue(), RIL_REQUEST_SEND_SMS); } @FlakyTest @Test public void testSendSMSExpectMore() throws Exception { Loading @@ -766,6 +789,93 @@ public class RILTest extends TelephonyTest { mRILUnderTest, mSerialNumberCaptor.getValue(), RIL_REQUEST_SEND_SMS_EXPECT_MORE); } @FlakyTest @Test public void testSendSMSExpectMore_1_6() throws Exception { // Use Radio HAL v1.6 try { replaceInstance(RIL.class, "mRadioVersion", mRILUnderTest, mRadioVersionV16); } catch (Exception e) { } String smscPdu = "smscPdu"; String pdu = "pdu"; GsmSmsMessage msg = new GsmSmsMessage(); msg.smscPdu = smscPdu; msg.pdu = pdu; mRILUnderTest.sendSMSExpectMore(smscPdu, pdu, obtainMessage()); verify(mRadioProxy).sendSMSExpectMore_1_6(mSerialNumberCaptor.capture(), eq(msg)); verifyRILResponse( mRILUnderTest, mSerialNumberCaptor.getValue(), RIL_REQUEST_SEND_SMS_EXPECT_MORE); } @FlakyTest @Test public void testSendCdmaSMS_1_6() throws Exception { // Use Radio HAL v1.6 try { replaceInstance(RIL.class, "mRadioVersion", mRILUnderTest, mRadioVersionV16); } catch (Exception e) { } byte[] pdu = "000010020000000000000000000000000000000000".getBytes(); CdmaSmsMessage msg = new CdmaSmsMessage(); constructCdmaSendSmsRilRequest(msg, pdu); mRILUnderTest.sendCdmaSms(pdu, obtainMessage()); verify(mRadioProxy).sendCdmaSms_1_6(mSerialNumberCaptor.capture(), eq(msg)); verifyRILResponse(mRILUnderTest, mSerialNumberCaptor.getValue(), RIL_REQUEST_CDMA_SEND_SMS); } @FlakyTest @Test public void testSendCdmaSMSExpectMore_1_6() throws Exception { // Use Radio HAL v1.6 try { replaceInstance(RIL.class, "mRadioVersion", mRILUnderTest, mRadioVersionV16); } catch (Exception e) { } byte[] pdu = "000010020000000000000000000000000000000000".getBytes(); CdmaSmsMessage msg = new CdmaSmsMessage(); constructCdmaSendSmsRilRequest(msg, pdu); mRILUnderTest.sendCdmaSMSExpectMore(pdu, obtainMessage()); verify(mRadioProxy).sendCdmaSmsExpectMore_1_6(mSerialNumberCaptor.capture(), eq(msg)); verifyRILResponse(mRILUnderTest, mSerialNumberCaptor.getValue(), RIL_REQUEST_CDMA_SEND_SMS_EXPECT_MORE); } private void constructCdmaSendSmsRilRequest(CdmaSmsMessage msg, byte[] pdu) { int addrNbrOfDigits; int subaddrNbrOfDigits; int bearerDataLength; ByteArrayInputStream bais = new ByteArrayInputStream(pdu); DataInputStream dis = new DataInputStream(bais); try { msg.teleserviceId = dis.readInt(); // teleServiceId msg.isServicePresent = (byte) dis.readInt() == 1 ? true : false; // servicePresent msg.serviceCategory = dis.readInt(); // serviceCategory msg.address.digitMode = dis.read(); // address digit mode msg.address.numberMode = dis.read(); // address number mode msg.address.numberType = dis.read(); // address number type msg.address.numberPlan = dis.read(); // address number plan addrNbrOfDigits = (byte) dis.read(); for (int i = 0; i < addrNbrOfDigits; i++) { msg.address.digits.add(dis.readByte()); // address_orig_bytes[i] } msg.subAddress.subaddressType = dis.read(); //subaddressType msg.subAddress.odd = (byte) dis.read() == 1 ? true : false; //subaddr odd subaddrNbrOfDigits = (byte) dis.read(); for (int i = 0; i < subaddrNbrOfDigits; i++) { msg.subAddress.digits.add(dis.readByte()); //subaddr_orig_bytes[i] } bearerDataLength = dis.read(); for (int i = 0; i < bearerDataLength; i++) { msg.bearerData.add(dis.readByte()); //bearerData[i] } } catch (IOException ex) { ex.printStackTrace(); } } @FlakyTest @Test public void testWriteSmsToSim() throws Exception { Loading Loading
src/java/com/android/internal/telephony/RIL.java +84 −36 Original line number Diff line number Diff line Loading @@ -1670,16 +1670,29 @@ public class RIL extends BaseCommands implements CommandsInterface { if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); GsmSmsMessage msg = constructGsmSendSmsRilRequest(smscPdu, pdu); if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_6)) { try { android.hardware.radio.V1_6.IRadio radioProxy16 = (android.hardware.radio.V1_6.IRadio) radioProxy; radioProxy16.sendSms_1_6(rr.mSerial, msg); mMetrics.writeRilSendSms(mPhoneId, rr.mSerial, SmsSession.Event.Tech.SMS_GSM, SmsSession.Event.Format.SMS_FORMAT_3GPP, getOutgoingSmsMessageId(result)); } catch (RemoteException | RuntimeException e) { handleRadioProxyExceptionForRR(rr, "sendSMS", e); } } else { try { radioProxy.sendSms(rr.mSerial, msg); mMetrics.writeRilSendSms(mPhoneId, rr.mSerial, SmsSession.Event.Tech.SMS_GSM, SmsSession.Event.Format.SMS_FORMAT_3GPP, getOutgoingSmsMessageId(result)); SmsSession.Event.Format.SMS_FORMAT_3GPP, getOutgoingSmsMessageId(result)); } catch (RemoteException | RuntimeException e) { handleRadioProxyExceptionForRR(rr, "sendSMS", e); } } } } /** * Extract the outgoing sms messageId from the tracker, if there is one. This is specifically Loading Loading @@ -1709,16 +1722,29 @@ public class RIL extends BaseCommands implements CommandsInterface { if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); GsmSmsMessage msg = constructGsmSendSmsRilRequest(smscPdu, pdu); if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_6)) { try { android.hardware.radio.V1_6.IRadio radioProxy16 = (android.hardware.radio.V1_6.IRadio) radioProxy; radioProxy16.sendSMSExpectMore_1_6(rr.mSerial, msg); mMetrics.writeRilSendSms(mPhoneId, rr.mSerial, SmsSession.Event.Tech.SMS_GSM, SmsSession.Event.Format.SMS_FORMAT_3GPP, getOutgoingSmsMessageId(result)); } catch (RemoteException | RuntimeException e) { handleRadioProxyExceptionForRR(rr, "sendSMSExpectMore", e); } } else { try { radioProxy.sendSMSExpectMore(rr.mSerial, msg); mMetrics.writeRilSendSms(mPhoneId, rr.mSerial, SmsSession.Event.Tech.SMS_GSM, SmsSession.Event.Format.SMS_FORMAT_3GPP, getOutgoingSmsMessageId(result)); SmsSession.Event.Format.SMS_FORMAT_3GPP, getOutgoingSmsMessageId(result)); } catch (RemoteException | RuntimeException e) { handleRadioProxyExceptionForRR(rr, "sendSMSExpectMore", e); } } } } /** * Convert MVNO type string into MvnoType defined in types.hal. Loading Loading @@ -3664,12 +3690,8 @@ public class RIL extends BaseCommands implements CommandsInterface { @Override public void sendCdmaSMSExpectMore(byte[] pdu, Message result) { if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_5)) { IRadio radioProxy = getRadioProxy(result); // IRadio V1.5 android.hardware.radio.V1_5.IRadio radioProxy15 = (android.hardware.radio.V1_5.IRadio) radioProxy; if (radioProxy15 != null) { if (radioProxy != null) { RILRequest rr = obtainRequest(RIL_REQUEST_CDMA_SEND_SMS_EXPECT_MORE, result, mRILDefaultWorkSource); Loading @@ -3678,20 +3700,33 @@ public class RIL extends BaseCommands implements CommandsInterface { CdmaSmsMessage msg = new CdmaSmsMessage(); constructCdmaSendSmsRilRequest(msg, pdu); if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_6)) { android.hardware.radio.V1_6.IRadio radioProxy16 = (android.hardware.radio.V1_6.IRadio) radioProxy; try { radioProxy15.sendCdmaSmsExpectMore(rr.mSerial, msg); radioProxy16.sendCdmaSmsExpectMore_1_6(rr.mSerial, msg); mMetrics.writeRilSendSms(mPhoneId, rr.mSerial, SmsSession.Event.Tech.SMS_CDMA, SmsSession.Event.Format.SMS_FORMAT_3GPP2, getOutgoingSmsMessageId(result)); } catch (RemoteException | RuntimeException e) { handleRadioProxyExceptionForRR(rr, "sendCdmaSMSExpectMore", e); } } else if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_5)) { android.hardware.radio.V1_5.IRadio radioProxy15 = (android.hardware.radio.V1_5.IRadio) radioProxy; try { radioProxy15.sendCdmaSmsExpectMore(rr.mSerial, msg); mMetrics.writeRilSendSms(mPhoneId, rr.mSerial, SmsSession.Event.Tech.SMS_CDMA, SmsSession.Event.Format.SMS_FORMAT_3GPP2, getOutgoingSmsMessageId(result)); } catch (RemoteException | RuntimeException e) { handleRadioProxyExceptionForRR(rr, "sendCdmaSMSExpectMore", e); } } else { sendCdmaSms(pdu, result); } } } @Override public void sendCdmaSms(byte[] pdu, Message result) { Loading @@ -3705,16 +3740,29 @@ public class RIL extends BaseCommands implements CommandsInterface { CdmaSmsMessage msg = new CdmaSmsMessage(); constructCdmaSendSmsRilRequest(msg, pdu); if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_6)) { try { android.hardware.radio.V1_6.IRadio radioProxy16 = (android.hardware.radio.V1_6.IRadio) radioProxy; radioProxy16.sendCdmaSms_1_6(rr.mSerial, msg); mMetrics.writeRilSendSms(mPhoneId, rr.mSerial, SmsSession.Event.Tech.SMS_CDMA, SmsSession.Event.Format.SMS_FORMAT_3GPP2, getOutgoingSmsMessageId(result)); } catch (RemoteException | RuntimeException e) { handleRadioProxyExceptionForRR(rr, "sendCdmaSms", e); } } else { try { radioProxy.sendCdmaSms(rr.mSerial, msg); mMetrics.writeRilSendSms(mPhoneId, rr.mSerial, SmsSession.Event.Tech.SMS_CDMA, SmsSession.Event.Format.SMS_FORMAT_3GPP2, getOutgoingSmsMessageId(result)); SmsSession.Event.Format.SMS_FORMAT_3GPP2, getOutgoingSmsMessageId(result)); } catch (RemoteException | RuntimeException e) { handleRadioProxyExceptionForRR(rr, "sendCdmaSms", e); } } } } @Override public void acknowledgeLastIncomingCdmaSms(boolean success, int cause, Message result) { Loading
src/java/com/android/internal/telephony/RadioResponse.java +57 −0 Original line number Diff line number Diff line Loading @@ -499,6 +499,16 @@ public class RadioResponse extends IRadioResponse.Stub { responseSms(responseInfo, sms); } /** * @param responseInfo Response info struct containing response type, serial no. and error which * is defined in 1.6/types.hal * @param sms Response to sms sent as defined by SendSmsResult in types.hal */ public void sendSmsResponse_1_6(android.hardware.radio.V1_6.RadioResponseInfo responseInfo, SendSmsResult sms) { responseSms_1_6(responseInfo, sms); } /** * @param responseInfo Response info struct containing response type, serial no. and error * @param sms Response to sms sent as defined by SendSmsResult in types.hal Loading @@ -508,6 +518,17 @@ public class RadioResponse extends IRadioResponse.Stub { responseSms(responseInfo, sms); } /** * @param responseInfo Response info struct containing response type, serial no. and error which * is defined in 1.6/types.hal * @param sms Response to sms sent as defined by SendSmsResult in 1.6/types.hal */ public void sendSMSExpectMoreResponse_1_6( android.hardware.radio.V1_6.RadioResponseInfo responseInfo, SendSmsResult sms) { responseSms_1_6(responseInfo, sms); } /** * @param responseInfo Response info struct containing response type, serial no. and error * @param setupDataCallResult Response to data call setup as defined by setupDataCallResult in Loading Loading @@ -1038,6 +1059,17 @@ public class RadioResponse extends IRadioResponse.Stub { responseSms(responseInfo, sms); } /** * * @param responseInfo Response info struct containing response type, serial no. and error which * is defined in 1.6/types.hal * @param sms Sms result struct as defined by SendSmsResult in types.hal */ public void sendCdmaSmsResponse_1_6(android.hardware.radio.V1_6.RadioResponseInfo responseInfo, SendSmsResult sms) { responseSms_1_6(responseInfo, sms); } /** * * @param responseInfo Response info struct containing response type, serial no. and error Loading @@ -1047,6 +1079,17 @@ public class RadioResponse extends IRadioResponse.Stub { responseSms(responseInfo, sms); } /** * * @param responseInfo Response info struct containing response type, serial no. and error which * is defined in 1.6/types.hal * @param sms Sms result struct as defined by SendSmsResult in types.hal */ public void sendCdmaSMSExpectMoreResponse_1_6( android.hardware.radio.V1_6.RadioResponseInfo responseInfo, SendSmsResult sms) { responseSms_1_6(responseInfo, sms); } /** * @param responseInfo Response info struct containing response type, serial no. and error */ Loading Loading @@ -2211,6 +2254,20 @@ public class RadioResponse extends IRadioResponse.Stub { } } private void responseSms_1_6(android.hardware.radio.V1_6.RadioResponseInfo responseInfo, SendSmsResult sms) { RILRequest rr = mRil.processResponse_1_6(responseInfo); if (rr != null) { long messageId = RIL.getOutgoingSmsMessageId(rr.mResult); SmsResponse ret = new SmsResponse(sms.messageRef, sms.ackPDU, sms.errorCode, messageId); if (responseInfo.error == RadioError.NONE) { sendMessageResponse(rr.mResult, ret); } mRil.processResponseDone_1_6(rr, responseInfo, ret); } } private void responseSetupDataCall(RadioResponseInfo responseInfo, Object setupDataCallResult) { RILRequest rr = mRil.processResponse(responseInfo); Loading
tests/telephonytests/src/com/android/internal/telephony/RILTest.java +110 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ package com.android.internal.telephony; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_ALLOW_DATA; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_CDMA_GET_SUBSCRIPTION_SOURCE; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_CDMA_SEND_SMS; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_CDMA_SEND_SMS_EXPECT_MORE; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_CHANGE_SIM_PIN; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_CHANGE_SIM_PIN2; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_CONFERENCE; Loading Loading @@ -168,6 +170,9 @@ import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Mock; import java.io.ByteArrayInputStream; import java.io.DataInputStream; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; Loading Loading @@ -752,6 +757,24 @@ public class RILTest extends TelephonyTest { verifyRILResponse(mRILUnderTest, mSerialNumberCaptor.getValue(), RIL_REQUEST_SEND_SMS); } @FlakyTest @Test public void testSendSMS_1_6() throws Exception { // Use Radio HAL v1.6 try { replaceInstance(RIL.class, "mRadioVersion", mRILUnderTest, mRadioVersionV16); } catch (Exception e) { } String smscPdu = "smscPdu"; String pdu = "pdu"; GsmSmsMessage msg = new GsmSmsMessage(); msg.smscPdu = smscPdu; msg.pdu = pdu; mRILUnderTest.sendSMS(smscPdu, pdu, obtainMessage()); verify(mRadioProxy).sendSms_1_6(mSerialNumberCaptor.capture(), eq(msg)); verifyRILResponse(mRILUnderTest, mSerialNumberCaptor.getValue(), RIL_REQUEST_SEND_SMS); } @FlakyTest @Test public void testSendSMSExpectMore() throws Exception { Loading @@ -766,6 +789,93 @@ public class RILTest extends TelephonyTest { mRILUnderTest, mSerialNumberCaptor.getValue(), RIL_REQUEST_SEND_SMS_EXPECT_MORE); } @FlakyTest @Test public void testSendSMSExpectMore_1_6() throws Exception { // Use Radio HAL v1.6 try { replaceInstance(RIL.class, "mRadioVersion", mRILUnderTest, mRadioVersionV16); } catch (Exception e) { } String smscPdu = "smscPdu"; String pdu = "pdu"; GsmSmsMessage msg = new GsmSmsMessage(); msg.smscPdu = smscPdu; msg.pdu = pdu; mRILUnderTest.sendSMSExpectMore(smscPdu, pdu, obtainMessage()); verify(mRadioProxy).sendSMSExpectMore_1_6(mSerialNumberCaptor.capture(), eq(msg)); verifyRILResponse( mRILUnderTest, mSerialNumberCaptor.getValue(), RIL_REQUEST_SEND_SMS_EXPECT_MORE); } @FlakyTest @Test public void testSendCdmaSMS_1_6() throws Exception { // Use Radio HAL v1.6 try { replaceInstance(RIL.class, "mRadioVersion", mRILUnderTest, mRadioVersionV16); } catch (Exception e) { } byte[] pdu = "000010020000000000000000000000000000000000".getBytes(); CdmaSmsMessage msg = new CdmaSmsMessage(); constructCdmaSendSmsRilRequest(msg, pdu); mRILUnderTest.sendCdmaSms(pdu, obtainMessage()); verify(mRadioProxy).sendCdmaSms_1_6(mSerialNumberCaptor.capture(), eq(msg)); verifyRILResponse(mRILUnderTest, mSerialNumberCaptor.getValue(), RIL_REQUEST_CDMA_SEND_SMS); } @FlakyTest @Test public void testSendCdmaSMSExpectMore_1_6() throws Exception { // Use Radio HAL v1.6 try { replaceInstance(RIL.class, "mRadioVersion", mRILUnderTest, mRadioVersionV16); } catch (Exception e) { } byte[] pdu = "000010020000000000000000000000000000000000".getBytes(); CdmaSmsMessage msg = new CdmaSmsMessage(); constructCdmaSendSmsRilRequest(msg, pdu); mRILUnderTest.sendCdmaSMSExpectMore(pdu, obtainMessage()); verify(mRadioProxy).sendCdmaSmsExpectMore_1_6(mSerialNumberCaptor.capture(), eq(msg)); verifyRILResponse(mRILUnderTest, mSerialNumberCaptor.getValue(), RIL_REQUEST_CDMA_SEND_SMS_EXPECT_MORE); } private void constructCdmaSendSmsRilRequest(CdmaSmsMessage msg, byte[] pdu) { int addrNbrOfDigits; int subaddrNbrOfDigits; int bearerDataLength; ByteArrayInputStream bais = new ByteArrayInputStream(pdu); DataInputStream dis = new DataInputStream(bais); try { msg.teleserviceId = dis.readInt(); // teleServiceId msg.isServicePresent = (byte) dis.readInt() == 1 ? true : false; // servicePresent msg.serviceCategory = dis.readInt(); // serviceCategory msg.address.digitMode = dis.read(); // address digit mode msg.address.numberMode = dis.read(); // address number mode msg.address.numberType = dis.read(); // address number type msg.address.numberPlan = dis.read(); // address number plan addrNbrOfDigits = (byte) dis.read(); for (int i = 0; i < addrNbrOfDigits; i++) { msg.address.digits.add(dis.readByte()); // address_orig_bytes[i] } msg.subAddress.subaddressType = dis.read(); //subaddressType msg.subAddress.odd = (byte) dis.read() == 1 ? true : false; //subaddr odd subaddrNbrOfDigits = (byte) dis.read(); for (int i = 0; i < subaddrNbrOfDigits; i++) { msg.subAddress.digits.add(dis.readByte()); //subaddr_orig_bytes[i] } bearerDataLength = dis.read(); for (int i = 0; i < bearerDataLength; i++) { msg.bearerData.add(dis.readByte()); //bearerData[i] } } catch (IOException ex) { ex.printStackTrace(); } } @FlakyTest @Test public void testWriteSmsToSim() throws Exception { Loading