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