• 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.PhoneNumberUtils;
21 import android.telephony.Rlog;
22 import android.telephony.emergency.EmergencyNumber;
23 
24 import java.util.ArrayList;
25 
26 /**
27  * A holder for IRadioVoice. Use getHidl to get IRadio 1.0 and call the HIDL implementations or
28  * getAidl to get IRadioVoice and call the AIDL implementations of the HAL APIs.
29  */
30 public class RadioVoiceProxy extends RadioServiceProxy {
31     private static final String TAG = "RadioVoiceProxy";
32     private volatile android.hardware.radio.voice.IRadioVoice mVoiceProxy = null;
33 
34     /**
35      * Set IRadioVoice as the AIDL implementation for RadioServiceProxy
36      * @param halVersion Radio HAL version
37      * @param voice IRadioVoice implementation
38      */
setAidl(HalVersion halVersion, android.hardware.radio.voice.IRadioVoice voice)39     public void setAidl(HalVersion halVersion, android.hardware.radio.voice.IRadioVoice voice) {
40         mHalVersion = halVersion;
41         mVoiceProxy = voice;
42         mIsAidl = true;
43         Rlog.d(TAG, "AIDL initialized");
44     }
45 
46     /**
47      * Get the AIDL implementation of RadioVoiceProxy
48      * @return IRadioVoice implementation
49      */
getAidl()50     public android.hardware.radio.voice.IRadioVoice getAidl() {
51         return mVoiceProxy;
52     }
53 
54     /**
55      * Reset RadioVoiceProxy
56      */
57     @Override
clear()58     public void clear() {
59         super.clear();
60         mVoiceProxy = null;
61     }
62 
63     /**
64      * Check whether a RadioVoice implementation exists
65      * @return true if there is neither a HIDL nor AIDL implementation
66      */
67     @Override
isEmpty()68     public boolean isEmpty() {
69         return mRadioProxy == null && mVoiceProxy == null;
70     }
71 
72     /**
73      * Call IRadioVoice#acceptCall
74      * @param serial Serial number of request
75      * @throws RemoteException
76      */
acceptCall(int serial)77     public void acceptCall(int serial) throws RemoteException {
78         if (isEmpty()) return;
79         if (isAidl()) {
80             mVoiceProxy.acceptCall(serial);
81         } else {
82             mRadioProxy.acceptCall(serial);
83         }
84     }
85 
86     /**
87      * Call IRadioVoice#cancelPendingUssd
88      * @param serial Serial number of request
89      * @throws RemoteException
90      */
cancelPendingUssd(int serial)91     public void cancelPendingUssd(int serial) throws RemoteException {
92         if (isEmpty()) return;
93         if (isAidl()) {
94             mVoiceProxy.cancelPendingUssd(serial);
95         } else {
96             mRadioProxy.cancelPendingUssd(serial);
97         }
98     }
99 
100     /**
101      * Call IRadioVoice#conference
102      * @param serial Serial number of request
103      * @throws RemoteException
104      */
conference(int serial)105     public void conference(int serial) throws RemoteException {
106         if (isEmpty()) return;
107         if (isAidl()) {
108             mVoiceProxy.conference(serial);
109         } else {
110             mRadioProxy.conference(serial);
111         }
112     }
113 
114     /**
115      * Call IRadioVoice#dial
116      * @param serial Serial number of request
117      * @param address Address
118      * @param clirMode CLIR mode
119      * @param uusInfo UUS info
120      * @throws RemoteException
121      */
dial(int serial, String address, int clirMode, UUSInfo uusInfo)122     public void dial(int serial, String address, int clirMode, UUSInfo uusInfo)
123             throws RemoteException {
124         if (isEmpty()) return;
125         if (isAidl()) {
126             mVoiceProxy.dial(serial, RILUtils.convertToHalDialAidl(address, clirMode, uusInfo));
127         } else {
128             mRadioProxy.dial(serial, RILUtils.convertToHalDial(address, clirMode, uusInfo));
129         }
130     }
131 
132     /**
133      * Call IRadioVoice#emergencyDial
134      * @param serial Serial number of request
135      * @param address Address
136      * @param emergencyNumberInfo Emergency number information
137      * @param hasKnownUserIntentEmergency Whether or not the request has known user intent emergency
138      * @param clirMode CLIR mode
139      * @param uusInfo UUS info
140      * @throws RemoteException
141      */
emergencyDial(int serial, String address, EmergencyNumber emergencyNumberInfo, boolean hasKnownUserIntentEmergency, int clirMode, UUSInfo uusInfo)142     public void emergencyDial(int serial, String address, EmergencyNumber emergencyNumberInfo,
143             boolean hasKnownUserIntentEmergency, int clirMode, UUSInfo uusInfo)
144             throws RemoteException {
145         if (isEmpty() || mHalVersion.less(RIL.RADIO_HAL_VERSION_1_4)) return;
146         if (isAidl()) {
147             mVoiceProxy.emergencyDial(serial,
148                     RILUtils.convertToHalDialAidl(address, clirMode, uusInfo),
149                     emergencyNumberInfo.getEmergencyServiceCategoryBitmaskInternalDial(),
150                     emergencyNumberInfo.getEmergencyUrns() != null
151                             ? emergencyNumberInfo.getEmergencyUrns().stream().toArray(String[]::new)
152                             : new String[0],
153                     emergencyNumberInfo.getEmergencyCallRouting(),
154                     hasKnownUserIntentEmergency,
155                     emergencyNumberInfo.getEmergencyNumberSourceBitmask()
156                             == EmergencyNumber.EMERGENCY_NUMBER_SOURCE_TEST);
157         } else if (mHalVersion.greaterOrEqual(RIL.RADIO_HAL_VERSION_1_6)) {
158             ((android.hardware.radio.V1_6.IRadio) mRadioProxy).emergencyDial_1_6(serial,
159                     RILUtils.convertToHalDial(address, clirMode, uusInfo),
160                     emergencyNumberInfo.getEmergencyServiceCategoryBitmaskInternalDial(),
161                     emergencyNumberInfo.getEmergencyUrns() != null
162                             ? new ArrayList(emergencyNumberInfo.getEmergencyUrns())
163                             : new ArrayList<>(),
164                     emergencyNumberInfo.getEmergencyCallRouting(),
165                     hasKnownUserIntentEmergency,
166                     emergencyNumberInfo.getEmergencyNumberSourceBitmask()
167                             == EmergencyNumber.EMERGENCY_NUMBER_SOURCE_TEST);
168         } else {
169             ((android.hardware.radio.V1_4.IRadio) mRadioProxy).emergencyDial(serial,
170                     RILUtils.convertToHalDial(address, clirMode, uusInfo),
171                     emergencyNumberInfo.getEmergencyServiceCategoryBitmaskInternalDial(),
172                     emergencyNumberInfo.getEmergencyUrns() != null
173                             ? new ArrayList(emergencyNumberInfo.getEmergencyUrns())
174                             : new ArrayList<>(),
175                     emergencyNumberInfo.getEmergencyCallRouting(),
176                     hasKnownUserIntentEmergency,
177                     emergencyNumberInfo.getEmergencyNumberSourceBitmask()
178                             == EmergencyNumber.EMERGENCY_NUMBER_SOURCE_TEST);
179         }
180     }
181 
182     /**
183      * Call IRadioVoice#exitEmergencyCallbackMode
184      * @param serial Serial number of request
185      * @throws RemoteException
186      */
exitEmergencyCallbackMode(int serial)187     public void exitEmergencyCallbackMode(int serial) throws RemoteException {
188         if (isEmpty()) return;
189         if (isAidl()) {
190             mVoiceProxy.exitEmergencyCallbackMode(serial);
191         } else {
192             mRadioProxy.exitEmergencyCallbackMode(serial);
193         }
194     }
195 
196     /**
197      * Call IRadioVoice#explicitCallTransfer
198      * @param serial Serial number of request
199      * @throws RemoteException
200      */
explicitCallTransfer(int serial)201     public void explicitCallTransfer(int serial) throws RemoteException {
202         if (isEmpty()) return;
203         if (isAidl()) {
204             mVoiceProxy.explicitCallTransfer(serial);
205         } else {
206             mRadioProxy.explicitCallTransfer(serial);
207         }
208     }
209 
210     /**
211      * Call IRadioVoice#getCallForwardStatus
212      * @param serial Serial number of request
213      * @param cfReason One of CF_REASON_*
214      * @param serviceClass Sum of SERVICE_CLASS_*
215      * @param number Number
216      * @throws RemoteException
217      */
getCallForwardStatus(int serial, int cfReason, int serviceClass, String number)218     public void getCallForwardStatus(int serial, int cfReason, int serviceClass, String number)
219             throws RemoteException {
220         if (isEmpty()) return;
221         if (isAidl()) {
222             android.hardware.radio.voice.CallForwardInfo cfInfo =
223                     new android.hardware.radio.voice.CallForwardInfo();
224             cfInfo.reason = cfReason;
225             cfInfo.serviceClass = serviceClass;
226             cfInfo.toa = PhoneNumberUtils.toaFromString(number);
227             cfInfo.number = RILUtils.convertNullToEmptyString(number);
228             cfInfo.timeSeconds = 0;
229             mVoiceProxy.getCallForwardStatus(serial, cfInfo);
230         } else {
231             android.hardware.radio.V1_0.CallForwardInfo cfInfo =
232                     new android.hardware.radio.V1_0.CallForwardInfo();
233             cfInfo.reason = cfReason;
234             cfInfo.serviceClass = serviceClass;
235             cfInfo.toa = PhoneNumberUtils.toaFromString(number);
236             cfInfo.number = RILUtils.convertNullToEmptyString(number);
237             cfInfo.timeSeconds = 0;
238             mRadioProxy.getCallForwardStatus(serial, cfInfo);
239         }
240     }
241 
242     /**
243      * Call IRadioVoice#getCallWaiting
244      * @param serial Serial number of request
245      * @param serviceClass Sum of SERVICE_CLASS_*
246      * @throws RemoteException
247      */
getCallWaiting(int serial, int serviceClass)248     public void getCallWaiting(int serial, int serviceClass) throws RemoteException {
249         if (isEmpty()) return;
250         if (isAidl()) {
251             mVoiceProxy.getCallWaiting(serial, serviceClass);
252         } else {
253             mRadioProxy.getCallWaiting(serial, serviceClass);
254         }
255     }
256 
257     /**
258      * Call IRadioVoice#getClip
259      * @param serial Serial number of request
260      * @throws RemoteException
261      */
getClip(int serial)262     public void getClip(int serial) throws RemoteException {
263         if (isEmpty()) return;
264         if (isAidl()) {
265             mVoiceProxy.getClip(serial);
266         } else {
267             mRadioProxy.getClip(serial);
268         }
269     }
270 
271     /**
272      * Call IRadioVoice#getClir
273      * @param serial Serial number of request
274      * @throws RemoteException
275      */
getClir(int serial)276     public void getClir(int serial) throws RemoteException {
277         if (isEmpty()) return;
278         if (isAidl()) {
279             mVoiceProxy.getClir(serial);
280         } else {
281             mRadioProxy.getClir(serial);
282         }
283     }
284 
285     /**
286      * Call IRadioVoice#getCurrentCalls
287      * @param serial Serial number of request
288      * @throws RemoteException
289      */
getCurrentCalls(int serial)290     public void getCurrentCalls(int serial) throws RemoteException {
291         if (isEmpty()) return;
292         if (isAidl()) {
293             mVoiceProxy.getCurrentCalls(serial);
294         } else if (mHalVersion.greaterOrEqual(RIL.RADIO_HAL_VERSION_1_6)) {
295             ((android.hardware.radio.V1_6.IRadio) mRadioProxy).getCurrentCalls_1_6(serial);
296         } else {
297             mRadioProxy.getCurrentCalls(serial);
298         }
299     }
300 
301     /**
302      * Call IRadioVoice#getLastCallFailCause
303      * @param serial Serial number of request
304      * @throws RemoteException
305      */
getLastCallFailCause(int serial)306     public void getLastCallFailCause(int serial) throws RemoteException {
307         if (isEmpty()) return;
308         if (isAidl()) {
309             mVoiceProxy.getLastCallFailCause(serial);
310         } else {
311             mRadioProxy.getLastCallFailCause(serial);
312         }
313     }
314 
315     /**
316      * Call IRadioVoice#getMute
317      * @param serial Serial number of request
318      * @throws RemoteException
319      */
getMute(int serial)320     public void getMute(int serial) throws RemoteException {
321         if (isEmpty()) return;
322         if (isAidl()) {
323             mVoiceProxy.getMute(serial);
324         } else {
325             mRadioProxy.getMute(serial);
326         }
327     }
328 
329     /**
330      * Call IRadioVoice#getPreferredVoicePrivacy
331      * @param serial Serial number of request
332      * @throws RemoteException
333      */
getPreferredVoicePrivacy(int serial)334     public void getPreferredVoicePrivacy(int serial) throws RemoteException {
335         if (isEmpty()) return;
336         if (isAidl()) {
337             mVoiceProxy.getPreferredVoicePrivacy(serial);
338         } else {
339             mRadioProxy.getPreferredVoicePrivacy(serial);
340         }
341     }
342 
343     /**
344      * Call IRadioVoice#getTtyMode
345      * @param serial Serial number of request
346      * @throws RemoteException
347      */
getTtyMode(int serial)348     public void getTtyMode(int serial) throws RemoteException {
349         if (isEmpty()) return;
350         if (isAidl()) {
351             mVoiceProxy.getTtyMode(serial);
352         } else {
353             mRadioProxy.getTTYMode(serial);
354         }
355     }
356 
357     /**
358      * Call IRadioVoice#handleStkCallSetupRequestFromSim
359      * @param serial Serial number of request
360      * @param accept Whether or not the call is to be accepted
361      * @throws RemoteException
362      */
handleStkCallSetupRequestFromSim(int serial, boolean accept)363     public void handleStkCallSetupRequestFromSim(int serial, boolean accept)
364             throws RemoteException {
365         if (isEmpty()) return;
366         if (isAidl()) {
367             mVoiceProxy.handleStkCallSetupRequestFromSim(serial, accept);
368         } else {
369             mRadioProxy.handleStkCallSetupRequestFromSim(serial, accept);
370         }
371     }
372 
373     /**
374      * Call IRadioVoice#hangup
375      * @param serial Serial number of request
376      * @param gsmIndex Connection index
377      * @throws RemoteException
378      */
hangup(int serial, int gsmIndex)379     public void hangup(int serial, int gsmIndex) throws RemoteException {
380         if (isEmpty()) return;
381         if (isAidl()) {
382             mVoiceProxy.hangup(serial, gsmIndex);
383         } else {
384             mRadioProxy.hangup(serial, gsmIndex);
385         }
386     }
387 
388     /**
389      * Call IRadioVoice#hangupForegroundResumeBackground
390      * @param serial Serial number of request
391      * @throws RemoteException
392      */
hangupForegroundResumeBackground(int serial)393     public void hangupForegroundResumeBackground(int serial) throws RemoteException {
394         if (isEmpty()) return;
395         if (isAidl()) {
396             mVoiceProxy.hangupForegroundResumeBackground(serial);
397         } else {
398             mRadioProxy.hangupForegroundResumeBackground(serial);
399         }
400     }
401 
402     /**
403      * Call IRadioVoice#hangupWaitingOrBackground
404      * @param serial Serial number of request
405      * @throws RemoteException
406      */
hangupWaitingOrBackground(int serial)407     public void hangupWaitingOrBackground(int serial) throws RemoteException {
408         if (isEmpty()) return;
409         if (isAidl()) {
410             mVoiceProxy.hangupWaitingOrBackground(serial);
411         } else {
412             mRadioProxy.hangupWaitingOrBackground(serial);
413         }
414     }
415 
416     /**
417      * Call IRadioVoice#isVoNrEnabled
418      * @param serial Serial number of request
419      * @throws RemoteException
420      */
isVoNrEnabled(int serial)421     public void isVoNrEnabled(int serial) throws RemoteException {
422         if (isEmpty()) return;
423         if (isAidl()) {
424             mVoiceProxy.isVoNrEnabled(serial);
425         }
426     }
427 
428     /**
429      * Call IRadioVoice#rejectCall
430      * @param serial Serial number of request
431      * @throws RemoteException
432      */
rejectCall(int serial)433     public void rejectCall(int serial) throws RemoteException {
434         if (isEmpty()) return;
435         if (isAidl()) {
436             mVoiceProxy.rejectCall(serial);
437         } else {
438             mRadioProxy.rejectCall(serial);
439         }
440     }
441 
442     /**
443      * Call IRadioVoice#responseAcknowledgement
444      * @throws RemoteException
445      */
446     @Override
responseAcknowledgement()447     public void responseAcknowledgement() throws RemoteException {
448         if (isEmpty()) return;
449         if (isAidl()) {
450             mVoiceProxy.responseAcknowledgement();
451         } else {
452             mRadioProxy.responseAcknowledgement();
453         }
454     }
455 
456     /**
457      * Call IRadioVoice#sendBurstDtmf
458      * @param serial Serial number of request
459      * @param dtmf DTMF string
460      * @param on DTMF ON length in milliseconds, or 0 to use default
461      * @param off DTMF OFF length in milliseconds, or 0 to use default
462      * @throws RemoteException
463      */
sendBurstDtmf(int serial, String dtmf, int on, int off)464     public void sendBurstDtmf(int serial, String dtmf, int on, int off) throws RemoteException {
465         if (isEmpty()) return;
466         if (isAidl()) {
467             mVoiceProxy.sendBurstDtmf(serial, dtmf, on, off);
468         } else {
469             mRadioProxy.sendBurstDtmf(serial, dtmf, on, off);
470         }
471     }
472 
473     /**
474      * Call IRadioVoice#sendCdmaFeatureCode
475      * @param serial Serial number of request
476      * @param featureCode String associated with FLASH command
477      * @throws RemoteException
478      */
sendCdmaFeatureCode(int serial, String featureCode)479     public void sendCdmaFeatureCode(int serial, String featureCode) throws RemoteException {
480         if (isEmpty()) return;
481         if (isAidl()) {
482             mVoiceProxy.sendCdmaFeatureCode(serial, featureCode);
483         } else {
484             mRadioProxy.sendCDMAFeatureCode(serial, featureCode);
485         }
486     }
487 
488     /**
489      * Call IRadioVoice#sendDtmf
490      * @param serial Serial number of request
491      * @param s String with single char having one of 12 values: 0-0, *, #
492      * @throws RemoteException
493      */
sendDtmf(int serial, String s)494     public void sendDtmf(int serial, String s) throws RemoteException {
495         if (isEmpty()) return;
496         if (isAidl()) {
497             mVoiceProxy.sendDtmf(serial, s);
498         } else {
499             mRadioProxy.sendDtmf(serial, s);
500         }
501     }
502 
503     /**
504      * Call IRadioVoice#sendUssd
505      * @param serial Serial number of request
506      * @param ussd String containing the USSD request in UTF-8 format
507      * @throws RemoteException
508      */
sendUssd(int serial, String ussd)509     public void sendUssd(int serial, String ussd) throws RemoteException {
510         if (isEmpty()) return;
511         if (isAidl()) {
512             mVoiceProxy.sendUssd(serial, ussd);
513         } else {
514             mRadioProxy.sendUssd(serial, ussd);
515         }
516     }
517 
518     /**
519      * Call IRadioVoice#separateConnection
520      * @param serial Serial number of request
521      * @param gsmIndex Connection index
522      * @throws RemoteException
523      */
separateConnection(int serial, int gsmIndex)524     public void separateConnection(int serial, int gsmIndex) throws RemoteException {
525         if (isEmpty()) return;
526         if (isAidl()) {
527             mVoiceProxy.separateConnection(serial, gsmIndex);
528         } else {
529             mRadioProxy.separateConnection(serial, gsmIndex);
530         }
531     }
532 
533     /**
534      * Call IRadioVoice#setCallForward
535      * @param serial Serial number of request
536      * @param action One of CF_ACTION_*
537      * @param cfReason One of CF_REASON_*
538      * @param serviceClass Sum of SERVICE_CLASSS_*
539      * @param number Number
540      * @param timeSeconds Time in seconds
541      * @throws RemoteException
542      */
setCallForward(int serial, int action, int cfReason, int serviceClass, String number, int timeSeconds)543     public void setCallForward(int serial, int action, int cfReason, int serviceClass,
544             String number, int timeSeconds) throws RemoteException {
545         if (isEmpty()) return;
546         if (isAidl()) {
547             android.hardware.radio.voice.CallForwardInfo cfInfo =
548                     new android.hardware.radio.voice.CallForwardInfo();
549             cfInfo.status = action;
550             cfInfo.reason = cfReason;
551             cfInfo.serviceClass = serviceClass;
552             cfInfo.toa = PhoneNumberUtils.toaFromString(number);
553             cfInfo.number = RILUtils.convertNullToEmptyString(number);
554             cfInfo.timeSeconds = timeSeconds;
555             mVoiceProxy.setCallForward(serial, cfInfo);
556         } else {
557             android.hardware.radio.V1_0.CallForwardInfo cfInfo =
558                     new android.hardware.radio.V1_0.CallForwardInfo();
559             cfInfo.status = action;
560             cfInfo.reason = cfReason;
561             cfInfo.serviceClass = serviceClass;
562             cfInfo.toa = PhoneNumberUtils.toaFromString(number);
563             cfInfo.number = RILUtils.convertNullToEmptyString(number);
564             cfInfo.timeSeconds = timeSeconds;
565             mRadioProxy.setCallForward(serial, cfInfo);
566         }
567     }
568 
569     /**
570      * Call IRadioVoice#setCallWaiting
571      * @param serial Serial number of request
572      * @param enable True to enable, false to disable
573      * @param serviceClass Sum of SERVICE_CLASS_*
574      * @throws RemoteException
575      */
setCallWaiting(int serial, boolean enable, int serviceClass)576     public void setCallWaiting(int serial, boolean enable, int serviceClass)
577             throws RemoteException {
578         if (isEmpty()) return;
579         if (isAidl()) {
580             mVoiceProxy.setCallWaiting(serial, enable, serviceClass);
581         } else {
582             mRadioProxy.setCallWaiting(serial, enable, serviceClass);
583         }
584     }
585 
586     /**
587      * Call IRadioVoice#setClir
588      * @param serial Serial number of request
589      * @param status One of CLIR_*
590      * @throws RemoteException
591      */
setClir(int serial, int status)592     public void setClir(int serial, int status) throws RemoteException {
593         if (isEmpty()) return;
594         if (isAidl()) {
595             mVoiceProxy.setClir(serial, status);
596         } else {
597             mRadioProxy.setClir(serial, status);
598         }
599     }
600 
601     /**
602      * Call IRadioVoice#setMute
603      * @param serial Serial number of request
604      * @param enable True to enable, false to disable
605      * @throws RemoteException
606      */
setMute(int serial, boolean enable)607     public void setMute(int serial, boolean enable) throws RemoteException {
608         if (isEmpty()) return;
609         if (isAidl()) {
610             mVoiceProxy.setMute(serial, enable);
611         } else {
612             mRadioProxy.setMute(serial, enable);
613         }
614     }
615 
616     /**
617      * Call IRadioVoice#setPreferredVoicePrivacy
618      * @param serial Serial number of request
619      * @param enable True is enhanced, false is normal voice privacy
620      * @throws RemoteException
621      */
setPreferredVoicePrivacy(int serial, boolean enable)622     public void setPreferredVoicePrivacy(int serial, boolean enable) throws RemoteException {
623         if (isEmpty()) return;
624         if (isAidl()) {
625             mVoiceProxy.setPreferredVoicePrivacy(serial, enable);
626         } else {
627             mRadioProxy.setPreferredVoicePrivacy(serial, enable);
628         }
629     }
630 
631     /**
632      * Call IRadioVoice#setTtyMode
633      * @param serial Serial number of request
634      * @param mode One of TTY_MODE_*
635      * @throws RemoteException
636      */
setTtyMode(int serial, int mode)637     public void setTtyMode(int serial, int mode) throws RemoteException {
638         if (isEmpty()) return;
639         if (isAidl()) {
640             mVoiceProxy.setTtyMode(serial, mode);
641         } else {
642             mRadioProxy.setTTYMode(serial, mode);
643         }
644     }
645 
646     /**
647      * Call IRadioVoice#setVoNrEnabled
648      * @param serial Serial number of request
649      * @param enable True to enable, false to disable
650      * @throws RemoteException
651      */
setVoNrEnabled(int serial, boolean enable)652     public void setVoNrEnabled(int serial, boolean enable) throws RemoteException {
653         if (isEmpty()) return;
654         if (isAidl()) {
655             mVoiceProxy.setVoNrEnabled(serial, enable);
656         }
657     }
658 
659     /**
660      * Call IRadioVoice#startDtmf
661      * @param serial Serial number of request
662      * @param s String having a single character with one of 12 values: 0-9, *, #
663      * @throws RemoteException
664      */
startDtmf(int serial, String s)665     public void startDtmf(int serial, String s) throws RemoteException {
666         if (isEmpty()) return;
667         if (isAidl()) {
668             mVoiceProxy.startDtmf(serial, s);
669         } else {
670             mRadioProxy.startDtmf(serial, s);
671         }
672     }
673 
674     /**
675      * Call IRadioVoice#stopDtmf
676      * @param serial Serial number of request
677      * @throws RemoteException
678      */
stopDtmf(int serial)679     public void stopDtmf(int serial) throws RemoteException {
680         if (isEmpty()) return;
681         if (isAidl()) {
682             mVoiceProxy.stopDtmf(serial);
683         } else {
684             mRadioProxy.stopDtmf(serial);
685         }
686     }
687 
688     /**
689      * Call IRadioVoice#switchWaitingOrHoldingAndActive
690      * @param serial Serial number of request
691      * @throws RemoteException
692      */
switchWaitingOrHoldingAndActive(int serial)693     public void switchWaitingOrHoldingAndActive(int serial) throws RemoteException {
694         if (isEmpty()) return;
695         if (isAidl()) {
696             mVoiceProxy.switchWaitingOrHoldingAndActive(serial);
697         } else {
698             mRadioProxy.switchWaitingOrHoldingAndActive(serial);
699         }
700     }
701 }
702