1 /*
2  * Copyright (C) 2018 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 android.telephony.ims;
18 
19 import android.annotation.IntDef;
20 import android.annotation.SystemApi;
21 import android.annotation.UnsupportedAppUsage;
22 import android.os.Parcel;
23 import android.os.Parcelable;
24 
25 import java.lang.annotation.Retention;
26 import java.lang.annotation.RetentionPolicy;
27 
28 /**
29  * This class enables an application to get details on why a method call failed.
30  *
31  * @hide
32  */
33 @SystemApi
34 public final class ImsReasonInfo implements Parcelable {
35 
36     /**
37      * The Reason is unspecified.
38      */
39     public static final int CODE_UNSPECIFIED = 0;
40 
41 
42     // LOCAL
43 
44     // IMS -> Telephony
45     /**
46      * The passed argument is invalid.
47      */
48     public static final int CODE_LOCAL_ILLEGAL_ARGUMENT = 101;
49     /**
50      * The operation was invoked while in an invalid call state.
51      */
52     public static final int CODE_LOCAL_ILLEGAL_STATE = 102;
53     /**
54      * IMS service internal error
55      */
56     public static final int CODE_LOCAL_INTERNAL_ERROR = 103;
57     /**
58      * ImsService has crashed (service connection is lost).
59      */
60     public static final int CODE_LOCAL_IMS_SERVICE_DOWN = 106;
61     /**
62      * No pending incoming call exists
63      */
64     public static final int CODE_LOCAL_NO_PENDING_CALL = 107;
65     /**
66      * IMS Call ended during conference merge process
67      */
68     public static final int CODE_LOCAL_ENDED_BY_CONFERENCE_MERGE = 108;
69 
70     // IMS -> Telephony
71     /**
72      * Service unavailable; radio power off
73      */
74     public static final int CODE_LOCAL_POWER_OFF = 111;
75     /**
76      * Service unavailable; low battery
77      */
78     public static final int CODE_LOCAL_LOW_BATTERY = 112;
79     /**
80      * Service unavailable; out of service (data service state)
81      */
82     public static final int CODE_LOCAL_NETWORK_NO_SERVICE = 121;
83     /**
84      * Service unavailable; no LTE coverage
85      * (VoLTE is not supported even though IMS is registered)
86      */
87     public static final int CODE_LOCAL_NETWORK_NO_LTE_COVERAGE = 122;
88     /**
89      * Service unavailable; located in roaming area
90      */
91     public static final int CODE_LOCAL_NETWORK_ROAMING = 123;
92     /**
93      * Service unavailable; IP changed
94      */
95     public static final int CODE_LOCAL_NETWORK_IP_CHANGED = 124;
96     /**
97      * Service unavailable; for an unspecified reason
98      */
99     public static final int CODE_LOCAL_SERVICE_UNAVAILABLE = 131;
100     /**
101      * Service unavailable; IMS is not registered
102      */
103     public static final int CODE_LOCAL_NOT_REGISTERED = 132;
104 
105     // IMS <-> Telephony
106     /**
107      * Maximum number of simultaneous calls exceeded
108      */
109     public static final int CODE_LOCAL_CALL_EXCEEDED = 141;
110     // IMS <- Telephony
111     /**
112      * The call is busy.
113      */
114     public static final int CODE_LOCAL_CALL_BUSY = 142;
115     /**
116      * The Call has been declined locally on this device.
117      */
118     public static final int CODE_LOCAL_CALL_DECLINE = 143;
119     // IMS -> Telephony
120     /**
121      * Can not complete call; an SRVCC is in progress.
122      */
123     public static final int CODE_LOCAL_CALL_VCC_ON_PROGRESSING = 144;
124     /**
125      * Can not complete call; resource reservation is failed (QoS precondition)
126      */
127     public static final int CODE_LOCAL_CALL_RESOURCE_RESERVATION_FAILED = 145;
128     /**
129      * VoLTE service can't be provided by the network or remote end, retry the call.
130      * Resolve the extra code provided in (EXTRA_CODE_CALL_RETRY_*) if the below code is set
131      */
132     public static final int CODE_LOCAL_CALL_CS_RETRY_REQUIRED = 146;
133     /**
134      * VoLTE service can't be provided by the network temporarily, retry the call.
135      */
136     public static final int CODE_LOCAL_CALL_VOLTE_RETRY_REQUIRED = 147;
137     /**
138      * IMS call is already terminated (in TERMINATED state).
139      */
140     public static final int CODE_LOCAL_CALL_TERMINATED = 148;
141     /**
142      * Call was disconnected because a handover is not feasible due to network conditions.
143      */
144     public static final int CODE_LOCAL_HO_NOT_FEASIBLE = 149;
145     /**
146      * This device does not support IMS.
147      * @hide
148      */
149     public static final int CODE_LOCAL_IMS_NOT_SUPPORTED_ON_DEVICE = 150;
150 
151     /*
152      * TIMEOUT (IMS -> Telephony)
153      */
154     /**
155      * 1xx waiting timer is expired after sending INVITE request (MO calls only)
156      */
157     public static final int CODE_TIMEOUT_1XX_WAITING = 201;
158     /**
159      * User didn't answer during call setup operation (MO/MT)
160      * MO : 200 OK to INVITE request is not received,
161      * MT : No action from user after alerting the call
162      */
163     public static final int CODE_TIMEOUT_NO_ANSWER = 202;
164     /**
165      * User no answer during call update operation (MO/MT)
166      * MO : 200 OK to re-INVITE request is not received,
167      * MT : No action from user after alerting the call
168      */
169     public static final int CODE_TIMEOUT_NO_ANSWER_CALL_UPDATE = 203;
170 
171     /**
172      * The call was blocked by call barring configuration.
173      */
174     public static final int CODE_CALL_BARRED = 240;
175 
176     /**
177      * The operation is restricted to fixed dialing numbers only.
178      */
179     public static final int CODE_FDN_BLOCKED = 241;
180 
181     /**
182      * Network rejected the emergency call request because IMEI was used as identification
183      * and this capability is not supported by the network.
184      */
185     public static final int CODE_IMEI_NOT_ACCEPTED = 243;
186 
187     //STK CC errors
188     /**
189      * Stk Call Control modified DIAL request to USSD request.
190      */
191     public static final int CODE_DIAL_MODIFIED_TO_USSD = 244;
192     /**
193      * Stk Call Control modified DIAL request to SS request.
194      */
195     public static final int CODE_DIAL_MODIFIED_TO_SS = 245;
196     /**
197      * Stk Call Control modified DIAL request to DIAL with modified data.
198      */
199     public static final int CODE_DIAL_MODIFIED_TO_DIAL = 246;
200     /**
201      * Stk Call Control modified DIAL request to Video DIAL request.
202      */
203     public static final int CODE_DIAL_MODIFIED_TO_DIAL_VIDEO = 247;
204     /**
205      * Stk Call Control modified Video DIAL request to DIAL request.
206      */
207     public static final int CODE_DIAL_VIDEO_MODIFIED_TO_DIAL = 248;
208     /**
209      * Stk Call Control modified Video DIAL request to Video DIAL request.
210      */
211     public static final int CODE_DIAL_VIDEO_MODIFIED_TO_DIAL_VIDEO = 249;
212     /**
213      * Stk Call Control modified Video DIAL request to SS request.
214      */
215     public static final int CODE_DIAL_VIDEO_MODIFIED_TO_SS = 250;
216     /**
217      * Stk Call Control modified Video DIAL request to USSD request.
218      */
219     public static final int CODE_DIAL_VIDEO_MODIFIED_TO_USSD = 251;
220 
221     /*
222      * STATUSCODE (SIP response code) (IMS -> Telephony)
223      */
224     // 3xx responses
225     /**
226      * SIP 3xx response: SIP request is redirected
227      */
228     public static final int CODE_SIP_REDIRECTED = 321;
229     // 4xx responses
230     /**
231      * Sip 400 response : Bad Request
232      */
233     public static final int CODE_SIP_BAD_REQUEST = 331;
234     /**
235      * Sip 403 response : Forbidden
236      */
237     public static final int CODE_SIP_FORBIDDEN = 332;
238     /**
239      * Sip 404 response : Not Found
240      */
241     public static final int CODE_SIP_NOT_FOUND = 333;
242     /**
243      * Not supported, because of one of the following:
244      * SIP response 415 : Unsupported Media Type,
245      * SIP response 416 : Unsupported URI Scheme,
246      * SIP response 420 : Bad Extension
247      */
248     public static final int CODE_SIP_NOT_SUPPORTED = 334;
249     /**
250      * SIP response 408 : Request Timeout.
251      */
252     public static final int CODE_SIP_REQUEST_TIMEOUT = 335;
253     /**
254      * SIP response 480 : Temporarily Unavailable
255      */
256     public static final int CODE_SIP_TEMPRARILY_UNAVAILABLE = 336;
257     /**
258      * SIP response 484 : Address Incomplete
259      */
260     public static final int CODE_SIP_BAD_ADDRESS = 337;
261     /**
262      * Returned a busy response, may be one of the following:
263      * SIP response 486 : Busy Here,
264      * SIP response 600 : Busy Everywhere
265      */
266     public static final int CODE_SIP_BUSY = 338;
267     /**
268      * SIP response 487 : Request Terminated
269      */
270     public static final int CODE_SIP_REQUEST_CANCELLED = 339;
271     /**
272      * Received a not acceptable response, will be one of the following:
273      * SIP response 406 : Not Acceptable
274      * SIP response 488 : Not Acceptable Here
275      * SIP response 606 : Not Acceptable
276      */
277     public static final int CODE_SIP_NOT_ACCEPTABLE = 340;
278     /**
279      * Received a not acceptable response, will be one of the following:
280      * SIP response 410 : Gone
281      * SIP response 604 : Does Not Exist Anywhere
282      */
283     public static final int CODE_SIP_NOT_REACHABLE = 341;
284     /**
285      * Received another unspecified error SIP response from the client.
286      */
287     public static final int CODE_SIP_CLIENT_ERROR = 342;
288     /**
289      * SIP response 481: Transaction Does Not Exist
290      */
291     public static final int CODE_SIP_TRANSACTION_DOES_NOT_EXIST = 343;
292     // 5xx responses
293     /**
294      * SIP response 501 : Server Internal Error
295      */
296     public static final int CODE_SIP_SERVER_INTERNAL_ERROR = 351;
297     /**
298      * SIP response 503 : Service Unavailable
299      */
300     public static final int CODE_SIP_SERVICE_UNAVAILABLE = 352;
301     /**
302      * SIP response 504 : Server Time-out
303      */
304     public static final int CODE_SIP_SERVER_TIMEOUT = 353;
305     /**
306      * Received an unspecified SIP server error response.
307      */
308     public static final int CODE_SIP_SERVER_ERROR = 354;
309     // 6xx responses
310     /**
311      * 603 : Decline
312      */
313     public static final int CODE_SIP_USER_REJECTED = 361;
314     /**
315      * Unspecified 6xx error.
316      */
317     public static final int CODE_SIP_GLOBAL_ERROR = 362;
318 
319     /**
320      * Emergency call failed in the modem with a temporary fail cause and should be redialed on this
321      * slot.
322      */
323     public static final int CODE_EMERGENCY_TEMP_FAILURE = 363;
324     /**
325      * Emergency call failed in the modem with a permanent fail cause and should not be redialed on
326      * this slot. If there are any other slots available for emergency calling, try those.
327      */
328     public static final int CODE_EMERGENCY_PERM_FAILURE = 364;
329 
330     /**
331      * Call failure code during hangup/reject if user marked the call as unwanted.
332      *
333      * Android Telephony will receive information whether ROBO call feature is supported by the
334      * network from modem and propagate the same to AOSP as new ImsCallProfile members. OEMs can
335      * check this information and provide an option to the user to mark the call as unwanted.
336      */
337     public static final int CODE_SIP_USER_MARKED_UNWANTED = 365;
338 
339     /**
340      * SIP Response : 405
341      * Method not allowed for the address in the Request URI
342      */
343     public static final int CODE_SIP_METHOD_NOT_ALLOWED = 366;
344 
345     /**
346      * SIP Response : 407
347      * The request requires user authentication
348      */
349     public static final int CODE_SIP_PROXY_AUTHENTICATION_REQUIRED = 367;
350 
351     /**
352      * SIP Response : 413
353      * Request body too large
354      */
355     public static final int CODE_SIP_REQUEST_ENTITY_TOO_LARGE = 368;
356 
357     /**
358      * SIP Response : 414
359      * Request-URI too large
360      */
361     public static final int CODE_SIP_REQUEST_URI_TOO_LARGE = 369;
362 
363     /**
364      * SIP Response : 421
365      * Specific extension is required, which is not present in the HEADER
366      */
367     public static final int CODE_SIP_EXTENSION_REQUIRED = 370;
368 
369     /**
370      * SIP Response : 422
371      * The session expiration field too small
372      */
373     public static final int CODE_SIP_INTERVAL_TOO_BRIEF = 371;
374 
375     /**
376      * SIP Response : 481
377      * Request received by the server does not match any dialog or transaction
378      */
379     public static final int CODE_SIP_CALL_OR_TRANS_DOES_NOT_EXIST = 372;
380 
381     /**
382      * SIP Response : 482
383      * Server has detected a loop
384      */
385     public static final int CODE_SIP_LOOP_DETECTED = 373;
386 
387     /**
388      * SIP Response : 483
389      * Max-Forwards value reached
390      */
391     public static final int CODE_SIP_TOO_MANY_HOPS = 374;
392 
393     /**
394      * SIP Response : 485
395      * Request-URI is ambiguous
396      *
397      */
398     public static final int CODE_SIP_AMBIGUOUS = 376;
399 
400     /**
401      * SIP Response : 491
402      * Server has pending request for same dialog
403      */
404     public static final int CODE_SIP_REQUEST_PENDING = 377;
405 
406     /**
407      * SIP Response : 493
408      * The request cannot be decrypted by recipient
409      */
410     public static final int CODE_SIP_UNDECIPHERABLE = 378;
411 
412     /**
413      * MEDIA (IMS -> Telephony)
414      */
415     /**
416      * Media resource initialization failed
417      */
418     public static final int CODE_MEDIA_INIT_FAILED = 401;
419     /**
420      * RTP timeout (no audio / video traffic in the session)
421      */
422     public static final int CODE_MEDIA_NO_DATA = 402;
423     /**
424      * Media is not supported; so dropped the call
425      */
426     public static final int CODE_MEDIA_NOT_ACCEPTABLE = 403;
427     /**
428      * Unspecified media related error.
429      */
430     public static final int CODE_MEDIA_UNSPECIFIED = 404;
431 
432     /*
433      * USER
434      */
435     // Telephony -> IMS
436     /**
437      * User triggers the call to be terminated.
438      */
439     public static final int CODE_USER_TERMINATED = 501;
440     /**
441      * No action was taken while an incoming call was ringing.
442      */
443     public static final int CODE_USER_NOANSWER = 502;
444     /**
445      * User ignored an incoming call.
446      */
447     public static final int CODE_USER_IGNORE = 503;
448     /**
449      * User declined an incoming call.
450      */
451     public static final int CODE_USER_DECLINE = 504;
452     /**
453      * Device declined/ended a call due to a low battery condition.
454      */
455     public static final int CODE_LOW_BATTERY = 505;
456     /**
457      * Device declined a call due to a blacklisted caller ID.
458      */
459     public static final int CODE_BLACKLISTED_CALL_ID = 506;
460     // IMS -> Telephony
461     /**
462      * The call has been terminated by the network or remote user.
463      */
464     public static final int CODE_USER_TERMINATED_BY_REMOTE = 510;
465     /**
466     * Upgrade Downgrade request rejected by
467     * Remote user if the request is MO initiated
468     * Local user if the request is MT initiated
469     */
470     public static final int CODE_USER_REJECTED_SESSION_MODIFICATION = 511;
471 
472     /**
473     * Upgrade Downgrade request cancelled by the user who initiated it
474     */
475     public static final int CODE_USER_CANCELLED_SESSION_MODIFICATION = 512;
476 
477     /**
478      * UPGRADE DOWNGRADE operation failed
479      * This can happen due to failure from SIP/RTP/SDP generation or a Call end is
480      * triggered/received while Reinvite is in progress.
481      */
482     public static final int CODE_SESSION_MODIFICATION_FAILED = 1517;
483 
484     /*
485      * UT
486      */
487     /**
488      * UT is currently not supported on this device.
489      */
490     public static final int CODE_UT_NOT_SUPPORTED = 801;
491     /**
492      * UT services are currently not available on this device.
493      */
494     public static final int CODE_UT_SERVICE_UNAVAILABLE = 802;
495     /**
496      * The requested UT operation is not allowed.
497      */
498     public static final int CODE_UT_OPERATION_NOT_ALLOWED = 803;
499     /**
500      * The UT request resulted in a network error.
501      */
502     public static final int CODE_UT_NETWORK_ERROR = 804;
503     /**
504      * The password entered for UT operations does not match the stored password.
505      */
506     public static final int CODE_UT_CB_PASSWORD_MISMATCH = 821;
507     //STK CC errors
508     /**
509      * Sim Toolkit Call Control modified the UT operation to a dial command.
510      */
511     public static final int CODE_UT_SS_MODIFIED_TO_DIAL = 822;
512     /**
513      * Sim Toolkit Call Control modified the UT operation to a USSD command.
514      */
515     public static final int CODE_UT_SS_MODIFIED_TO_USSD = 823;
516     /**
517      * Sim Toolkit Call Control modified the UT operation to another supplementary service command.
518      */
519     public static final int CODE_UT_SS_MODIFIED_TO_SS = 824;
520     /**
521      * Sim Toolkit Call Control modified the UT operation to a video call dial command.
522      */
523     public static final int CODE_UT_SS_MODIFIED_TO_DIAL_VIDEO = 825;
524 
525     /**@hide*/
526     @IntDef(value = {
527             CODE_UT_NOT_SUPPORTED,
528             CODE_UT_SERVICE_UNAVAILABLE,
529             CODE_UT_OPERATION_NOT_ALLOWED,
530             CODE_UT_NETWORK_ERROR,
531             CODE_UT_CB_PASSWORD_MISMATCH,
532             CODE_UT_SS_MODIFIED_TO_DIAL,
533             CODE_UT_SS_MODIFIED_TO_USSD,
534             CODE_UT_SS_MODIFIED_TO_SS,
535             CODE_UT_SS_MODIFIED_TO_DIAL_VIDEO
536     }, prefix = "CODE_UT_")
537     @Retention(RetentionPolicy.SOURCE)
538     public @interface UtReason {}
539 
540     /**
541      * Emergency callback mode is not supported.
542      */
543     public static final int CODE_ECBM_NOT_SUPPORTED = 901;
544 
545     /**
546      * Fail code used to indicate that Multi-endpoint is not supported by the IMS framework.
547      */
548     public static final int CODE_MULTIENDPOINT_NOT_SUPPORTED = 902;
549 
550     /**
551      * IMS Registration error code
552      */
553     public static final int CODE_REGISTRATION_ERROR = 1000;
554 
555     /*
556      * CALL DROP error codes (Call could drop because of many reasons like Network not available,
557      *  handover, failed, etc)
558      */
559     /**
560      * MT call has ended due to a release from the network because the call was answered elsewhere.
561      */
562     public static final int CODE_ANSWERED_ELSEWHERE = 1014;
563 
564     /**
565      * For MultiEndpoint - Call Pull request has failed.
566      */
567     public static final int CODE_CALL_PULL_OUT_OF_SYNC = 1015;
568 
569     /**
570      * For MultiEndpoint - Call has been pulled from primary to secondary.
571      */
572     public static final int CODE_CALL_END_CAUSE_CALL_PULL = 1016;
573 
574     /**
575      * CALL DROP error code for the case when a device is ePDG capable and when the user is on an
576      * active wifi call and at the edge of coverage and there is no qualified LTE network available
577      * to handover the call to. We get a handover NOT_TRIGERRED message from the modem. This error
578      * code is received as part of the handover message.
579      */
580     public static final int CODE_CALL_DROP_IWLAN_TO_LTE_UNAVAILABLE = 1100;
581 
582     /**
583      * For MultiEndPoint - Call was rejected elsewhere
584      */
585     public static final int CODE_REJECTED_ELSEWHERE = 1017;
586 
587     /**
588      * Supplementary services (HOLD/RESUME) failure error codes.
589      * Values for Supplemetary services failure - Failed, Cancelled and Re-Invite collision.
590      */
591 
592     /**
593      * Supplementary Services (HOLD/RESUME) - the command failed.
594      */
595     public static final int CODE_SUPP_SVC_FAILED = 1201;
596     /**
597      * Supplementary Services (HOLD/RESUME) - the command was cancelled.
598      */
599     public static final int CODE_SUPP_SVC_CANCELLED = 1202;
600     /**
601      * Supplementary Services (HOLD/RESUME) - the command resulted in a re-invite collision.
602      */
603     public static final int CODE_SUPP_SVC_REINVITE_COLLISION = 1203;
604 
605     /**
606      * DPD Procedure received no response or send failed.
607      */
608     public static final int CODE_IWLAN_DPD_FAILURE = 1300;
609 
610     /**
611      * Establishment of the ePDG Tunnel Failed.
612      */
613     public static final int CODE_EPDG_TUNNEL_ESTABLISH_FAILURE = 1400;
614 
615     /**
616      * Re-keying of the ePDG Tunnel Failed; may not always result in teardown.
617      */
618     public static final int CODE_EPDG_TUNNEL_REKEY_FAILURE = 1401;
619 
620     /**
621      * Connection to the packet gateway is lost.
622      */
623     public static final int CODE_EPDG_TUNNEL_LOST_CONNECTION = 1402;
624 
625     /**
626      * The maximum number of calls allowed has been reached.  Used in a multi-endpoint scenario
627      * where the number of calls across all connected devices has reached the maximum.
628      */
629     public static final int CODE_MAXIMUM_NUMBER_OF_CALLS_REACHED = 1403;
630 
631     /**
632      * Similar to {@link #CODE_LOCAL_CALL_DECLINE}, except indicates that a remote device has
633      * declined the call.  Used in a multi-endpoint scenario where a remote device declined an
634      * incoming call.
635      */
636     public static final int CODE_REMOTE_CALL_DECLINE = 1404;
637 
638     /**
639      * Indicates the call was disconnected due to the user reaching their data limit.
640      */
641     public static final int CODE_DATA_LIMIT_REACHED = 1405;
642 
643     /**
644      * Indicates the call was disconnected due to the user disabling cellular data.
645      */
646     public static final int CODE_DATA_DISABLED = 1406;
647 
648     /**
649      * Indicates a call was disconnected due to loss of wifi signal.
650      */
651     public static final int CODE_WIFI_LOST = 1407;
652 
653     /**
654      * Indicates the registration attempt on IWLAN failed due to IKEv2 authetication failure
655      * during tunnel establishment.
656      */
657     public static final int CODE_IKEV2_AUTH_FAILURE = 1408;
658 
659     /** The call cannot be established because RADIO is OFF */
660     public static final int CODE_RADIO_OFF = 1500;
661 
662     /** The call cannot be established because of no valid SIM */
663     public static final int CODE_NO_VALID_SIM = 1501;
664 
665     /** The failure is due internal error at modem */
666     public static final int CODE_RADIO_INTERNAL_ERROR = 1502;
667 
668     /** The failure is due to UE timer expired while waiting for a response from network */
669     public static final int CODE_NETWORK_RESP_TIMEOUT = 1503;
670 
671     /** The failure is due to explicit reject from network */
672     public static final int CODE_NETWORK_REJECT = 1504;
673 
674     /** The failure is due to radio access failure. ex. RACH failure */
675     public static final int CODE_RADIO_ACCESS_FAILURE = 1505;
676 
677     /** Call/IMS registration failed/dropped because of a RLF */
678     public static final int CODE_RADIO_LINK_FAILURE = 1506;
679 
680     /** Call/IMS registration failed/dropped because of radio link lost */
681     public static final int CODE_RADIO_LINK_LOST = 1507;
682 
683     /** The call Call/IMS registration failed because of a radio uplink issue */
684     public static final int CODE_RADIO_UPLINK_FAILURE = 1508;
685 
686     /** Call failed because of a RRC connection setup failure */
687     public static final int CODE_RADIO_SETUP_FAILURE = 1509;
688 
689     /** Call failed/dropped because of RRC connection release from NW */
690     public static final int CODE_RADIO_RELEASE_NORMAL = 1510;
691 
692     /** Call failed/dropped because of RRC abnormally released by modem/network */
693     public static final int CODE_RADIO_RELEASE_ABNORMAL = 1511;
694 
695     /** Call failed because of access class barring */
696     public static final int CODE_ACCESS_CLASS_BLOCKED = 1512;
697 
698     /** Call/IMS registration is failed/dropped because of a network detach */
699     public static final int CODE_NETWORK_DETACH = 1513;
700 
701     /**
702      * Call failed due to SIP code 380 (Alternative Service response) while dialing an "undetected
703      * emergency number".  This scenario is important in some regions where the carrier network will
704      * identify other non-emergency help numbers (e.g. mountain rescue) when attempting to dial.
705      */
706     public static final int CODE_SIP_ALTERNATE_EMERGENCY_CALL = 1514;
707 
708     /**
709      * Call failed because of unobtainable number
710      * @hide
711      */
712     public static final int CODE_UNOBTAINABLE_NUMBER = 1515;
713 
714     /**
715      * Call failed because WiFi call could not complete and circuit switch silent redial
716      * is not allowed while roaming on another network.
717      */
718     public static final int CODE_NO_CSFB_IN_CS_ROAM = 1516;
719 
720     /**
721      * The rejection cause is not known.
722      * <p>
723      * Used with implicit call rejection.
724      */
725     public static final int CODE_REJECT_UNKNOWN = 1600;
726 
727     /**
728      * Ongoing call, and call waiting is disabled.
729      * <p>
730      * Used with implicit call rejection.
731      */
732     public static final int CODE_REJECT_ONGOING_CALL_WAITING_DISABLED = 1601;
733 
734     /**
735      * A call is ongoing on another sub.
736      * <p>
737      * Used with implicit call rejection.
738      */
739     public static final int CODE_REJECT_CALL_ON_OTHER_SUB = 1602;
740 
741     /**
742      * CDMA call collision.
743      * <p>
744      * Used with implicit call rejection.
745      */
746     public static final int CODE_REJECT_1X_COLLISION = 1603;
747 
748     /**
749      * IMS is not registered for service yet.
750      * <p>
751      * Used with implicit call rejection.
752      */
753     public static final int CODE_REJECT_SERVICE_NOT_REGISTERED = 1604;
754 
755     /**
756      * The call type is not allowed on the current RAT.
757      * <p>
758      * Used with implicit call rejection.
759      */
760     public static final int CODE_REJECT_CALL_TYPE_NOT_ALLOWED = 1605;
761 
762     /**
763      * And emergency call is ongoing.
764      * <p>
765      * Used with implicit call rejection.
766      */
767     public static final int CODE_REJECT_ONGOING_E911_CALL = 1606;
768 
769     /**
770      * Another call is in the process of being establilshed.
771      * <p>
772      * Used with implicit call rejection.
773      */
774     public static final int CODE_REJECT_ONGOING_CALL_SETUP = 1607;
775 
776     /**
777      * Maximum number of allowed calls are already in progress.
778      * <p>
779      * Used with implicit call rejection.
780      */
781     public static final int CODE_REJECT_MAX_CALL_LIMIT_REACHED = 1608;
782 
783     /**
784      * Invalid/unsupported SIP headers received.
785      * <p>
786      * Used with implicit call rejection.
787      */
788     public static final int CODE_REJECT_UNSUPPORTED_SIP_HEADERS = 1609;
789 
790     /**
791      * Invalid/unsupported SDP headers received.
792      * <p>
793      * Used with implicit call rejection.
794      */
795     public static final int CODE_REJECT_UNSUPPORTED_SDP_HEADERS = 1610;
796 
797     /**
798      * A call transfer is in progress.
799      * <p>
800      * Used with implicit call rejection.
801      */
802     public static final int CODE_REJECT_ONGOING_CALL_TRANSFER = 1611;
803 
804     /**
805      * An internal error occured while processing the call.
806      * <p>
807      * Used with implicit call rejection.
808      */
809     public static final int CODE_REJECT_INTERNAL_ERROR = 1612;
810 
811     /**
812      * Call failure due to lack of dedicated bearer.
813      * <p>
814      * Used with implicit call rejection.
815      */
816     public static final int CODE_REJECT_QOS_FAILURE = 1613;
817 
818     /**
819      * A call handover is in progress.
820      * <p>
821      * Used with implicit call rejection.
822      */
823     public static final int CODE_REJECT_ONGOING_HANDOVER = 1614;
824 
825     /**
826      * Video calling not supported with TTY.
827      * <p>
828      * Used with implicit call rejection.
829      */
830     public static final int CODE_REJECT_VT_TTY_NOT_ALLOWED = 1615;
831 
832     /**
833      * A call upgrade is in progress.
834      * <p>
835      * Used with implicit call rejection.
836      */
837     public static final int CODE_REJECT_ONGOING_CALL_UPGRADE = 1616;
838 
839     /**
840      * Call from conference server, when TTY mode is ON.
841      * <p>
842      * Used with implicit call rejection.
843      */
844     public static final int CODE_REJECT_CONFERENCE_TTY_NOT_ALLOWED = 1617;
845 
846     /**
847      * A conference call is ongoing.
848      * <p>
849      * Used with implicit call rejection.
850      */
851     public static final int CODE_REJECT_ONGOING_CONFERENCE_CALL = 1618;
852 
853     /**
854      * A video call with AVPF is not supported.
855      * <p>
856      * Used with implicit call rejection.
857      */
858     public static final int CODE_REJECT_VT_AVPF_NOT_ALLOWED = 1619;
859 
860     /**
861      * And encrypted call is ongoing; other calls not supported.
862      * <p>
863      * Used with implicit call rejection.
864      */
865     public static final int CODE_REJECT_ONGOING_ENCRYPTED_CALL = 1620;
866 
867     /**
868      * A CS call is ongoing.
869      * <p>
870      * Used with implicit call rejection.
871      */
872     public static final int CODE_REJECT_ONGOING_CS_CALL = 1621;
873 
874     /*
875      * OEM specific error codes. To be used by OEMs when they don't want to reveal error code which
876      * would be replaced by ERROR_UNSPECIFIED.
877      */
878     public static final int CODE_OEM_CAUSE_1 = 0xf001;
879     public static final int CODE_OEM_CAUSE_2 = 0xf002;
880     public static final int CODE_OEM_CAUSE_3 = 0xf003;
881     public static final int CODE_OEM_CAUSE_4 = 0xf004;
882     public static final int CODE_OEM_CAUSE_5 = 0xf005;
883     public static final int CODE_OEM_CAUSE_6 = 0xf006;
884     public static final int CODE_OEM_CAUSE_7 = 0xf007;
885     public static final int CODE_OEM_CAUSE_8 = 0xf008;
886     public static final int CODE_OEM_CAUSE_9 = 0xf009;
887     public static final int CODE_OEM_CAUSE_10 = 0xf00a;
888     public static final int CODE_OEM_CAUSE_11 = 0xf00b;
889     public static final int CODE_OEM_CAUSE_12 = 0xf00c;
890     public static final int CODE_OEM_CAUSE_13 = 0xf00d;
891     public static final int CODE_OEM_CAUSE_14 = 0xf00e;
892     public static final int CODE_OEM_CAUSE_15 = 0xf00f;
893 
894     /**
895      * @hide
896      */
897     @IntDef(value = {
898             CODE_UNSPECIFIED,
899             CODE_LOCAL_ILLEGAL_ARGUMENT,
900             CODE_LOCAL_ILLEGAL_STATE,
901             CODE_LOCAL_INTERNAL_ERROR,
902             CODE_LOCAL_IMS_SERVICE_DOWN,
903             CODE_LOCAL_NO_PENDING_CALL,
904             CODE_LOCAL_ENDED_BY_CONFERENCE_MERGE,
905             CODE_LOCAL_POWER_OFF,
906             CODE_LOCAL_LOW_BATTERY,
907             CODE_LOCAL_NETWORK_NO_SERVICE,
908             CODE_LOCAL_NETWORK_NO_LTE_COVERAGE,
909             CODE_LOCAL_NETWORK_ROAMING,
910             CODE_LOCAL_NETWORK_IP_CHANGED,
911             CODE_LOCAL_SERVICE_UNAVAILABLE,
912             CODE_LOCAL_NOT_REGISTERED,
913             CODE_LOCAL_CALL_EXCEEDED,
914             CODE_LOCAL_CALL_BUSY,
915             CODE_LOCAL_CALL_DECLINE,
916             CODE_LOCAL_CALL_VCC_ON_PROGRESSING,
917             CODE_LOCAL_CALL_RESOURCE_RESERVATION_FAILED,
918             CODE_LOCAL_CALL_CS_RETRY_REQUIRED,
919             CODE_LOCAL_CALL_VOLTE_RETRY_REQUIRED,
920             CODE_LOCAL_CALL_TERMINATED,
921             CODE_LOCAL_HO_NOT_FEASIBLE,
922             CODE_TIMEOUT_1XX_WAITING,
923             CODE_TIMEOUT_NO_ANSWER,
924             CODE_TIMEOUT_NO_ANSWER_CALL_UPDATE,
925             CODE_CALL_BARRED,
926             CODE_FDN_BLOCKED,
927             CODE_IMEI_NOT_ACCEPTED,
928             CODE_DIAL_MODIFIED_TO_USSD,
929             CODE_DIAL_MODIFIED_TO_SS,
930             CODE_DIAL_MODIFIED_TO_DIAL,
931             CODE_DIAL_MODIFIED_TO_DIAL_VIDEO,
932             CODE_DIAL_VIDEO_MODIFIED_TO_DIAL,
933             CODE_DIAL_VIDEO_MODIFIED_TO_DIAL_VIDEO,
934             CODE_DIAL_VIDEO_MODIFIED_TO_SS,
935             CODE_DIAL_VIDEO_MODIFIED_TO_USSD,
936             CODE_SIP_REDIRECTED,
937             CODE_SIP_BAD_REQUEST,
938             CODE_SIP_FORBIDDEN,
939             CODE_SIP_NOT_FOUND,
940             CODE_SIP_NOT_SUPPORTED,
941             CODE_SIP_REQUEST_TIMEOUT,
942             CODE_SIP_TEMPRARILY_UNAVAILABLE,
943             CODE_SIP_BAD_ADDRESS,
944             CODE_SIP_BUSY,
945             CODE_SIP_REQUEST_CANCELLED,
946             CODE_SIP_NOT_ACCEPTABLE,
947             CODE_SIP_NOT_REACHABLE,
948             CODE_SIP_CLIENT_ERROR,
949             CODE_SIP_TRANSACTION_DOES_NOT_EXIST,
950             CODE_SIP_SERVER_INTERNAL_ERROR,
951             CODE_SIP_SERVICE_UNAVAILABLE,
952             CODE_SIP_SERVER_TIMEOUT,
953             CODE_SIP_SERVER_ERROR,
954             CODE_SIP_USER_REJECTED,
955             CODE_SIP_GLOBAL_ERROR,
956             CODE_EMERGENCY_TEMP_FAILURE,
957             CODE_EMERGENCY_PERM_FAILURE,
958             CODE_SIP_USER_MARKED_UNWANTED,
959             CODE_SIP_METHOD_NOT_ALLOWED,
960             CODE_SIP_PROXY_AUTHENTICATION_REQUIRED,
961             CODE_SIP_REQUEST_ENTITY_TOO_LARGE,
962             CODE_SIP_REQUEST_URI_TOO_LARGE,
963             CODE_SIP_EXTENSION_REQUIRED,
964             CODE_SIP_INTERVAL_TOO_BRIEF,
965             CODE_SIP_CALL_OR_TRANS_DOES_NOT_EXIST,
966             CODE_SIP_LOOP_DETECTED,
967             CODE_SIP_TOO_MANY_HOPS,
968             CODE_SIP_AMBIGUOUS,
969             CODE_SIP_REQUEST_PENDING,
970             CODE_SIP_UNDECIPHERABLE,
971             CODE_MEDIA_INIT_FAILED,
972             CODE_MEDIA_NO_DATA,
973             CODE_MEDIA_NOT_ACCEPTABLE,
974             CODE_MEDIA_UNSPECIFIED,
975             CODE_USER_TERMINATED,
976             CODE_USER_NOANSWER,
977             CODE_USER_IGNORE,
978             CODE_USER_DECLINE,
979             CODE_LOW_BATTERY,
980             CODE_BLACKLISTED_CALL_ID,
981             CODE_USER_TERMINATED_BY_REMOTE,
982             CODE_USER_REJECTED_SESSION_MODIFICATION,
983             CODE_USER_CANCELLED_SESSION_MODIFICATION,
984             CODE_SESSION_MODIFICATION_FAILED,
985             CODE_UT_NOT_SUPPORTED,
986             CODE_UT_SERVICE_UNAVAILABLE,
987             CODE_UT_OPERATION_NOT_ALLOWED,
988             CODE_UT_NETWORK_ERROR,
989             CODE_UT_CB_PASSWORD_MISMATCH,
990             CODE_UT_SS_MODIFIED_TO_DIAL,
991             CODE_UT_SS_MODIFIED_TO_USSD,
992             CODE_UT_SS_MODIFIED_TO_SS,
993             CODE_UT_SS_MODIFIED_TO_DIAL_VIDEO,
994             CODE_ECBM_NOT_SUPPORTED,
995             CODE_MULTIENDPOINT_NOT_SUPPORTED,
996             CODE_REGISTRATION_ERROR,
997             CODE_ANSWERED_ELSEWHERE,
998             CODE_CALL_PULL_OUT_OF_SYNC,
999             CODE_CALL_END_CAUSE_CALL_PULL,
1000             CODE_CALL_DROP_IWLAN_TO_LTE_UNAVAILABLE,
1001             CODE_REJECTED_ELSEWHERE,
1002             CODE_SUPP_SVC_FAILED,
1003             CODE_SUPP_SVC_CANCELLED,
1004             CODE_SUPP_SVC_REINVITE_COLLISION,
1005             CODE_IWLAN_DPD_FAILURE,
1006             CODE_EPDG_TUNNEL_ESTABLISH_FAILURE,
1007             CODE_EPDG_TUNNEL_REKEY_FAILURE,
1008             CODE_EPDG_TUNNEL_LOST_CONNECTION,
1009             CODE_MAXIMUM_NUMBER_OF_CALLS_REACHED,
1010             CODE_REMOTE_CALL_DECLINE,
1011             CODE_DATA_LIMIT_REACHED,
1012             CODE_DATA_DISABLED,
1013             CODE_WIFI_LOST,
1014             CODE_IKEV2_AUTH_FAILURE,
1015             CODE_RADIO_OFF,
1016             CODE_NO_VALID_SIM,
1017             CODE_RADIO_INTERNAL_ERROR,
1018             CODE_NETWORK_RESP_TIMEOUT,
1019             CODE_NETWORK_REJECT,
1020             CODE_RADIO_ACCESS_FAILURE,
1021             CODE_RADIO_LINK_FAILURE,
1022             CODE_RADIO_LINK_LOST,
1023             CODE_RADIO_UPLINK_FAILURE,
1024             CODE_RADIO_SETUP_FAILURE,
1025             CODE_RADIO_RELEASE_NORMAL,
1026             CODE_RADIO_RELEASE_ABNORMAL,
1027             CODE_ACCESS_CLASS_BLOCKED,
1028             CODE_NETWORK_DETACH,
1029             CODE_SIP_ALTERNATE_EMERGENCY_CALL,
1030             CODE_UNOBTAINABLE_NUMBER,
1031             CODE_NO_CSFB_IN_CS_ROAM,
1032             CODE_REJECT_UNKNOWN,
1033             CODE_REJECT_ONGOING_CALL_WAITING_DISABLED,
1034             CODE_REJECT_CALL_ON_OTHER_SUB,
1035             CODE_REJECT_1X_COLLISION,
1036             CODE_REJECT_SERVICE_NOT_REGISTERED,
1037             CODE_REJECT_CALL_TYPE_NOT_ALLOWED,
1038             CODE_REJECT_ONGOING_E911_CALL,
1039             CODE_REJECT_ONGOING_CALL_SETUP,
1040             CODE_REJECT_MAX_CALL_LIMIT_REACHED,
1041             CODE_REJECT_UNSUPPORTED_SIP_HEADERS,
1042             CODE_REJECT_UNSUPPORTED_SDP_HEADERS,
1043             CODE_REJECT_ONGOING_CALL_TRANSFER,
1044             CODE_REJECT_INTERNAL_ERROR,
1045             CODE_REJECT_QOS_FAILURE,
1046             CODE_REJECT_ONGOING_HANDOVER,
1047             CODE_REJECT_VT_TTY_NOT_ALLOWED,
1048             CODE_REJECT_ONGOING_CALL_UPGRADE,
1049             CODE_REJECT_CONFERENCE_TTY_NOT_ALLOWED,
1050             CODE_REJECT_ONGOING_CONFERENCE_CALL,
1051             CODE_REJECT_VT_AVPF_NOT_ALLOWED,
1052             CODE_REJECT_ONGOING_ENCRYPTED_CALL,
1053             CODE_REJECT_ONGOING_CS_CALL,
1054             CODE_OEM_CAUSE_1,
1055             CODE_OEM_CAUSE_2,
1056             CODE_OEM_CAUSE_3,
1057             CODE_OEM_CAUSE_4,
1058             CODE_OEM_CAUSE_5,
1059             CODE_OEM_CAUSE_6,
1060             CODE_OEM_CAUSE_7,
1061             CODE_OEM_CAUSE_8,
1062             CODE_OEM_CAUSE_9,
1063             CODE_OEM_CAUSE_10,
1064             CODE_OEM_CAUSE_11,
1065             CODE_OEM_CAUSE_12,
1066             CODE_OEM_CAUSE_13,
1067             CODE_OEM_CAUSE_14,
1068             CODE_OEM_CAUSE_15
1069     }, prefix = "CODE_")
1070     @Retention(RetentionPolicy.SOURCE)
1071     public @interface ImsCode {}
1072 
1073     /**
1074      * Network string error messages.
1075      * mExtraMessage may have these values.
1076      */
1077     public static final String EXTRA_MSG_SERVICE_NOT_AUTHORIZED
1078             = "Forbidden. Not Authorized for Service";
1079 
1080 
1081     /*
1082      * Extra codes for the specific code value
1083      * This value can be referred when the code is CODE_LOCAL_CALL_CS_RETRY_REQUIRED.
1084      */
1085     /**
1086      * An extra that may be populated when the {@link CODE_LOCAL_CALL_CS_RETRY_REQUIRED} result has
1087      * been returned.
1088      * <p>
1089      * Try to connect the call using CS
1090      */
1091     public static final int EXTRA_CODE_CALL_RETRY_NORMAL = 1;
1092     /**
1093      * An extra that may be populated when the {@link CODE_LOCAL_CALL_CS_RETRY_REQUIRED} result has
1094      * been returned.
1095      * <p>
1096      * Try to connect the call using CS and do not notify the user.
1097      */
1098     public static final int EXTRA_CODE_CALL_RETRY_SILENT_REDIAL = 2;
1099     /**
1100      * An extra that may be populated when the {@link CODE_LOCAL_CALL_CS_RETRY_REQUIRED} result has
1101      * been returned.
1102      * <p>
1103      * Try to connect the call using CS by using the settings.
1104      */
1105     public static final int EXTRA_CODE_CALL_RETRY_BY_SETTINGS = 3;
1106 
1107 
1108     // For main reason code
1109     /** @hide */
1110     @UnsupportedAppUsage
1111     public int mCode;
1112     // For the extra code value; it depends on the code value.
1113     /** @hide */
1114     @UnsupportedAppUsage
1115     public int mExtraCode;
1116     // For the additional message of the reason info.
1117     /** @hide */
1118     @UnsupportedAppUsage
1119     public String mExtraMessage;
1120 
1121     /** @hide */
ImsReasonInfo()1122     public ImsReasonInfo() {
1123         mCode = CODE_UNSPECIFIED;
1124         mExtraCode = CODE_UNSPECIFIED;
1125         mExtraMessage = null;
1126     }
1127 
ImsReasonInfo(Parcel in)1128     private ImsReasonInfo(Parcel in) {
1129         mCode = in.readInt();
1130         mExtraCode = in.readInt();
1131         mExtraMessage = in.readString();
1132     }
1133 
1134     /** @hide */
1135     @UnsupportedAppUsage
ImsReasonInfo(int code, int extraCode)1136     public ImsReasonInfo(int code, int extraCode) {
1137         mCode = code;
1138         mExtraCode = extraCode;
1139         mExtraMessage = null;
1140     }
1141 
ImsReasonInfo(int code, int extraCode, String extraMessage)1142     public ImsReasonInfo(int code, int extraCode, String extraMessage) {
1143         mCode = code;
1144         mExtraCode = extraCode;
1145         mExtraMessage = extraMessage;
1146     }
1147 
1148     /**
1149      * @return an integer representing more information about the completion of an operation.
1150      */
getCode()1151     public @ImsCode int getCode() {
1152         return mCode;
1153     }
1154 
1155     /**
1156      * @return an optional OEM specified code that provides extra information.
1157      */
getExtraCode()1158     public int getExtraCode() {
1159         return mExtraCode;
1160     }
1161 
1162     /**
1163      * @return an optional OEM specified string that provides extra information about the operation
1164      * result.
1165      */
getExtraMessage()1166     public String getExtraMessage() {
1167         return mExtraMessage;
1168     }
1169 
1170     /**
1171      * @return the string format of {@link ImsReasonInfo}
1172      */
toString()1173     public String toString() {
1174         return "ImsReasonInfo :: {" + mCode + ", " + mExtraCode + ", " + mExtraMessage + "}";
1175     }
1176 
1177     @Override
describeContents()1178     public int describeContents() {
1179         return 0;
1180     }
1181 
1182     @Override
writeToParcel(Parcel out, int flags)1183     public void writeToParcel(Parcel out, int flags) {
1184         out.writeInt(mCode);
1185         out.writeInt(mExtraCode);
1186         out.writeString(mExtraMessage);
1187     }
1188 
1189     public static final @android.annotation.NonNull Creator<ImsReasonInfo> CREATOR = new Creator<ImsReasonInfo>() {
1190         @Override
1191         public ImsReasonInfo createFromParcel(Parcel in) {
1192             return new ImsReasonInfo(in);
1193         }
1194 
1195         @Override
1196         public ImsReasonInfo[] newArray(int size) {
1197             return new ImsReasonInfo[size];
1198         }
1199     };
1200 }
1201