• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.internal.telephony;
18 
19 import android.os.RemoteException;
20 import android.telephony.Rlog;
21 
22 import com.android.internal.telephony.cdma.CdmaSmsBroadcastConfigInfo;
23 import com.android.internal.telephony.gsm.SmsBroadcastConfigInfo;
24 
25 import java.util.ArrayList;
26 
27 /**
28  * A holder for IRadioMessaging. Use getHidl to get IRadio 1.0 and call the HIDL implementations or
29  * getAidl to get IRadioMessaging and call the AIDL implementations of the HAL APIs.
30  */
31 public class RadioMessagingProxy extends RadioServiceProxy {
32     private static final String TAG = "RadioMessagingProxy";
33     private volatile android.hardware.radio.messaging.IRadioMessaging mMessagingProxy = null;
34 
35     /**
36      * Set IRadioMessaging as the AIDL implementation for RadioServiceProxy
37      * @param halVersion Radio HAL version
38      * @param messaging IRadioMessaging implementation
39      */
setAidl(HalVersion halVersion, android.hardware.radio.messaging.IRadioMessaging messaging)40     public void setAidl(HalVersion halVersion,
41             android.hardware.radio.messaging.IRadioMessaging messaging) {
42         mHalVersion = halVersion;
43         mMessagingProxy = messaging;
44         mIsAidl = true;
45         Rlog.d(TAG, "AIDL initialized");
46     }
47 
48     /**
49      * Get the AIDL implementation of RadioMessagingProxy
50      * @return IRadioMessaging implementation
51      */
getAidl()52     public android.hardware.radio.messaging.IRadioMessaging getAidl() {
53         return mMessagingProxy;
54     }
55 
56     /**
57      * Reset RadioMessagingProxy
58      */
59     @Override
clear()60     public void clear() {
61         super.clear();
62         mMessagingProxy = null;
63     }
64 
65     /**
66      * Check whether a RadioMessaging implementation exists
67      * @return true if there is neither a HIDL nor AIDL implementation
68      */
69     @Override
isEmpty()70     public boolean isEmpty() {
71         return mRadioProxy == null && mMessagingProxy == null;
72     }
73 
74     /**
75      * Call IRadioMessaging#acknowledgeIncomingGsmSmsWithPdu
76      * @param serial Serial number of request
77      * @param success True on successful receipt (RP-ACK) and false on failed receipt (RP-ERROR)
78      * @param ackPdu Acknowledgement TPDU in hexadecimal format
79      * @throws RemoteException
80      */
acknowledgeIncomingGsmSmsWithPdu(int serial, boolean success, String ackPdu)81     public void acknowledgeIncomingGsmSmsWithPdu(int serial, boolean success, String ackPdu)
82             throws RemoteException {
83         if (isEmpty()) return;
84         if (isAidl()) {
85             mMessagingProxy.acknowledgeIncomingGsmSmsWithPdu(serial, success, ackPdu);
86         } else {
87             mRadioProxy.acknowledgeIncomingGsmSmsWithPdu(serial, success, ackPdu);
88         }
89     }
90 
91     /**
92      * Calls IRadioMessaging#acknowledgeLastIncomingCdmaSms
93      * @param serial Serial number of request
94      * @param success True on successful receipt
95      * @param cause Failure cause if success is false
96      * @throws RemoteException
97      */
acknowledgeLastIncomingCdmaSms(int serial, boolean success, int cause)98     public void acknowledgeLastIncomingCdmaSms(int serial, boolean success, int cause)
99             throws RemoteException {
100         if (isEmpty()) return;
101         if (isAidl()) {
102             android.hardware.radio.messaging.CdmaSmsAck msg =
103                     new android.hardware.radio.messaging.CdmaSmsAck();
104             msg.errorClass = success;
105             msg.smsCauseCode = cause;
106             mMessagingProxy.acknowledgeLastIncomingCdmaSms(serial, msg);
107         } else {
108             android.hardware.radio.V1_0.CdmaSmsAck msg =
109                     new android.hardware.radio.V1_0.CdmaSmsAck();
110             msg.errorClass = success ? 0 : 1;
111             msg.smsCauseCode = cause;
112             mRadioProxy.acknowledgeLastIncomingCdmaSms(serial, msg);
113         }
114     }
115 
116     /**
117      * Calls IRadioMessaging#acknowledgeLastIncomingGsmSms
118      * @param serial Serial number of request
119      * @param success True on successful receipt
120      * @param cause Failure cause if success is false
121      * @throws RemoteException
122      */
acknowledgeLastIncomingGsmSms(int serial, boolean success, int cause)123     public void acknowledgeLastIncomingGsmSms(int serial, boolean success, int cause)
124             throws RemoteException {
125         if (isEmpty()) return;
126         if (isAidl()) {
127             mMessagingProxy.acknowledgeLastIncomingGsmSms(serial, success, cause);
128         } else {
129             mRadioProxy.acknowledgeLastIncomingGsmSms(serial, success, cause);
130         }
131     }
132 
133     /**
134      * Call IRadioMessaging#deleteSmsOnRuim
135      * @param serial Serial number of request
136      * @param index Record index of the message to delete
137      * @throws RemoteException
138      */
deleteSmsOnRuim(int serial, int index)139     public void deleteSmsOnRuim(int serial, int index) throws RemoteException {
140         if (isEmpty()) return;
141         if (isAidl()) {
142             mMessagingProxy.deleteSmsOnRuim(serial, index);
143         } else {
144             mRadioProxy.deleteSmsOnRuim(serial, index);
145         }
146     }
147 
148     /**
149      * Call IRadioMessaging#deleteSmsOnSim
150      * @param serial Serial number of request
151      * @param index Record index of the message to delete
152      * @throws RemoteException
153      */
deleteSmsOnSim(int serial, int index)154     public void deleteSmsOnSim(int serial, int index) throws RemoteException {
155         if (isEmpty()) return;
156         if (isAidl()) {
157             mMessagingProxy.deleteSmsOnSim(serial, index);
158         } else {
159             mRadioProxy.deleteSmsOnSim(serial, index);
160         }
161     }
162 
163     /**
164      * Call IRadioMessaging#getCdmaBroadcastConfig
165      * @param serial Serial number of request
166      * @throws RemoteException
167      */
getCdmaBroadcastConfig(int serial)168     public void getCdmaBroadcastConfig(int serial) throws RemoteException {
169         if (isEmpty()) return;
170         if (isAidl()) {
171             mMessagingProxy.getCdmaBroadcastConfig(serial);
172         } else {
173             mRadioProxy.getCdmaBroadcastConfig(serial);
174         }
175     }
176 
177     /**
178      * Call IRadioMessaging#getGsmBroadcastConfig
179      * @param serial Serial number of request
180      * @throws RemoteException
181      */
getGsmBroadcastConfig(int serial)182     public void getGsmBroadcastConfig(int serial) throws RemoteException {
183         if (isEmpty()) return;
184         if (isAidl()) {
185             mMessagingProxy.getGsmBroadcastConfig(serial);
186         } else {
187             mRadioProxy.getGsmBroadcastConfig(serial);
188         }
189     }
190 
191     /**
192      * Call IRadioMessaging#getSmscAddress
193      * @param serial Serial number of request
194      * @throws RemoteException
195      */
getSmscAddress(int serial)196     public void getSmscAddress(int serial) throws RemoteException {
197         if (isEmpty()) return;
198         if (isAidl()) {
199             mMessagingProxy.getSmscAddress(serial);
200         } else {
201             mRadioProxy.getSmscAddress(serial);
202         }
203     }
204 
205     /**
206      * Call IRadioMessaging#reportSmsMemoryStatus
207      * @param serial Serial number of request
208      * @param available Whether or not storage is available
209      * @throws RemoteException
210      */
reportSmsMemoryStatus(int serial, boolean available)211     public void reportSmsMemoryStatus(int serial, boolean available) throws RemoteException {
212         if (isEmpty()) return;
213         if (isAidl()) {
214             mMessagingProxy.reportSmsMemoryStatus(serial, available);
215         } else {
216             mRadioProxy.reportSmsMemoryStatus(serial, available);
217         }
218     }
219 
220     /**
221      * Call IRadioMessaging#responseAcknowledgement
222      * @throws RemoteException
223      */
224     @Override
responseAcknowledgement()225     public void responseAcknowledgement() throws RemoteException {
226         if (isEmpty()) return;
227         if (isAidl()) {
228             mMessagingProxy.responseAcknowledgement();
229         } else {
230             mRadioProxy.responseAcknowledgement();
231         }
232     }
233 
234     /**
235      * Call IRadioMessaging#sendCdmaSms
236      * @param serial Serial number of request
237      * @param pdu CDMA-SMS in internal pseudo-PDU format
238      * @throws RemoteException
239      */
sendCdmaSms(int serial, byte[] pdu)240     public void sendCdmaSms(int serial, byte[] pdu) throws RemoteException {
241         if (isEmpty()) return;
242         if (isAidl()) {
243             mMessagingProxy.sendCdmaSms(serial, RILUtils.convertToHalCdmaSmsMessageAidl(pdu));
244         } else if (mHalVersion.greaterOrEqual(RIL.RADIO_HAL_VERSION_1_6)) {
245             ((android.hardware.radio.V1_6.IRadio) mRadioProxy).sendCdmaSms_1_6(
246                     serial, RILUtils.convertToHalCdmaSmsMessage(pdu));
247         } else {
248             mRadioProxy.sendCdmaSms(serial, RILUtils.convertToHalCdmaSmsMessage(pdu));
249         }
250     }
251 
252     /**
253      * Call IRadioMessaging#sendCdmaSmsExpectMore
254      * @param serial Serial number of request
255      * @param pdu CDMA-SMS in internal pseudo-PDU format
256      * @throws RemoteException
257      */
sendCdmaSmsExpectMore(int serial, byte[] pdu)258     public void sendCdmaSmsExpectMore(int serial, byte[] pdu) throws RemoteException {
259         if (isEmpty()) return;
260         if (isAidl()) {
261             mMessagingProxy.sendCdmaSmsExpectMore(
262                     serial, RILUtils.convertToHalCdmaSmsMessageAidl(pdu));
263         } else if (mHalVersion.greaterOrEqual(RIL.RADIO_HAL_VERSION_1_6)) {
264             ((android.hardware.radio.V1_6.IRadio) mRadioProxy).sendCdmaSmsExpectMore_1_6(
265                     serial, RILUtils.convertToHalCdmaSmsMessage(pdu));
266         } else if (mHalVersion.greaterOrEqual(RIL.RADIO_HAL_VERSION_1_5)) {
267             ((android.hardware.radio.V1_5.IRadio) mRadioProxy).sendCdmaSmsExpectMore(
268                     serial, RILUtils.convertToHalCdmaSmsMessage(pdu));
269         } else {
270             mRadioProxy.sendCdmaSms(serial, RILUtils.convertToHalCdmaSmsMessage(pdu));
271         }
272     }
273 
274     /**
275      * Call IRadioMessaging#sendImsSms
276      * @param serial Serial number of request
277      * @param smscPdu SMSC address in PDU form GSM BCD format prefixed by a length byte
278      *                or NULL for default SMSC
279      * @param gsmPdu SMS in PDU format as an ASCII hex string less the SMSC address
280      * @param cdmaPdu CDMA-SMS in internal pseudo-PDU format
281      * @param retry Whether this is a retry; 0 == not retry, nonzero = retry
282      * @param messageRef MessageRef from RIL_SMS_RESPONSE corresponding to failed MO SMS
283      *                   if retry is nonzero
284      * @throws RemoteException
285      */
sendImsSms(int serial, String smscPdu, String gsmPdu, byte[] cdmaPdu, int retry, int messageRef)286     public void sendImsSms(int serial, String smscPdu, String gsmPdu, byte[] cdmaPdu, int retry,
287             int messageRef) throws RemoteException {
288         if (isEmpty()) return;
289         if (isAidl()) {
290             android.hardware.radio.messaging.ImsSmsMessage msg =
291                     new android.hardware.radio.messaging.ImsSmsMessage();
292             msg.tech = android.hardware.radio.RadioTechnologyFamily.THREE_GPP;
293             msg.retry = (byte) retry >= 1;
294             msg.messageRef = messageRef;
295             if (gsmPdu != null) {
296                 msg.gsmMessage = new android.hardware.radio.messaging.GsmSmsMessage[]{
297                         RILUtils.convertToHalGsmSmsMessageAidl(smscPdu, gsmPdu)};
298                 msg.cdmaMessage = new android.hardware.radio.messaging.CdmaSmsMessage[0];
299             }
300             if (cdmaPdu != null) {
301                 msg.gsmMessage = new android.hardware.radio.messaging.GsmSmsMessage[0];
302                 msg.cdmaMessage = new android.hardware.radio.messaging.CdmaSmsMessage[]{
303                         RILUtils.convertToHalCdmaSmsMessageAidl(cdmaPdu)};
304             }
305             mMessagingProxy.sendImsSms(serial, msg);
306         } else {
307             android.hardware.radio.V1_0.ImsSmsMessage msg =
308                     new android.hardware.radio.V1_0.ImsSmsMessage();
309             msg.tech = android.hardware.radio.V1_0.RadioTechnologyFamily.THREE_GPP;
310             msg.retry = (byte) retry >= 1;
311             msg.messageRef = messageRef;
312             if (gsmPdu != null) {
313                 msg.gsmMessage.add(RILUtils.convertToHalGsmSmsMessage(smscPdu, gsmPdu));
314             }
315             if (cdmaPdu != null) {
316                 msg.cdmaMessage.add(RILUtils.convertToHalCdmaSmsMessage(cdmaPdu));
317             }
318             mRadioProxy.sendImsSms(serial, msg);
319         }
320     }
321 
322     /**
323      * Call IRadioMessaging#sendSms
324      * @param serial Serial number of request
325      * @param smscPdu SMSC address in PDU form GSM BCD format prefixed by a length byte
326      *                or NULL for default SMSC
327      * @param pdu SMS in PDU format as an ASCII hex string less the SMSC address
328      * @throws RemoteException
329      */
sendSms(int serial, String smscPdu, String pdu)330     public void sendSms(int serial, String smscPdu, String pdu) throws RemoteException {
331         if (isEmpty()) return;
332         if (isAidl()) {
333             mMessagingProxy.sendSms(serial, RILUtils.convertToHalGsmSmsMessageAidl(smscPdu, pdu));
334         } else if (mHalVersion.greaterOrEqual(RIL.RADIO_HAL_VERSION_1_6)) {
335             ((android.hardware.radio.V1_6.IRadio) mRadioProxy).sendSms_1_6(
336                     serial, RILUtils.convertToHalGsmSmsMessage(smscPdu, pdu));
337         } else {
338             mRadioProxy.sendSms(serial, RILUtils.convertToHalGsmSmsMessage(smscPdu, pdu));
339         }
340     }
341 
342     /**
343      * Call IRadioMessaging#sendSmsExpectMore
344      * @param serial Serial number of request
345      * @param smscPdu SMSC address in PDU form GSM BCD format prefixed by a length byte
346      *                or NULL for default SMSC
347      * @param pdu SMS in PDU format as an ASCII hex string less the SMSC address
348      * @throws RemoteException
349      */
sendSmsExpectMore(int serial, String smscPdu, String pdu)350     public void sendSmsExpectMore(int serial, String smscPdu, String pdu) throws RemoteException {
351         if (isEmpty()) return;
352         if (isAidl()) {
353             mMessagingProxy.sendSmsExpectMore(serial,
354                     RILUtils.convertToHalGsmSmsMessageAidl(smscPdu, pdu));
355         } else if (mHalVersion.greaterOrEqual(RIL.RADIO_HAL_VERSION_1_6)) {
356             ((android.hardware.radio.V1_6.IRadio) mRadioProxy).sendSmsExpectMore_1_6(serial,
357                     RILUtils.convertToHalGsmSmsMessage(smscPdu, pdu));
358         } else {
359             mRadioProxy.sendSMSExpectMore(serial, RILUtils.convertToHalGsmSmsMessage(smscPdu, pdu));
360         }
361     }
362 
363     /**
364      * Call IRadioMessaging#setCdmaBroadcastActivation
365      * @param serial Serial number of request
366      * @param activate Whether to activate or turn off the reception of CDMA Cell Broadcast SMS;
367      *                 true = activate, false = turn off
368      * @throws RemoteException
369      */
setCdmaBroadcastActivation(int serial, boolean activate)370     public void setCdmaBroadcastActivation(int serial, boolean activate) throws RemoteException {
371         if (isEmpty()) return;
372         if (isAidl()) {
373             mMessagingProxy.setCdmaBroadcastActivation(serial, activate);
374         } else {
375             mRadioProxy.setCdmaBroadcastActivation(serial, activate);
376         }
377     }
378 
379     /**
380      * Call IRadioMessaging#setCdmaBroadcastConfig
381      * @param serial Serial number of request
382      * @param configs Setting of CDMA cell broadcast config
383      * @throws RemoteException
384      */
setCdmaBroadcastConfig(int serial, CdmaSmsBroadcastConfigInfo[] configs)385     public void setCdmaBroadcastConfig(int serial, CdmaSmsBroadcastConfigInfo[] configs)
386             throws RemoteException {
387         if (isEmpty()) return;
388         if (isAidl()) {
389             ArrayList<android.hardware.radio.messaging.CdmaBroadcastSmsConfigInfo> halConfigs =
390                     new ArrayList<>();
391             for (CdmaSmsBroadcastConfigInfo config: configs) {
392                 for (int i = config.getFromServiceCategory(); i <= config.getToServiceCategory();
393                         i++) {
394                     android.hardware.radio.messaging.CdmaBroadcastSmsConfigInfo info =
395                             new android.hardware.radio.messaging.CdmaBroadcastSmsConfigInfo();
396                     info.serviceCategory = i;
397                     info.language = config.getLanguage();
398                     info.selected = config.isSelected();
399                     halConfigs.add(info);
400                 }
401             }
402             mMessagingProxy.setCdmaBroadcastConfig(serial, halConfigs.stream().toArray(
403                     android.hardware.radio.messaging.CdmaBroadcastSmsConfigInfo[]::new));
404         } else {
405             ArrayList<android.hardware.radio.V1_0.CdmaBroadcastSmsConfigInfo> halConfigs =
406                     new ArrayList<>();
407             for (CdmaSmsBroadcastConfigInfo config: configs) {
408                 for (int i = config.getFromServiceCategory(); i <= config.getToServiceCategory();
409                         i++) {
410                     android.hardware.radio.V1_0.CdmaBroadcastSmsConfigInfo info =
411                             new android.hardware.radio.V1_0.CdmaBroadcastSmsConfigInfo();
412                     info.serviceCategory = i;
413                     info.language = config.getLanguage();
414                     info.selected = config.isSelected();
415                     halConfigs.add(info);
416                 }
417             }
418             mRadioProxy.setCdmaBroadcastConfig(serial, halConfigs);
419         }
420     }
421 
422     /**
423      * Call IRadioMessaging#setGsmBroadcastActivation
424      * @param serial Serial number of request
425      * @param activate Whether to activate or turn off the reception of GSM/WCDMA Cell Broadcast
426      *                 SMS; true = activate, false = turn off
427      * @throws RemoteException
428      */
setGsmBroadcastActivation(int serial, boolean activate)429     public void setGsmBroadcastActivation(int serial, boolean activate) throws RemoteException {
430         if (isEmpty()) return;
431         if (isAidl()) {
432             mMessagingProxy.setGsmBroadcastActivation(serial, activate);
433         } else {
434             mRadioProxy.setGsmBroadcastActivation(serial, activate);
435         }
436     }
437 
438     /**
439      * Call IRadioMessaging#setGsmBroadcastConfig
440      * @param serial Serial number of request
441      * @param configInfo Setting of GSM/WCDMA cell broadcast config
442      * @throws RemoteException
443      */
setGsmBroadcastConfig(int serial, SmsBroadcastConfigInfo[] configInfo)444     public void setGsmBroadcastConfig(int serial, SmsBroadcastConfigInfo[] configInfo)
445             throws RemoteException {
446         if (isEmpty()) return;
447         if (isAidl()) {
448             android.hardware.radio.messaging.GsmBroadcastSmsConfigInfo[] configs =
449                     new android.hardware.radio.messaging.GsmBroadcastSmsConfigInfo[
450                             configInfo.length];
451             android.hardware.radio.messaging.GsmBroadcastSmsConfigInfo info;
452             for (int i = 0; i < configInfo.length; i++) {
453                 info = new android.hardware.radio.messaging.GsmBroadcastSmsConfigInfo();
454                 info.fromServiceId = configInfo[i].getFromServiceId();
455                 info.toServiceId = configInfo[i].getToServiceId();
456                 info.fromCodeScheme = configInfo[i].getFromCodeScheme();
457                 info.toCodeScheme = configInfo[i].getToCodeScheme();
458                 info.selected = configInfo[i].isSelected();
459                 configs[i] = info;
460             }
461             mMessagingProxy.setGsmBroadcastConfig(serial, configs);
462         } else {
463             ArrayList<android.hardware.radio.V1_0.GsmBroadcastSmsConfigInfo> configs =
464                     new ArrayList<>();
465             android.hardware.radio.V1_0.GsmBroadcastSmsConfigInfo info;
466             for (int i = 0; i < configInfo.length; i++) {
467                 info = new android.hardware.radio.V1_0.GsmBroadcastSmsConfigInfo();
468                 info.fromServiceId = configInfo[i].getFromServiceId();
469                 info.toServiceId = configInfo[i].getToServiceId();
470                 info.fromCodeScheme = configInfo[i].getFromCodeScheme();
471                 info.toCodeScheme = configInfo[i].getToCodeScheme();
472                 info.selected = configInfo[i].isSelected();
473                 configs.add(info);
474             }
475             mRadioProxy.setGsmBroadcastConfig(serial, configs);
476         }
477     }
478 
479     /**
480      * Call IRadioMessaging#setSmscAddress
481      * @param serial Serial number of request
482      * @param smsc Short Message Service Center address to set
483      * @throws RemoteException
484      */
setSmscAddress(int serial, String smsc)485     public void setSmscAddress(int serial, String smsc) throws RemoteException {
486         if (isEmpty()) return;
487         if (isAidl()) {
488             mMessagingProxy.setSmscAddress(serial, smsc);
489         } else {
490             mRadioProxy.setSmscAddress(serial, smsc);
491         }
492     }
493 
494     /**
495      * Call IRadioMessaging#writeSmsToRuim
496      * @param serial Serial number of request
497      * @param status Status of message on SIM. One of:
498      *               SmsManager.STATUS_ON_ICC_READ
499      *               SmsManager.STATUS_ON_ICC_UNREAD
500      *               SmsManager.STATUS_ON_ICC_SENT
501      *               SmsManager.STATUS_ON_ICC_UNSENT
502      * @param pdu SMS in PDU format as a byte array
503      * @throws RemoteException
504      */
writeSmsToRuim(int serial, int status, byte[] pdu)505     public void writeSmsToRuim(int serial, int status, byte[] pdu) throws RemoteException {
506         if (isEmpty()) return;
507         if (isAidl()) {
508             android.hardware.radio.messaging.CdmaSmsWriteArgs args =
509                     new android.hardware.radio.messaging.CdmaSmsWriteArgs();
510             args.status = RILUtils.convertToHalSmsWriteArgsStatusAidl(status);
511             args.message = RILUtils.convertToHalCdmaSmsMessageAidl(pdu);
512             mMessagingProxy.writeSmsToRuim(serial, args);
513         } else {
514             android.hardware.radio.V1_0.CdmaSmsWriteArgs args =
515                     new android.hardware.radio.V1_0.CdmaSmsWriteArgs();
516             args.status = RILUtils.convertToHalSmsWriteArgsStatus(status);
517             args.message = RILUtils.convertToHalCdmaSmsMessage(pdu);
518             mRadioProxy.writeSmsToRuim(serial, args);
519         }
520     }
521 
522     /**
523      * Call IRadioMessaging#writeSmsToSim
524      * @param serial Serial number of request
525      * @param status Status of message on SIM. One of:
526      *               SmsManager.STATUS_ON_ICC_READ
527      *               SmsManager.STATUS_ON_ICC_UNREAD
528      *               SmsManager.STATUS_ON_ICC_SENT
529      *               SmsManager.STATUS_ON_ICC_UNSENT
530      * @param smsc SMSC address
531      * @param pdu SMS in PDU format as an ASCII hex string less the SMSC address
532      * @throws RemoteException
533      */
writeSmsToSim(int serial, int status, String smsc, String pdu)534     public void writeSmsToSim(int serial, int status, String smsc, String pdu)
535             throws RemoteException {
536         if (isEmpty()) return;
537         if (isAidl()) {
538             android.hardware.radio.messaging.SmsWriteArgs args =
539                     new android.hardware.radio.messaging.SmsWriteArgs();
540             args.status = RILUtils.convertToHalSmsWriteArgsStatusAidl(status);
541             args.smsc = smsc;
542             args.pdu = pdu;
543             mMessagingProxy.writeSmsToSim(serial, args);
544         } else {
545             android.hardware.radio.V1_0.SmsWriteArgs args =
546                     new android.hardware.radio.V1_0.SmsWriteArgs();
547             args.status = RILUtils.convertToHalSmsWriteArgsStatus(status);
548             args.smsc = smsc;
549             args.pdu = pdu;
550             mRadioProxy.writeSmsToSim(serial, args);
551         }
552     }
553 }
554