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