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