1/*
2 * Copyright (C) 2006 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
17package com.android.internal.telephony;
18
19import com.android.internal.telephony.cdma.CdmaSmsBroadcastConfigInfo;
20import com.android.internal.telephony.gsm.SmsBroadcastConfigInfo;
21import com.android.internal.telephony.uicc.IccCardStatus;
22
23import android.os.Message;
24import android.os.Handler;
25
26/**
27 * {@hide}
28 */
29public interface CommandsInterface {
30    enum RadioState {
31        RADIO_OFF,         /* Radio explicitly powered off (eg CFUN=0) */
32        RADIO_UNAVAILABLE, /* Radio unavailable (eg, resetting or not booted) */
33        RADIO_ON;          /* Radio is on */
34
35        public boolean isOn() /* and available...*/ {
36            return this == RADIO_ON;
37        }
38
39        public boolean isAvailable() {
40            return this != RADIO_UNAVAILABLE;
41        }
42    }
43
44    //***** Constants
45
46    // Used as parameter to dial() and setCLIR() below
47    static final int CLIR_DEFAULT = 0;      // "use subscription default value"
48    static final int CLIR_INVOCATION = 1;   // (restrict CLI presentation)
49    static final int CLIR_SUPPRESSION = 2;  // (allow CLI presentation)
50
51
52    // Used as parameters for call forward methods below
53    static final int CF_ACTION_DISABLE          = 0;
54    static final int CF_ACTION_ENABLE           = 1;
55//  static final int CF_ACTION_UNUSED           = 2;
56    static final int CF_ACTION_REGISTRATION     = 3;
57    static final int CF_ACTION_ERASURE          = 4;
58
59    static final int CF_REASON_UNCONDITIONAL    = 0;
60    static final int CF_REASON_BUSY             = 1;
61    static final int CF_REASON_NO_REPLY         = 2;
62    static final int CF_REASON_NOT_REACHABLE    = 3;
63    static final int CF_REASON_ALL              = 4;
64    static final int CF_REASON_ALL_CONDITIONAL  = 5;
65
66    // Used for call barring methods below
67    static final String CB_FACILITY_BAOC         = "AO";
68    static final String CB_FACILITY_BAOIC        = "OI";
69    static final String CB_FACILITY_BAOICxH      = "OX";
70    static final String CB_FACILITY_BAIC         = "AI";
71    static final String CB_FACILITY_BAICr        = "IR";
72    static final String CB_FACILITY_BA_ALL       = "AB";
73    static final String CB_FACILITY_BA_MO        = "AG";
74    static final String CB_FACILITY_BA_MT        = "AC";
75    static final String CB_FACILITY_BA_SIM       = "SC";
76    static final String CB_FACILITY_BA_FD        = "FD";
77
78
79    // Used for various supp services apis
80    // See 27.007 +CCFC or +CLCK
81    static final int SERVICE_CLASS_NONE     = 0; // no user input
82    static final int SERVICE_CLASS_VOICE    = (1 << 0);
83    static final int SERVICE_CLASS_DATA     = (1 << 1); //synonym for 16+32+64+128
84    static final int SERVICE_CLASS_FAX      = (1 << 2);
85    static final int SERVICE_CLASS_SMS      = (1 << 3);
86    static final int SERVICE_CLASS_DATA_SYNC = (1 << 4);
87    static final int SERVICE_CLASS_DATA_ASYNC = (1 << 5);
88    static final int SERVICE_CLASS_PACKET   = (1 << 6);
89    static final int SERVICE_CLASS_PAD      = (1 << 7);
90    static final int SERVICE_CLASS_MAX      = (1 << 7); // Max SERVICE_CLASS value
91
92    // Numeric representation of string values returned
93    // by messages sent to setOnUSSD handler
94    static final int USSD_MODE_NOTIFY       = 0;
95    static final int USSD_MODE_REQUEST      = 1;
96
97    // GSM SMS fail cause for acknowledgeLastIncomingSMS. From TS 23.040, 9.2.3.22.
98    static final int GSM_SMS_FAIL_CAUSE_MEMORY_CAPACITY_EXCEEDED    = 0xD3;
99    static final int GSM_SMS_FAIL_CAUSE_USIM_APP_TOOLKIT_BUSY       = 0xD4;
100    static final int GSM_SMS_FAIL_CAUSE_USIM_DATA_DOWNLOAD_ERROR    = 0xD5;
101    static final int GSM_SMS_FAIL_CAUSE_UNSPECIFIED_ERROR           = 0xFF;
102
103    // CDMA SMS fail cause for acknowledgeLastIncomingCdmaSms.  From TS N.S0005, 6.5.2.125.
104    static final int CDMA_SMS_FAIL_CAUSE_INVALID_TELESERVICE_ID     = 4;
105    static final int CDMA_SMS_FAIL_CAUSE_RESOURCE_SHORTAGE          = 35;
106    static final int CDMA_SMS_FAIL_CAUSE_OTHER_TERMINAL_PROBLEM     = 39;
107    static final int CDMA_SMS_FAIL_CAUSE_ENCODING_PROBLEM           = 96;
108
109    //***** Methods
110    RadioState getRadioState();
111
112    /**
113     * response.obj.result is an int[2]
114     *
115     * response.obj.result[0] is IMS registration state
116     *                        0 - Not registered
117     *                        1 - Registered
118     * response.obj.result[1] is of type RILConstants.GSM_PHONE or
119     *                                    RILConstants.CDMA_PHONE
120     */
121    void getImsRegistrationState(Message result);
122
123    /**
124     * Fires on any RadioState transition
125     * Always fires immediately as well
126     *
127     * do not attempt to calculate transitions by storing getRadioState() values
128     * on previous invocations of this notification. Instead, use the other
129     * registration methods
130     */
131    void registerForRadioStateChanged(Handler h, int what, Object obj);
132    void unregisterForRadioStateChanged(Handler h);
133
134    void registerForVoiceRadioTechChanged(Handler h, int what, Object obj);
135    void unregisterForVoiceRadioTechChanged(Handler h);
136    void registerForImsNetworkStateChanged(Handler h, int what, Object obj);
137    void unregisterForImsNetworkStateChanged(Handler h);
138
139    /**
140     * Fires on any transition into RadioState.isOn()
141     * Fires immediately if currently in that state
142     * In general, actions should be idempotent. State may change
143     * before event is received.
144     */
145    void registerForOn(Handler h, int what, Object obj);
146    void unregisterForOn(Handler h);
147
148    /**
149     * Fires on any transition out of RadioState.isAvailable()
150     * Fires immediately if currently in that state
151     * In general, actions should be idempotent. State may change
152     * before event is received.
153     */
154    void registerForAvailable(Handler h, int what, Object obj);
155    void unregisterForAvailable(Handler h);
156
157    /**
158     * Fires on any transition into !RadioState.isAvailable()
159     * Fires immediately if currently in that state
160     * In general, actions should be idempotent. State may change
161     * before event is received.
162     */
163    void registerForNotAvailable(Handler h, int what, Object obj);
164    void unregisterForNotAvailable(Handler h);
165
166    /**
167     * Fires on any transition into RADIO_OFF or !RadioState.isAvailable()
168     * Fires immediately if currently in that state
169     * In general, actions should be idempotent. State may change
170     * before event is received.
171     */
172    void registerForOffOrNotAvailable(Handler h, int what, Object obj);
173    void unregisterForOffOrNotAvailable(Handler h);
174
175    /**
176     * Fires on any change in ICC status
177     */
178    void registerForIccStatusChanged(Handler h, int what, Object obj);
179    void unregisterForIccStatusChanged(Handler h);
180
181    void registerForCallStateChanged(Handler h, int what, Object obj);
182    void unregisterForCallStateChanged(Handler h);
183    void registerForVoiceNetworkStateChanged(Handler h, int what, Object obj);
184    void unregisterForVoiceNetworkStateChanged(Handler h);
185    void registerForDataNetworkStateChanged(Handler h, int what, Object obj);
186    void unregisterForDataNetworkStateChanged(Handler h);
187
188    /** InCall voice privacy notifications */
189    void registerForInCallVoicePrivacyOn(Handler h, int what, Object obj);
190    void unregisterForInCallVoicePrivacyOn(Handler h);
191    void registerForInCallVoicePrivacyOff(Handler h, int what, Object obj);
192    void unregisterForInCallVoicePrivacyOff(Handler h);
193
194    /**
195     * unlike the register* methods, there's only one new 3GPP format SMS handler.
196     * if you need to unregister, you should also tell the radio to stop
197     * sending SMS's to you (via AT+CNMI)
198     *
199     * AsyncResult.result is a String containing the SMS PDU
200     */
201    void setOnNewGsmSms(Handler h, int what, Object obj);
202    void unSetOnNewGsmSms(Handler h);
203
204    /**
205     * unlike the register* methods, there's only one new 3GPP2 format SMS handler.
206     * if you need to unregister, you should also tell the radio to stop
207     * sending SMS's to you (via AT+CNMI)
208     *
209     * AsyncResult.result is a String containing the SMS PDU
210     */
211    void setOnNewCdmaSms(Handler h, int what, Object obj);
212    void unSetOnNewCdmaSms(Handler h);
213
214    /**
215     * Set the handler for SMS Cell Broadcast messages.
216     *
217     * AsyncResult.result is a byte array containing the SMS-CB PDU
218     */
219    void setOnNewGsmBroadcastSms(Handler h, int what, Object obj);
220    void unSetOnNewGsmBroadcastSms(Handler h);
221
222    /**
223     * Register for NEW_SMS_ON_SIM unsolicited message
224     *
225     * AsyncResult.result is an int array containing the index of new SMS
226     */
227    void setOnSmsOnSim(Handler h, int what, Object obj);
228    void unSetOnSmsOnSim(Handler h);
229
230    /**
231     * Register for NEW_SMS_STATUS_REPORT unsolicited message
232     *
233     * AsyncResult.result is a String containing the status report PDU
234     */
235    void setOnSmsStatus(Handler h, int what, Object obj);
236    void unSetOnSmsStatus(Handler h);
237
238    /**
239     * unlike the register* methods, there's only one NITZ time handler
240     *
241     * AsyncResult.result is an Object[]
242     * ((Object[])AsyncResult.result)[0] is a String containing the NITZ time string
243     * ((Object[])AsyncResult.result)[1] is a Long containing the milliseconds since boot as
244     *                                   returned by elapsedRealtime() when this NITZ time
245     *                                   was posted.
246     *
247     * Please note that the delivery of this message may be delayed several
248     * seconds on system startup
249     */
250    void setOnNITZTime(Handler h, int what, Object obj);
251    void unSetOnNITZTime(Handler h);
252
253    /**
254     * unlike the register* methods, there's only one USSD notify handler
255     *
256     * Represents the arrival of a USSD "notify" message, which may
257     * or may not have been triggered by a previous USSD send
258     *
259     * AsyncResult.result is a String[]
260     * ((String[])(AsyncResult.result))[0] contains status code
261     *      "0"   USSD-Notify -- text in ((const char **)data)[1]
262     *      "1"   USSD-Request -- text in ((const char **)data)[1]
263     *      "2"   Session terminated by network
264     *      "3"   other local client (eg, SIM Toolkit) has responded
265     *      "4"   Operation not supported
266     *      "5"   Network timeout
267     *
268     * ((String[])(AsyncResult.result))[1] contains the USSD message
269     * The numeric representations of these are in USSD_MODE_*
270     */
271
272    void setOnUSSD(Handler h, int what, Object obj);
273    void unSetOnUSSD(Handler h);
274
275    /**
276     * unlike the register* methods, there's only one signal strength handler
277     * AsyncResult.result is an int[2]
278     * response.obj.result[0] is received signal strength (0-31, 99)
279     * response.obj.result[1] is  bit error rate (0-7, 99)
280     * as defined in TS 27.007 8.5
281     */
282
283    void setOnSignalStrengthUpdate(Handler h, int what, Object obj);
284    void unSetOnSignalStrengthUpdate(Handler h);
285
286    /**
287     * Sets the handler for SIM/RUIM SMS storage full unsolicited message.
288     * Unlike the register* methods, there's only one notification handler
289     *
290     * @param h Handler for notification message.
291     * @param what User-defined message code.
292     * @param obj User object.
293     */
294    void setOnIccSmsFull(Handler h, int what, Object obj);
295    void unSetOnIccSmsFull(Handler h);
296
297    /**
298     * Sets the handler for SIM Refresh notifications.
299     *
300     * @param h Handler for notification message.
301     * @param what User-defined message code.
302     * @param obj User object.
303     */
304    void registerForIccRefresh(Handler h, int what, Object obj);
305    void unregisterForIccRefresh(Handler h);
306
307    void setOnIccRefresh(Handler h, int what, Object obj);
308    void unsetOnIccRefresh(Handler h);
309
310    /**
311     * Sets the handler for RING notifications.
312     * Unlike the register* methods, there's only one notification handler
313     *
314     * @param h Handler for notification message.
315     * @param what User-defined message code.
316     * @param obj User object.
317     */
318    void setOnCallRing(Handler h, int what, Object obj);
319    void unSetOnCallRing(Handler h);
320
321    /**
322     * Sets the handler for RESTRICTED_STATE changed notification,
323     * eg, for Domain Specific Access Control
324     * unlike the register* methods, there's only one signal strength handler
325     *
326     * AsyncResult.result is an int[1]
327     * response.obj.result[0] is a bitmask of RIL_RESTRICTED_STATE_* values
328     */
329
330    void setOnRestrictedStateChanged(Handler h, int what, Object obj);
331    void unSetOnRestrictedStateChanged(Handler h);
332
333    /**
334     * Sets the handler for Supplementary Service Notifications.
335     * Unlike the register* methods, there's only one notification handler
336     *
337     * @param h Handler for notification message.
338     * @param what User-defined message code.
339     * @param obj User object.
340     */
341    void setOnSuppServiceNotification(Handler h, int what, Object obj);
342    void unSetOnSuppServiceNotification(Handler h);
343
344    /**
345     * Sets the handler for Session End Notifications for CAT.
346     * Unlike the register* methods, there's only one notification handler
347     *
348     * @param h Handler for notification message.
349     * @param what User-defined message code.
350     * @param obj User object.
351     */
352    void setOnCatSessionEnd(Handler h, int what, Object obj);
353    void unSetOnCatSessionEnd(Handler h);
354
355    /**
356     * Sets the handler for Proactive Commands for CAT.
357     * Unlike the register* methods, there's only one notification handler
358     *
359     * @param h Handler for notification message.
360     * @param what User-defined message code.
361     * @param obj User object.
362     */
363    void setOnCatProactiveCmd(Handler h, int what, Object obj);
364    void unSetOnCatProactiveCmd(Handler h);
365
366    /**
367     * Sets the handler for Event Notifications for CAT.
368     * Unlike the register* methods, there's only one notification handler
369     *
370     * @param h Handler for notification message.
371     * @param what User-defined message code.
372     * @param obj User object.
373     */
374    void setOnCatEvent(Handler h, int what, Object obj);
375    void unSetOnCatEvent(Handler h);
376
377    /**
378     * Sets the handler for Call Set Up Notifications for CAT.
379     * Unlike the register* methods, there's only one notification handler
380     *
381     * @param h Handler for notification message.
382     * @param what User-defined message code.
383     * @param obj User object.
384     */
385    void setOnCatCallSetUp(Handler h, int what, Object obj);
386    void unSetOnCatCallSetUp(Handler h);
387
388    /**
389     * Enables/disbables supplementary service related notifications from
390     * the network.
391     *
392     * @param enable true to enable notifications, false to disable.
393     * @param result Message to be posted when command completes.
394     */
395    void setSuppServiceNotifications(boolean enable, Message result);
396    //void unSetSuppServiceNotifications(Handler h);
397
398    /**
399     * Sets the handler for Event Notifications for CDMA Display Info.
400     * Unlike the register* methods, there's only one notification handler
401     *
402     * @param h Handler for notification message.
403     * @param what User-defined message code.
404     * @param obj User object.
405     */
406    void registerForDisplayInfo(Handler h, int what, Object obj);
407    void unregisterForDisplayInfo(Handler h);
408
409    /**
410     * Sets the handler for Event Notifications for CallWaiting Info.
411     * Unlike the register* methods, there's only one notification handler
412     *
413     * @param h Handler for notification message.
414     * @param what User-defined message code.
415     * @param obj User object.
416     */
417    void registerForCallWaitingInfo(Handler h, int what, Object obj);
418    void unregisterForCallWaitingInfo(Handler h);
419
420    /**
421     * Sets the handler for Event Notifications for Signal Info.
422     * Unlike the register* methods, there's only one notification handler
423     *
424     * @param h Handler for notification message.
425     * @param what User-defined message code.
426     * @param obj User object.
427     */
428    void registerForSignalInfo(Handler h, int what, Object obj);
429    void unregisterForSignalInfo(Handler h);
430
431    /**
432     * Registers the handler for CDMA number information record
433     * Unlike the register* methods, there's only one notification handler
434     *
435     * @param h Handler for notification message.
436     * @param what User-defined message code.
437     * @param obj User object.
438     */
439    void registerForNumberInfo(Handler h, int what, Object obj);
440    void unregisterForNumberInfo(Handler h);
441
442    /**
443     * Registers the handler for CDMA redirected number Information record
444     * Unlike the register* methods, there's only one notification handler
445     *
446     * @param h Handler for notification message.
447     * @param what User-defined message code.
448     * @param obj User object.
449     */
450    void registerForRedirectedNumberInfo(Handler h, int what, Object obj);
451    void unregisterForRedirectedNumberInfo(Handler h);
452
453    /**
454     * Registers the handler for CDMA line control information record
455     * Unlike the register* methods, there's only one notification handler
456     *
457     * @param h Handler for notification message.
458     * @param what User-defined message code.
459     * @param obj User object.
460     */
461    void registerForLineControlInfo(Handler h, int what, Object obj);
462    void unregisterForLineControlInfo(Handler h);
463
464    /**
465     * Registers the handler for CDMA T53 CLIR information record
466     * Unlike the register* methods, there's only one notification handler
467     *
468     * @param h Handler for notification message.
469     * @param what User-defined message code.
470     * @param obj User object.
471     */
472    void registerFoT53ClirlInfo(Handler h, int what, Object obj);
473    void unregisterForT53ClirInfo(Handler h);
474
475    /**
476     * Registers the handler for CDMA T53 audio control information record
477     * Unlike the register* methods, there's only one notification handler
478     *
479     * @param h Handler for notification message.
480     * @param what User-defined message code.
481     * @param obj User object.
482     */
483    void registerForT53AudioControlInfo(Handler h, int what, Object obj);
484    void unregisterForT53AudioControlInfo(Handler h);
485
486    /**
487     * Fires on if Modem enters Emergency Callback mode
488     */
489    void setEmergencyCallbackMode(Handler h, int what, Object obj);
490
491     /**
492      * Fires on any CDMA OTA provision status change
493      */
494     void registerForCdmaOtaProvision(Handler h,int what, Object obj);
495     void unregisterForCdmaOtaProvision(Handler h);
496
497     /**
498      * Registers the handler when out-band ringback tone is needed.<p>
499      *
500      *  Messages received from this:
501      *  Message.obj will be an AsyncResult
502      *  AsyncResult.userObj = obj
503      *  AsyncResult.result = boolean. <p>
504      */
505     void registerForRingbackTone(Handler h, int what, Object obj);
506     void unregisterForRingbackTone(Handler h);
507
508     /**
509      * Registers the handler when mute/unmute need to be resent to get
510      * uplink audio during a call.<p>
511      *
512      * @param h Handler for notification message.
513      * @param what User-defined message code.
514      * @param obj User object.
515      *
516      */
517     void registerForResendIncallMute(Handler h, int what, Object obj);
518     void unregisterForResendIncallMute(Handler h);
519
520     /**
521      * Registers the handler for when Cdma subscription changed events
522      *
523      * @param h Handler for notification message.
524      * @param what User-defined message code.
525      * @param obj User object.
526      *
527      */
528     void registerForCdmaSubscriptionChanged(Handler h, int what, Object obj);
529     void unregisterForCdmaSubscriptionChanged(Handler h);
530
531     /**
532      * Registers the handler for when Cdma prl changed events
533      *
534      * @param h Handler for notification message.
535      * @param what User-defined message code.
536      * @param obj User object.
537      *
538      */
539     void registerForCdmaPrlChanged(Handler h, int what, Object obj);
540     void unregisterForCdmaPrlChanged(Handler h);
541
542     /**
543      * Registers the handler for when Cdma prl changed events
544      *
545      * @param h Handler for notification message.
546      * @param what User-defined message code.
547      * @param obj User object.
548      *
549      */
550     void registerForExitEmergencyCallbackMode(Handler h, int what, Object obj);
551     void unregisterForExitEmergencyCallbackMode(Handler h);
552
553     /**
554      * Registers the handler for RIL_UNSOL_RIL_CONNECT events.
555      *
556      * When ril connects or disconnects a message is sent to the registrant
557      * which contains an AsyncResult, ar, in msg.obj. The ar.result is an
558      * Integer which is the version of the ril or -1 if the ril disconnected.
559      *
560      * @param h Handler for notification message.
561      * @param what User-defined message code.
562      * @param obj User object.
563      */
564     void registerForRilConnected(Handler h, int what, Object obj);
565     void unregisterForRilConnected(Handler h);
566
567    /**
568     * Supply the ICC PIN to the ICC card
569     *
570     *  returned message
571     *  retMsg.obj = AsyncResult ar
572     *  ar.exception carries exception on failure
573     *  This exception is CommandException with an error of PASSWORD_INCORRECT
574     *  if the password is incorrect
575     *
576     *  ar.result is an optional array of integers where the first entry
577     *  is the number of attempts remaining before the ICC will be PUK locked.
578     *
579     * ar.exception and ar.result are null on success
580     */
581
582    void supplyIccPin(String pin, Message result);
583
584    /**
585     * Supply the PIN for the app with this AID on the ICC card
586     *
587     *  AID (Application ID), See ETSI 102.221 8.1 and 101.220 4
588     *
589     *  returned message
590     *  retMsg.obj = AsyncResult ar
591     *  ar.exception carries exception on failure
592     *  This exception is CommandException with an error of PASSWORD_INCORRECT
593     *  if the password is incorrect
594     *
595     *  ar.result is an optional array of integers where the first entry
596     *  is the number of attempts remaining before the ICC will be PUK locked.
597     *
598     * ar.exception and ar.result are null on success
599     */
600
601    void supplyIccPinForApp(String pin, String aid, Message result);
602
603    /**
604     * Supply the ICC PUK and newPin to the ICC card
605     *
606     *  returned message
607     *  retMsg.obj = AsyncResult ar
608     *  ar.exception carries exception on failure
609     *  This exception is CommandException with an error of PASSWORD_INCORRECT
610     *  if the password is incorrect
611     *
612     *  ar.result is an optional array of integers where the first entry
613     *  is the number of attempts remaining before the ICC is permanently disabled.
614     *
615     * ar.exception and ar.result are null on success
616     */
617
618    void supplyIccPuk(String puk, String newPin, Message result);
619
620    /**
621     * Supply the PUK, new pin for the app with this AID on the ICC card
622     *
623     *  AID (Application ID), See ETSI 102.221 8.1 and 101.220 4
624     *
625     *  retMsg.obj = AsyncResult ar
626     *  ar.exception carries exception on failure
627     *  This exception is CommandException with an error of PASSWORD_INCORRECT
628     *  if the password is incorrect
629     *
630     *  ar.result is an optional array of integers where the first entry
631     *  is the number of attempts remaining before the ICC is permanently disabled.
632     *
633     * ar.exception and ar.result are null on success
634     */
635
636    void supplyIccPukForApp(String puk, String newPin, String aid, Message result);
637
638    /**
639     * Supply the ICC PIN2 to the ICC card
640     * Only called following operation where ICC_PIN2 was
641     * returned as a a failure from a previous operation
642     *
643     *  returned message
644     *  retMsg.obj = AsyncResult ar
645     *  ar.exception carries exception on failure
646     *  This exception is CommandException with an error of PASSWORD_INCORRECT
647     *  if the password is incorrect
648     *
649     *  ar.result is an optional array of integers where the first entry
650     *  is the number of attempts remaining before the ICC will be PUK locked.
651     *
652     * ar.exception and ar.result are null on success
653     */
654
655    void supplyIccPin2(String pin2, Message result);
656
657    /**
658     * Supply the PIN2 for the app with this AID on the ICC card
659     * Only called following operation where ICC_PIN2 was
660     * returned as a a failure from a previous operation
661     *
662     *  AID (Application ID), See ETSI 102.221 8.1 and 101.220 4
663     *
664     *  returned message
665     *  retMsg.obj = AsyncResult ar
666     *  ar.exception carries exception on failure
667     *  This exception is CommandException with an error of PASSWORD_INCORRECT
668     *  if the password is incorrect
669     *
670     *  ar.result is an optional array of integers where the first entry
671     *  is the number of attempts remaining before the ICC will be PUK locked.
672     *
673     * ar.exception and ar.result are null on success
674     */
675
676    void supplyIccPin2ForApp(String pin2, String aid, Message result);
677
678    /**
679     * Supply the SIM PUK2 to the SIM card
680     * Only called following operation where SIM_PUK2 was
681     * returned as a a failure from a previous operation
682     *
683     *  returned message
684     *  retMsg.obj = AsyncResult ar
685     *  ar.exception carries exception on failure
686     *  This exception is CommandException with an error of PASSWORD_INCORRECT
687     *  if the password is incorrect
688     *
689     *  ar.result is an optional array of integers where the first entry
690     *  is the number of attempts remaining before the ICC is permanently disabled.
691     *
692     * ar.exception and ar.result are null on success
693     */
694
695    void supplyIccPuk2(String puk2, String newPin2, Message result);
696
697    /**
698     * Supply the PUK2, newPin2 for the app with this AID on the ICC card
699     * Only called following operation where SIM_PUK2 was
700     * returned as a a failure from a previous operation
701     *
702     *  AID (Application ID), See ETSI 102.221 8.1 and 101.220 4
703     *
704     *  returned message
705     *  retMsg.obj = AsyncResult ar
706     *  ar.exception carries exception on failure
707     *  This exception is CommandException with an error of PASSWORD_INCORRECT
708     *  if the password is incorrect
709     *
710     *  ar.result is an optional array of integers where the first entry
711     *  is the number of attempts remaining before the ICC is permanently disabled.
712     *
713     * ar.exception and ar.result are null on success
714     */
715
716    void supplyIccPuk2ForApp(String puk2, String newPin2, String aid, Message result);
717
718    // TODO: Add java doc and indicate that msg.arg1 contains the number of attempts remaining.
719    void changeIccPin(String oldPin, String newPin, Message result);
720    void changeIccPinForApp(String oldPin, String newPin, String aidPtr, Message result);
721    void changeIccPin2(String oldPin2, String newPin2, Message result);
722    void changeIccPin2ForApp(String oldPin2, String newPin2, String aidPtr, Message result);
723
724    void changeBarringPassword(String facility, String oldPwd, String newPwd, Message result);
725
726    void supplyNetworkDepersonalization(String netpin, Message result);
727
728    /**
729     *  returned message
730     *  retMsg.obj = AsyncResult ar
731     *  ar.exception carries exception on failure
732     *  ar.userObject contains the orignal value of result.obj
733     *  ar.result contains a List of DriverCall
734     *      The ar.result List is sorted by DriverCall.index
735     */
736    void getCurrentCalls (Message result);
737
738    /**
739     *  returned message
740     *  retMsg.obj = AsyncResult ar
741     *  ar.exception carries exception on failure
742     *  ar.userObject contains the orignal value of result.obj
743     *  ar.result contains a List of DataCallResponse
744     *  @deprecated Do not use.
745     */
746    @Deprecated
747    void getPDPContextList(Message result);
748
749    /**
750     *  returned message
751     *  retMsg.obj = AsyncResult ar
752     *  ar.exception carries exception on failure
753     *  ar.userObject contains the orignal value of result.obj
754     *  ar.result contains a List of DataCallResponse
755     */
756    void getDataCallList(Message result);
757
758    /**
759     *  returned message
760     *  retMsg.obj = AsyncResult ar
761     *  ar.exception carries exception on failure
762     *  ar.userObject contains the orignal value of result.obj
763     *  ar.result is null on success and failure
764     *
765     * CLIR_DEFAULT     == on "use subscription default value"
766     * CLIR_SUPPRESSION == on "CLIR suppression" (allow CLI presentation)
767     * CLIR_INVOCATION  == on "CLIR invocation" (restrict CLI presentation)
768     */
769    void dial (String address, int clirMode, Message result);
770
771    /**
772     *  returned message
773     *  retMsg.obj = AsyncResult ar
774     *  ar.exception carries exception on failure
775     *  ar.userObject contains the orignal value of result.obj
776     *  ar.result is null on success and failure
777     *
778     * CLIR_DEFAULT     == on "use subscription default value"
779     * CLIR_SUPPRESSION == on "CLIR suppression" (allow CLI presentation)
780     * CLIR_INVOCATION  == on "CLIR invocation" (restrict CLI presentation)
781     */
782    void dial(String address, int clirMode, UUSInfo uusInfo, Message result);
783
784    /**
785     *  returned message
786     *  retMsg.obj = AsyncResult ar
787     *  ar.exception carries exception on failure
788     *  ar.userObject contains the orignal value of result.obj
789     *  ar.result is String containing IMSI on success
790     */
791    void getIMSI(Message result);
792
793    /**
794     *  returned message
795     *  retMsg.obj = AsyncResult ar
796     *  ar.exception carries exception on failure
797     *  ar.userObject contains the orignal value of result.obj
798     *  ar.result is String containing IMSI on success
799     */
800    void getIMSIForApp(String aid, Message result);
801
802    /**
803     *  returned message
804     *  retMsg.obj = AsyncResult ar
805     *  ar.exception carries exception on failure
806     *  ar.userObject contains the orignal value of result.obj
807     *  ar.result is String containing IMEI on success
808     */
809    void getIMEI(Message result);
810
811    /**
812     *  returned message
813     *  retMsg.obj = AsyncResult ar
814     *  ar.exception carries exception on failure
815     *  ar.userObject contains the orignal value of result.obj
816     *  ar.result is String containing IMEISV on success
817     */
818    void getIMEISV(Message result);
819
820    /**
821     * Hang up one individual connection.
822     *  returned message
823     *  retMsg.obj = AsyncResult ar
824     *  ar.exception carries exception on failure
825     *  ar.userObject contains the orignal value of result.obj
826     *  ar.result is null on success and failure
827     *
828     *  3GPP 22.030 6.5.5
829     *  "Releases a specific active call X"
830     */
831    void hangupConnection (int gsmIndex, Message result);
832
833    /**
834     * 3GPP 22.030 6.5.5
835     *  "Releases all held calls or sets User Determined User Busy (UDUB)
836     *   for a waiting call."
837     *  ar.exception carries exception on failure
838     *  ar.userObject contains the orignal value of result.obj
839     *  ar.result is null on success and failure
840     */
841    void hangupWaitingOrBackground (Message result);
842
843    /**
844     * 3GPP 22.030 6.5.5
845     * "Releases all active calls (if any exist) and accepts
846     *  the other (held or waiting) call."
847     *
848     *  ar.exception carries exception on failure
849     *  ar.userObject contains the orignal value of result.obj
850     *  ar.result is null on success and failure
851     */
852    void hangupForegroundResumeBackground (Message result);
853
854    /**
855     * 3GPP 22.030 6.5.5
856     * "Places all active calls (if any exist) on hold and accepts
857     *  the other (held or waiting) call."
858     *
859     *  ar.exception carries exception on failure
860     *  ar.userObject contains the orignal value of result.obj
861     *  ar.result is null on success and failure
862     */
863    void switchWaitingOrHoldingAndActive (Message result);
864
865    /**
866     * 3GPP 22.030 6.5.5
867     * "Adds a held call to the conversation"
868     *
869     *  ar.exception carries exception on failure
870     *  ar.userObject contains the orignal value of result.obj
871     *  ar.result is null on success and failure
872     */
873    void conference (Message result);
874
875    /**
876     * Set preferred Voice Privacy (VP).
877     *
878     * @param enable true is enhanced and false is normal VP
879     * @param result is a callback message
880     */
881    void setPreferredVoicePrivacy(boolean enable, Message result);
882
883    /**
884     * Get currently set preferred Voice Privacy (VP) mode.
885     *
886     * @param result is a callback message
887     */
888    void getPreferredVoicePrivacy(Message result);
889
890    /**
891     * 3GPP 22.030 6.5.5
892     * "Places all active calls on hold except call X with which
893     *  communication shall be supported."
894     */
895    void separateConnection (int gsmIndex, Message result);
896
897    /**
898     *
899     *  ar.exception carries exception on failure
900     *  ar.userObject contains the orignal value of result.obj
901     *  ar.result is null on success and failure
902     */
903    void acceptCall (Message result);
904
905    /**
906     *  also known as UDUB
907     *  ar.exception carries exception on failure
908     *  ar.userObject contains the orignal value of result.obj
909     *  ar.result is null on success and failure
910     */
911    void rejectCall (Message result);
912
913    /**
914     * 3GPP 22.030 6.5.5
915     * "Connects the two calls and disconnects the subscriber from both calls"
916     *
917     *  ar.exception carries exception on failure
918     *  ar.userObject contains the orignal value of result.obj
919     *  ar.result is null on success and failure
920     */
921    void explicitCallTransfer (Message result);
922
923    /**
924     * cause code returned as int[0] in Message.obj.response
925     * Returns integer cause code defined in TS 24.008
926     * Annex H or closest approximation.
927     * Most significant codes:
928     * - Any defined in 22.001 F.4 (for generating busy/congestion)
929     * - Cause 68: ACM >= ACMMax
930     */
931    void getLastCallFailCause (Message result);
932
933
934    /**
935     * Reason for last PDP context deactivate or failure to activate
936     * cause code returned as int[0] in Message.obj.response
937     * returns an integer cause code defined in TS 24.008
938     * section 6.1.3.1.3 or close approximation
939     * @deprecated Do not use.
940     */
941    @Deprecated
942    void getLastPdpFailCause (Message result);
943
944    /**
945     * The preferred new alternative to getLastPdpFailCause
946     * that is also CDMA-compatible.
947     */
948    void getLastDataCallFailCause (Message result);
949
950    void setMute (boolean enableMute, Message response);
951
952    void getMute (Message response);
953
954    /**
955     * response.obj is an AsyncResult
956     * response.obj.result is an int[2]
957     * response.obj.result[0] is received signal strength (0-31, 99)
958     * response.obj.result[1] is  bit error rate (0-7, 99)
959     * as defined in TS 27.007 8.5
960     */
961    void getSignalStrength (Message response);
962
963
964    /**
965     * response.obj.result is an int[3]
966     * response.obj.result[0] is registration state 0-5 from TS 27.007 7.2
967     * response.obj.result[1] is LAC if registered or -1 if not
968     * response.obj.result[2] is CID if registered or -1 if not
969     * valid LAC and CIDs are 0x0000 - 0xffff
970     *
971     * Please note that registration state 4 ("unknown") is treated
972     * as "out of service" above
973     */
974    void getVoiceRegistrationState (Message response);
975
976    /**
977     * response.obj.result is an int[3]
978     * response.obj.result[0] is registration state 0-5 from TS 27.007 7.2
979     * response.obj.result[1] is LAC if registered or -1 if not
980     * response.obj.result[2] is CID if registered or -1 if not
981     * valid LAC and CIDs are 0x0000 - 0xffff
982     *
983     * Please note that registration state 4 ("unknown") is treated
984     * as "out of service" above
985     */
986    void getDataRegistrationState (Message response);
987
988    /**
989     * response.obj.result is a String[3]
990     * response.obj.result[0] is long alpha or null if unregistered
991     * response.obj.result[1] is short alpha or null if unregistered
992     * response.obj.result[2] is numeric or null if unregistered
993     */
994    void getOperator(Message response);
995
996    /**
997     *  ar.exception carries exception on failure
998     *  ar.userObject contains the orignal value of result.obj
999     *  ar.result is null on success and failure
1000     */
1001    void sendDtmf(char c, Message result);
1002
1003
1004    /**
1005     *  ar.exception carries exception on failure
1006     *  ar.userObject contains the orignal value of result.obj
1007     *  ar.result is null on success and failure
1008     */
1009    void startDtmf(char c, Message result);
1010
1011    /**
1012     *  ar.exception carries exception on failure
1013     *  ar.userObject contains the orignal value of result.obj
1014     *  ar.result is null on success and failure
1015     */
1016    void stopDtmf(Message result);
1017
1018    /**
1019     *  ar.exception carries exception on failure
1020     *  ar.userObject contains the orignal value of result.obj
1021     *  ar.result is null on success and failure
1022     */
1023    void sendBurstDtmf(String dtmfString, int on, int off, Message result);
1024
1025    /**
1026     * smscPDU is smsc address in PDU form GSM BCD format prefixed
1027     *      by a length byte (as expected by TS 27.005) or NULL for default SMSC
1028     * pdu is SMS in PDU format as an ASCII hex string
1029     *      less the SMSC address
1030     */
1031    void sendSMS (String smscPDU, String pdu, Message response);
1032
1033    /**
1034     * @param pdu is CDMA-SMS in internal pseudo-PDU format
1035     * @param response sent when operation completes
1036     */
1037    void sendCdmaSms(byte[] pdu, Message response);
1038
1039    /**
1040     * send SMS over IMS with 3GPP/GSM SMS format
1041     * @param smscPDU is smsc address in PDU form GSM BCD format prefixed
1042     *      by a length byte (as expected by TS 27.005) or NULL for default SMSC
1043     * @param pdu is SMS in PDU format as an ASCII hex string
1044     *      less the SMSC address
1045     * @param retry indicates if this is a retry; 0 == not retry, nonzero = retry
1046     * @param messageRef valid field if retry is set to nonzero.
1047     *        Contains messageRef from RIL_SMS_Response corresponding to failed MO SMS
1048     * @param response sent when operation completes
1049     */
1050    void sendImsGsmSms (String smscPDU, String pdu, int retry, int messageRef,
1051            Message response);
1052
1053    /**
1054     * send SMS over IMS with 3GPP2/CDMA SMS format
1055     * @param pdu is CDMA-SMS in internal pseudo-PDU format
1056     * @param response sent when operation completes
1057     * @param retry indicates if this is a retry; 0 == not retry, nonzero = retry
1058     * @param messageRef valid field if retry is set to nonzero.
1059     *        Contains messageRef from RIL_SMS_Response corresponding to failed MO SMS
1060     * @param response sent when operation completes
1061     */
1062    void sendImsCdmaSms(byte[] pdu, int retry, int messageRef, Message response);
1063
1064    /**
1065     * Deletes the specified SMS record from SIM memory (EF_SMS).
1066     *
1067     * @param index index of the SMS record to delete
1068     * @param response sent when operation completes
1069     */
1070    void deleteSmsOnSim(int index, Message response);
1071
1072    /**
1073     * Deletes the specified SMS record from RUIM memory (EF_SMS in DF_CDMA).
1074     *
1075     * @param index index of the SMS record to delete
1076     * @param response sent when operation completes
1077     */
1078    void deleteSmsOnRuim(int index, Message response);
1079
1080    /**
1081     * Writes an SMS message to SIM memory (EF_SMS).
1082     *
1083     * @param status status of message on SIM.  One of:
1084     *                  SmsManger.STATUS_ON_ICC_READ
1085     *                  SmsManger.STATUS_ON_ICC_UNREAD
1086     *                  SmsManger.STATUS_ON_ICC_SENT
1087     *                  SmsManger.STATUS_ON_ICC_UNSENT
1088     * @param pdu message PDU, as hex string
1089     * @param response sent when operation completes.
1090     *                  response.obj will be an AsyncResult, and will indicate
1091     *                  any error that may have occurred (eg, out of memory).
1092     */
1093    void writeSmsToSim(int status, String smsc, String pdu, Message response);
1094
1095    void writeSmsToRuim(int status, String pdu, Message response);
1096
1097    void setRadioPower(boolean on, Message response);
1098
1099    void acknowledgeLastIncomingGsmSms(boolean success, int cause, Message response);
1100
1101    void acknowledgeLastIncomingCdmaSms(boolean success, int cause, Message response);
1102
1103    /**
1104     * Acknowledge successful or failed receipt of last incoming SMS,
1105     * including acknowledgement TPDU to send as the RP-User-Data element
1106     * of the RP-ACK or RP-ERROR PDU.
1107     *
1108     * @param success true to send RP-ACK, false to send RP-ERROR
1109     * @param ackPdu the acknowledgement TPDU in hexadecimal format
1110     * @param response sent when operation completes.
1111     */
1112    void acknowledgeIncomingGsmSmsWithPdu(boolean success, String ackPdu, Message response);
1113
1114    /**
1115     * parameters equivalent to 27.007 AT+CRSM command
1116     * response.obj will be an AsyncResult
1117     * response.obj.result will be an IccIoResult on success
1118     */
1119    void iccIO (int command, int fileid, String path, int p1, int p2, int p3,
1120            String data, String pin2, Message response);
1121
1122    /**
1123     * parameters equivalent to 27.007 AT+CRSM command
1124     * response.obj will be an AsyncResult
1125     * response.obj.userObj will be a IccIoResult on success
1126     */
1127    void iccIOForApp (int command, int fileid, String path, int p1, int p2, int p3,
1128            String data, String pin2, String aid, Message response);
1129
1130    /**
1131     * (AsyncResult)response.obj).result is an int[] with element [0] set to
1132     * 1 for "CLIP is provisioned", and 0 for "CLIP is not provisioned".
1133     *
1134     * @param response is callback message
1135     */
1136
1137    void queryCLIP(Message response);
1138
1139    /**
1140     * response.obj will be a an int[2]
1141     *
1142     * response.obj[0] will be TS 27.007 +CLIR parameter 'n'
1143     *  0 presentation indicator is used according to the subscription of the CLIR service
1144     *  1 CLIR invocation
1145     *  2 CLIR suppression
1146     *
1147     * response.obj[1] will be TS 27.007 +CLIR parameter 'm'
1148     *  0 CLIR not provisioned
1149     *  1 CLIR provisioned in permanent mode
1150     *  2 unknown (e.g. no network, etc.)
1151     *  3 CLIR temporary mode presentation restricted
1152     *  4 CLIR temporary mode presentation allowed
1153     */
1154
1155    void getCLIR(Message response);
1156
1157    /**
1158     * clirMode is one of the CLIR_* constants above
1159     *
1160     * response.obj is null
1161     */
1162
1163    void setCLIR(int clirMode, Message response);
1164
1165    /**
1166     * (AsyncResult)response.obj).result is an int[] with element [0] set to
1167     * 0 for disabled, 1 for enabled.
1168     *
1169     * @param serviceClass is a sum of SERVICE_CLASS_*
1170     * @param response is callback message
1171     */
1172
1173    void queryCallWaiting(int serviceClass, Message response);
1174
1175    /**
1176     * @param enable is true to enable, false to disable
1177     * @param serviceClass is a sum of SERVICE_CLASS_*
1178     * @param response is callback message
1179     */
1180
1181    void setCallWaiting(boolean enable, int serviceClass, Message response);
1182
1183    /**
1184     * @param action is one of CF_ACTION_*
1185     * @param cfReason is one of CF_REASON_*
1186     * @param serviceClass is a sum of SERVICE_CLASSS_*
1187     */
1188    void setCallForward(int action, int cfReason, int serviceClass,
1189                String number, int timeSeconds, Message response);
1190
1191    /**
1192     * cfReason is one of CF_REASON_*
1193     *
1194     * ((AsyncResult)response.obj).result will be an array of
1195     * CallForwardInfo's
1196     *
1197     * An array of length 0 means "disabled for all codes"
1198     */
1199    void queryCallForwardStatus(int cfReason, int serviceClass,
1200            String number, Message response);
1201
1202    void setNetworkSelectionModeAutomatic(Message response);
1203
1204    void setNetworkSelectionModeManual(String operatorNumeric, Message response);
1205
1206    /**
1207     * Queries whether the current network selection mode is automatic
1208     * or manual
1209     *
1210     * ((AsyncResult)response.obj).result  is an int[] with element [0] being
1211     * a 0 for automatic selection and a 1 for manual selection
1212     */
1213
1214    void getNetworkSelectionMode(Message response);
1215
1216    /**
1217     * Queries the currently available networks
1218     *
1219     * ((AsyncResult)response.obj).result  is a List of NetworkInfo objects
1220     */
1221    void getAvailableNetworks(Message response);
1222
1223    void getBasebandVersion (Message response);
1224
1225
1226    /**
1227     * (AsyncResult)response.obj).result will be an Integer representing
1228     * the sum of enabled service classes (sum of SERVICE_CLASS_*)
1229     *
1230     * @param facility one of CB_FACILTY_*
1231     * @param password password or "" if not required
1232     * @param serviceClass is a sum of SERVICE_CLASS_*
1233     * @param response is callback message
1234     */
1235
1236    void queryFacilityLock (String facility, String password, int serviceClass,
1237        Message response);
1238
1239    /**
1240     * (AsyncResult)response.obj).result will be an Integer representing
1241     * the sum of enabled service classes (sum of SERVICE_CLASS_*) for the
1242     * application with appId.
1243     *
1244     * @param facility one of CB_FACILTY_*
1245     * @param password password or "" if not required
1246     * @param serviceClass is a sum of SERVICE_CLASS_*
1247     * @param appId is application Id or null if none
1248     * @param response is callback message
1249     */
1250
1251    void queryFacilityLockForApp(String facility, String password, int serviceClass, String appId,
1252        Message response);
1253
1254    /**
1255     * @param facility one of CB_FACILTY_*
1256     * @param lockState true means lock, false means unlock
1257     * @param password password or "" if not required
1258     * @param serviceClass is a sum of SERVICE_CLASS_*
1259     * @param response is callback message
1260     */
1261    void setFacilityLock (String facility, boolean lockState, String password,
1262        int serviceClass, Message response);
1263
1264    /**
1265     * Set the facility lock for the app with this AID on the ICC card.
1266     *
1267     * @param facility one of CB_FACILTY_*
1268     * @param lockState true means lock, false means unlock
1269     * @param password password or "" if not required
1270     * @param serviceClass is a sum of SERVICE_CLASS_*
1271     * @param appId is application Id or null if none
1272     * @param response is callback message
1273     */
1274    void setFacilityLockForApp(String facility, boolean lockState, String password,
1275        int serviceClass, String appId, Message response);
1276
1277    void sendUSSD (String ussdString, Message response);
1278
1279    /**
1280     * Cancels a pending USSD session if one exists.
1281     * @param response callback message
1282     */
1283    void cancelPendingUssd (Message response);
1284
1285    void resetRadio(Message result);
1286
1287    /**
1288     * Assign a specified band for RF configuration.
1289     *
1290     * @param bandMode one of BM_*_BAND
1291     * @param response is callback message
1292     */
1293    void setBandMode (int bandMode, Message response);
1294
1295    /**
1296     * Query the list of band mode supported by RF.
1297     *
1298     * @param response is callback message
1299     *        ((AsyncResult)response.obj).result  is an int[] with every
1300     *        element representing one avialable BM_*_BAND
1301     */
1302    void queryAvailableBandMode (Message response);
1303
1304    /**
1305     * Set the current preferred network type. This will be the last
1306     * networkType that was passed to setPreferredNetworkType.
1307     */
1308    void setCurrentPreferredNetworkType();
1309
1310    /**
1311     *  Requests to set the preferred network type for searching and registering
1312     * (CS/PS domain, RAT, and operation mode)
1313     * @param networkType one of  NT_*_TYPE
1314     * @param response is callback message
1315     */
1316    void setPreferredNetworkType(int networkType , Message response);
1317
1318     /**
1319     *  Query the preferred network type setting
1320     *
1321     * @param response is callback message to report one of  NT_*_TYPE
1322     */
1323    void getPreferredNetworkType(Message response);
1324
1325    /**
1326     * Query neighboring cell ids
1327     *
1328     * @param response s callback message to cell ids
1329     */
1330    void getNeighboringCids(Message response);
1331
1332    /**
1333     * Request to enable/disable network state change notifications when
1334     * location information (lac and/or cid) has changed.
1335     *
1336     * @param enable true to enable, false to disable
1337     * @param response callback message
1338     */
1339    void setLocationUpdates(boolean enable, Message response);
1340
1341    /**
1342     * Gets the default SMSC address.
1343     *
1344     * @param result Callback message contains the SMSC address.
1345     */
1346    void getSmscAddress(Message result);
1347
1348    /**
1349     * Sets the default SMSC address.
1350     *
1351     * @param address new SMSC address
1352     * @param result Callback message is empty on completion
1353     */
1354    void setSmscAddress(String address, Message result);
1355
1356    /**
1357     * Indicates whether there is storage available for new SMS messages.
1358     * @param available true if storage is available
1359     * @param result callback message
1360     */
1361    void reportSmsMemoryStatus(boolean available, Message result);
1362
1363    /**
1364     * Indicates to the vendor ril that StkService is running
1365     * and is ready to receive RIL_UNSOL_STK_XXXX commands.
1366     *
1367     * @param result callback message
1368     */
1369    void reportStkServiceIsRunning(Message result);
1370
1371    void invokeOemRilRequestRaw(byte[] data, Message response);
1372
1373    void invokeOemRilRequestStrings(String[] strings, Message response);
1374
1375
1376    /**
1377     * Send TERMINAL RESPONSE to the SIM, after processing a proactive command
1378     * sent by the SIM.
1379     *
1380     * @param contents  String containing SAT/USAT response in hexadecimal
1381     *                  format starting with first byte of response data. See
1382     *                  TS 102 223 for details.
1383     * @param response  Callback message
1384     */
1385    public void sendTerminalResponse(String contents, Message response);
1386
1387    /**
1388     * Send ENVELOPE to the SIM, after processing a proactive command sent by
1389     * the SIM.
1390     *
1391     * @param contents  String containing SAT/USAT response in hexadecimal
1392     *                  format starting with command tag. See TS 102 223 for
1393     *                  details.
1394     * @param response  Callback message
1395     */
1396    public void sendEnvelope(String contents, Message response);
1397
1398    /**
1399     * Send ENVELOPE to the SIM, such as an SMS-PP data download envelope
1400     * for a SIM data download message. This method has one difference
1401     * from {@link #sendEnvelope}: The SW1 and SW2 status bytes from the UICC response
1402     * are returned along with the response data.
1403     *
1404     * response.obj will be an AsyncResult
1405     * response.obj.result will be an IccIoResult on success
1406     *
1407     * @param contents  String containing SAT/USAT response in hexadecimal
1408     *                  format starting with command tag. See TS 102 223 for
1409     *                  details.
1410     * @param response  Callback message
1411     */
1412    public void sendEnvelopeWithStatus(String contents, Message response);
1413
1414    /**
1415     * Accept or reject the call setup request from SIM.
1416     *
1417     * @param accept   true if the call is to be accepted, false otherwise.
1418     * @param response Callback message
1419     */
1420    public void handleCallSetupRequestFromSim(boolean accept, Message response);
1421
1422    /**
1423     * Activate or deactivate cell broadcast SMS for GSM.
1424     *
1425     * @param activate
1426     *            true = activate, false = deactivate
1427     * @param result Callback message is empty on completion
1428     */
1429    public void setGsmBroadcastActivation(boolean activate, Message result);
1430
1431    /**
1432     * Configure cell broadcast SMS for GSM.
1433     *
1434     * @param response Callback message is empty on completion
1435     */
1436    public void setGsmBroadcastConfig(SmsBroadcastConfigInfo[] config, Message response);
1437
1438    /**
1439     * Query the current configuration of cell broadcast SMS of GSM.
1440     *
1441     * @param response
1442     *        Callback message contains the configuration from the modem
1443     *        on completion
1444     */
1445    public void getGsmBroadcastConfig(Message response);
1446
1447    //***** new Methods for CDMA support
1448
1449    /**
1450     * Request the device ESN / MEID / IMEI / IMEISV.
1451     * "response" is const char **
1452     *   [0] is IMEI if GSM subscription is available
1453     *   [1] is IMEISV if GSM subscription is available
1454     *   [2] is ESN if CDMA subscription is available
1455     *   [3] is MEID if CDMA subscription is available
1456     */
1457    public void getDeviceIdentity(Message response);
1458
1459    /**
1460     * Request the device MDN / H_SID / H_NID / MIN.
1461     * "response" is const char **
1462     *   [0] is MDN if CDMA subscription is available
1463     *   [1] is a comma separated list of H_SID (Home SID) in decimal format
1464     *       if CDMA subscription is available
1465     *   [2] is a comma separated list of H_NID (Home NID) in decimal format
1466     *       if CDMA subscription is available
1467     *   [3] is MIN (10 digits, MIN2+MIN1) if CDMA subscription is available
1468     */
1469    public void getCDMASubscription(Message response);
1470
1471    /**
1472     * Send Flash Code.
1473     * "response" is is NULL
1474     *   [0] is a FLASH string
1475     */
1476    public void sendCDMAFeatureCode(String FeatureCode, Message response);
1477
1478    /** Set the Phone type created */
1479    void setPhoneType(int phoneType);
1480
1481    /**
1482     *  Query the CDMA roaming preference setting
1483     *
1484     * @param response is callback message to report one of  CDMA_RM_*
1485     */
1486    void queryCdmaRoamingPreference(Message response);
1487
1488    /**
1489     *  Requests to set the CDMA roaming preference
1490     * @param cdmaRoamingType one of  CDMA_RM_*
1491     * @param response is callback message
1492     */
1493    void setCdmaRoamingPreference(int cdmaRoamingType, Message response);
1494
1495    /**
1496     *  Requests to set the CDMA subscription mode
1497     * @param cdmaSubscriptionType one of  CDMA_SUBSCRIPTION_*
1498     * @param response is callback message
1499     */
1500    void setCdmaSubscriptionSource(int cdmaSubscriptionType, Message response);
1501
1502    /**
1503     *  Requests to get the CDMA subscription srouce
1504     * @param response is callback message
1505     */
1506    void getCdmaSubscriptionSource(Message response);
1507
1508    /**
1509     *  Set the TTY mode
1510     *
1511     * @param ttyMode one of the following:
1512     * - {@link com.android.internal.telephony.Phone#TTY_MODE_OFF}
1513     * - {@link com.android.internal.telephony.Phone#TTY_MODE_FULL}
1514     * - {@link com.android.internal.telephony.Phone#TTY_MODE_HCO}
1515     * - {@link com.android.internal.telephony.Phone#TTY_MODE_VCO}
1516     * @param response is callback message
1517     */
1518    void setTTYMode(int ttyMode, Message response);
1519
1520    /**
1521     *  Query the TTY mode
1522     * (AsyncResult)response.obj).result is an int[] with element [0] set to
1523     * tty mode:
1524     * - {@link com.android.internal.telephony.Phone#TTY_MODE_OFF}
1525     * - {@link com.android.internal.telephony.Phone#TTY_MODE_FULL}
1526     * - {@link com.android.internal.telephony.Phone#TTY_MODE_HCO}
1527     * - {@link com.android.internal.telephony.Phone#TTY_MODE_VCO}
1528     * @param response is callback message
1529     */
1530    void queryTTYMode(Message response);
1531
1532    /**
1533     * Setup a packet data connection On successful completion, the result
1534     * message will return a {@link com.android.internal.telephony.dataconnection.DataCallResponse}
1535     * object containing the connection information.
1536     *
1537     * @param radioTechnology
1538     *            indicates whether to setup connection on radio technology CDMA
1539     *            (0) or GSM/UMTS (1)
1540     * @param profile
1541     *            Profile Number or NULL to indicate default profile
1542     * @param apn
1543     *            the APN to connect to if radio technology is GSM/UMTS.
1544     *            Otherwise null for CDMA.
1545     * @param user
1546     *            the username for APN, or NULL
1547     * @param password
1548     *            the password for APN, or NULL
1549     * @param authType
1550     *            the PAP / CHAP auth type. Values is one of SETUP_DATA_AUTH_*
1551     * @param protocol
1552     *            one of the PDP_type values in TS 27.007 section 10.1.1.
1553     *            For example, "IP", "IPV6", "IPV4V6", or "PPP".
1554     * @param result
1555     *            Callback message
1556     */
1557    public void setupDataCall(String radioTechnology, String profile,
1558            String apn, String user, String password, String authType,
1559            String protocol, Message result);
1560
1561    /**
1562     * Deactivate packet data connection
1563     *
1564     * @param cid
1565     *            The connection ID
1566     * @param reason
1567     *            Data disconnect reason.
1568     * @param result
1569     *            Callback message is empty on completion
1570     */
1571    public void deactivateDataCall(int cid, int reason, Message result);
1572
1573    /**
1574     * Activate or deactivate cell broadcast SMS for CDMA.
1575     *
1576     * @param activate
1577     *            true = activate, false = deactivate
1578     * @param result
1579     *            Callback message is empty on completion
1580     */
1581    public void setCdmaBroadcastActivation(boolean activate, Message result);
1582
1583    /**
1584     * Configure cdma cell broadcast SMS.
1585     *
1586     * @param response
1587     *            Callback message is empty on completion
1588     */
1589    public void setCdmaBroadcastConfig(CdmaSmsBroadcastConfigInfo[] configs, Message response);
1590
1591    /**
1592     * Query the current configuration of cdma cell broadcast SMS.
1593     *
1594     * @param result
1595     *            Callback message contains the configuration from the modem on completion
1596     */
1597    public void getCdmaBroadcastConfig(Message result);
1598
1599    /**
1600     *  Requests the radio's system selection module to exit emergency callback mode.
1601     *  This function should only be called from CDMAPHone.java.
1602     *
1603     * @param response callback message
1604     */
1605    public void exitEmergencyCallbackMode(Message response);
1606
1607    /**
1608     * Request the status of the ICC and UICC cards.
1609     *
1610     * @param result
1611     *          Callback message containing {@link IccCardStatus} structure for the card.
1612     */
1613    public void getIccCardStatus(Message result);
1614
1615    /**
1616     * Return if the current radio is LTE on CDMA. This
1617     * is a tri-state return value as for a period of time
1618     * the mode may be unknown.
1619     *
1620     * @return {@link PhoneConstants#LTE_ON_CDMA_UNKNOWN}, {@link PhoneConstants#LTE_ON_CDMA_FALSE}
1621     * or {@link PhoneConstants#LTE_ON_CDMA_TRUE}
1622     */
1623    public int getLteOnCdmaMode();
1624
1625    /**
1626     * Request the ISIM application on the UICC to perform the AKA
1627     * challenge/response algorithm for IMS authentication. The nonce string
1628     * and challenge response are Base64 encoded Strings.
1629     *
1630     * @param nonce the nonce string to pass with the ISIM authentication request
1631     * @param response a callback message with the String response in the obj field
1632     */
1633    public void requestIsimAuthentication(String nonce, Message response);
1634
1635    /**
1636     * Get the current Voice Radio Technology.
1637     *
1638     * AsyncResult.result is an int array with the first value
1639     * being one of the ServiceState.RIL_RADIO_TECHNOLOGY_xxx values.
1640     *
1641     * @param result is sent back to handler and result.obj is a AsyncResult
1642     */
1643    void getVoiceRadioTechnology(Message result);
1644
1645    /**
1646     * Return the current set of CellInfo records
1647     *
1648     * AsyncResult.result is a of Collection<CellInfo>
1649     *
1650     * @param result is sent back to handler and result.obj is a AsyncResult
1651     */
1652    void getCellInfoList(Message result);
1653
1654    /**
1655     * Sets the minimum time in milli-seconds between when RIL_UNSOL_CELL_INFO_LIST
1656     * should be invoked.
1657     *
1658     * The default, 0, means invoke RIL_UNSOL_CELL_INFO_LIST when any of the reported
1659     * information changes. Setting the value to INT_MAX(0x7fffffff) means never issue
1660     * A RIL_UNSOL_CELL_INFO_LIST.
1661     *
1662     *
1663
1664     * @param rateInMillis is sent back to handler and result.obj is a AsyncResult
1665     * @param response.obj is AsyncResult ar when sent to associated handler
1666     *                        ar.exception carries exception on failure or null on success
1667     *                        otherwise the error.
1668     */
1669    void setCellInfoListRate(int rateInMillis, Message response);
1670
1671    /**
1672     * Fires when RIL_UNSOL_CELL_INFO_LIST is received from the RIL.
1673     */
1674    void registerForCellInfoList(Handler h, int what, Object obj);
1675    void unregisterForCellInfoList(Handler h);
1676
1677    /**
1678     * Set Initial Attach Apn
1679     *
1680     * @param apn
1681     *            the APN to connect to if radio technology is GSM/UMTS.
1682     * @param protocol
1683     *            one of the PDP_type values in TS 27.007 section 10.1.1.
1684     *            For example, "IP", "IPV6", "IPV4V6", or "PPP".
1685     * @param authType
1686     *            authentication protocol used for this PDP context
1687     *            (None: 0, PAP: 1, CHAP: 2, PAP&CHAP: 3)
1688     * @param username
1689     *            the username for APN, or NULL
1690     * @param password
1691     *            the password for APN, or NULL
1692     * @param result
1693     *            callback message contains the information of SUCCESS/FAILURE
1694     */
1695    public void setInitialAttachApn(String apn, String protocol, int authType, String username,
1696            String password, Message result);
1697
1698    /**
1699     * Notifiy that we are testing an emergency call
1700     */
1701    public void testingEmergencyCall();
1702
1703
1704    /**
1705     * @return version of the ril.
1706     */
1707    int getRilVersion();
1708}
1709