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