• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2014 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;
18 
19 import android.annotation.SystemApi;
20 import android.annotation.UnsupportedAppUsage;
21 
22 /**
23  * Describes the cause of a disconnected call. Those disconnect causes can be converted into a more
24  * generic {@link android.telecom.DisconnectCause} object.
25  *
26  * @hide
27  */
28 @SystemApi
29 public final class DisconnectCause {
30 
31     /** The disconnect cause is not valid (Not received a disconnect cause) */
32     public static final int NOT_VALID                      = -1;
33     /** Has not yet disconnected */
34     public static final int NOT_DISCONNECTED               = 0;
35     /** An incoming call that was missed and never answered */
36     public static final int INCOMING_MISSED                = 1;
37     /** Normal; Remote hangup*/
38     public static final int NORMAL                         = 2;
39     /** Normal; Local hangup */
40     public static final int LOCAL                          = 3;
41     /** Outgoing call to busy line */
42     public static final int BUSY                           = 4;
43     /** Outgoing call to congested network */
44     public static final int CONGESTION                     = 5;
45     /** Not presently used */
46     public static final int MMI                            = 6;
47     /** Invalid dial string */
48     public static final int INVALID_NUMBER                 = 7;
49     /** Cannot reach the peer */
50     public static final int NUMBER_UNREACHABLE             = 8;
51     /** Cannot reach the server */
52     public static final int SERVER_UNREACHABLE             = 9;
53     /** Invalid credentials */
54     public static final int INVALID_CREDENTIALS            = 10;
55     /** Calling from out of network is not allowed */
56     public static final int OUT_OF_NETWORK                 = 11;
57     /** Server error */
58     public static final int SERVER_ERROR                   = 12;
59     /** Client timed out */
60     public static final int TIMED_OUT                      = 13;
61     /** Client went out of network range */
62     public static final int LOST_SIGNAL                    = 14;
63     /** GSM or CDMA ACM limit exceeded */
64     public static final int LIMIT_EXCEEDED                 = 15;
65     /** An incoming call that was rejected */
66     public static final int INCOMING_REJECTED              = 16;
67     /** Radio is turned off explicitly */
68     public static final int POWER_OFF                      = 17;
69     /** Out of service */
70     public static final int OUT_OF_SERVICE                 = 18;
71     /** No ICC, ICC locked, or other ICC error */
72     public static final int ICC_ERROR                      = 19;
73     /** Call was blocked by call barring */
74     public static final int CALL_BARRED                    = 20;
75     /** Call was blocked by fixed dial number */
76     public static final int FDN_BLOCKED                    = 21;
77     /** Call was blocked by restricted all voice access */
78     public static final int CS_RESTRICTED                  = 22;
79     /** Call was blocked by restricted normal voice access */
80     public static final int CS_RESTRICTED_NORMAL           = 23;
81     /** Call was blocked by restricted emergency voice access */
82     public static final int CS_RESTRICTED_EMERGENCY        = 24;
83     /** Unassigned number */
84     public static final int UNOBTAINABLE_NUMBER            = 25;
85     /** MS is locked until next power cycle */
86     public static final int CDMA_LOCKED_UNTIL_POWER_CYCLE  = 26;
87     /** Drop call*/
88     public static final int CDMA_DROP                      = 27;
89     /** INTERCEPT order received, MS state idle entered */
90     public static final int CDMA_INTERCEPT                 = 28;
91     /** MS has been redirected, call is cancelled */
92     public static final int CDMA_REORDER                   = 29;
93     /** Service option rejection */
94     public static final int CDMA_SO_REJECT                 = 30;
95     /** Requested service is rejected, retry delay is set */
96     public static final int CDMA_RETRY_ORDER               = 31;
97     /** Unable to obtain access to the CDMA system */
98     public static final int CDMA_ACCESS_FAILURE            = 32;
99     /** Not a preempted call */
100     public static final int CDMA_PREEMPTED                 = 33;
101     /** Not an emergency call */
102     public static final int CDMA_NOT_EMERGENCY             = 34;
103     /** Access Blocked by CDMA network */
104     public static final int CDMA_ACCESS_BLOCKED            = 35;
105     /** Unknown error or not specified */
106     public static final int ERROR_UNSPECIFIED              = 36;
107     /**
108      * Only emergency numbers are allowed, but we tried to dial a non-emergency number.
109      * @hide
110      */
111     // TODO: This should be the same as NOT_EMERGENCY
112     public static final int EMERGENCY_ONLY                 = 37;
113     /**
114      * The supplied CALL Intent didn't contain a valid phone number.
115      */
116     public static final int NO_PHONE_NUMBER_SUPPLIED       = 38;
117     /**
118      * Our initial phone number was actually an MMI sequence.
119      */
120     public static final int DIALED_MMI                     = 39;
121     /**
122      * We tried to call a voicemail: URI but the device has no voicemail number configured.
123      */
124     public static final int VOICEMAIL_NUMBER_MISSING       = 40;
125     /**
126      * This status indicates that InCallScreen should display the
127      * CDMA-specific "call lost" dialog.  (If an outgoing call fails,
128      * and the CDMA "auto-retry" feature is enabled, *and* the retried
129      * call fails too, we display this specific dialog.)
130      *
131      * TODO: this is currently unused, since the "call lost" dialog
132      * needs to be triggered by a *disconnect* event, rather than when
133      * the InCallScreen first comes to the foreground.  For now we use
134      * the needToShowCallLostDialog field for this (see below.)
135      *
136      * @hide
137      */
138     public static final int CDMA_CALL_LOST                 = 41;
139     /**
140      * This status indicates that the call was placed successfully,
141      * but additionally, the InCallScreen needs to display the
142      * "Exiting ECM" dialog.
143      *
144      * (Details: "Emergency callback mode" is a CDMA-specific concept
145      * where the phone disallows data connections over the cell
146      * network for some period of time after you make an emergency
147      * call.  If the phone is in ECM and you dial a non-emergency
148      * number, that automatically *cancels* ECM, but we additionally
149      * need to warn the user that ECM has been canceled (see bug
150      * 4207607.))
151      *
152      * TODO: Rethink where the best place to put this is. It is not a notification
153      * of a failure of the connection -- it is an additional message that accompanies
154      * a successful connection giving the user important information about what happened.
155      *
156      * {@hide}
157      */
158     public static final int EXITED_ECM                     = 42;
159 
160     /**
161      * The outgoing call failed with an unknown cause.
162      */
163     public static final int OUTGOING_FAILURE               = 43;
164 
165     /**
166      * The outgoing call was canceled by the {@link android.telecom.ConnectionService}.
167      */
168     public static final int OUTGOING_CANCELED              = 44;
169 
170     /**
171      * The call, which was an IMS call, disconnected because it merged with another call.
172      */
173     public static final int IMS_MERGED_SUCCESSFULLY        = 45;
174 
175     /**
176      * Stk Call Control modified DIAL request to USSD request.
177      */
178     public static final int DIAL_MODIFIED_TO_USSD          = 46;
179     /**
180      * Stk Call Control modified DIAL request to SS request.
181      */
182     public static final int DIAL_MODIFIED_TO_SS            = 47;
183     /**
184      * Stk Call Control modified DIAL request to DIAL with modified data.
185      */
186     public static final int DIAL_MODIFIED_TO_DIAL          = 48;
187 
188     /**
189      * The call was terminated because CDMA phone service and roaming have already been activated.
190      */
191     public static final int CDMA_ALREADY_ACTIVATED         = 49;
192 
193     /**
194      * The call was terminated because it is not possible to place a video call while TTY is
195      * enabled.
196      */
197     public static final int VIDEO_CALL_NOT_ALLOWED_WHILE_TTY_ENABLED = 50;
198 
199     /**
200      * The call was terminated because it was pulled to another device.
201      */
202     public static final int CALL_PULLED = 51;
203 
204     /**
205      * The call was terminated because it was answered on another device.
206      */
207     public static final int ANSWERED_ELSEWHERE = 52;
208 
209     /**
210      * The call was terminated because the maximum allowable number of calls has been reached.
211      */
212     public static final int MAXIMUM_NUMBER_OF_CALLS_REACHED = 53;
213 
214     /**
215      * The call was terminated because cellular data has been disabled.
216      * Used when in a video call and the user disables cellular data via the settings.
217      */
218     public static final int DATA_DISABLED = 54;
219 
220     /**
221      * The call was terminated because the data policy has disabled cellular data.
222      * Used when in a video call and the user has exceeded the device data limit.
223      */
224     public static final int DATA_LIMIT_REACHED = 55;
225 
226     /**
227      * The call being placed was detected as a call forwarding number and was being dialed while
228      * roaming on a carrier that does not allow this.
229      */
230     public static final int DIALED_CALL_FORWARDING_WHILE_ROAMING = 57;
231 
232     /**
233      * The network does not accept the emergency call request because IMEI was used as
234      * identification and this cability is not supported by the network.
235      */
236     public static final int IMEI_NOT_ACCEPTED = 58;
237 
238     /**
239      * A call over WIFI was disconnected because the WIFI signal was lost or became too degraded to
240      * continue the call.
241      */
242     public static final int WIFI_LOST = 59;
243 
244     /**
245      * The call has failed because of access class barring.
246      */
247     public static final int IMS_ACCESS_BLOCKED = 60;
248 
249     /**
250      * The call has ended (mid-call) because the device's battery is too low.
251      */
252     public static final int LOW_BATTERY = 61;
253 
254     /**
255      * A call was not dialed because the device's battery is too low.
256      */
257     public static final int DIAL_LOW_BATTERY = 62;
258 
259     /**
260      * Emergency call failed with a temporary fail cause and can be redialed on this slot.
261      */
262     public static final int EMERGENCY_TEMP_FAILURE = 63;
263 
264     /**
265      * Emergency call failed with a permanent fail cause and should not be redialed on this
266      * slot.
267      */
268     public static final int EMERGENCY_PERM_FAILURE = 64;
269 
270     /**
271      * This cause is used to report a normal event only when no other cause in the normal class
272      * applies.
273      */
274     public static final int NORMAL_UNSPECIFIED = 65;
275 
276     /**
277      * Stk Call Control modified DIAL request to video DIAL request.
278      */
279     public static final int DIAL_MODIFIED_TO_DIAL_VIDEO = 66;
280 
281     /**
282      * Stk Call Control modified Video DIAL request to SS request.
283      */
284     public static final int DIAL_VIDEO_MODIFIED_TO_SS = 67;
285 
286     /**
287      * Stk Call Control modified Video DIAL request to USSD request.
288      */
289     public static final int DIAL_VIDEO_MODIFIED_TO_USSD = 68;
290 
291     /**
292      * Stk Call Control modified Video DIAL request to DIAL request.
293      */
294     public static final int DIAL_VIDEO_MODIFIED_TO_DIAL = 69;
295 
296     /**
297      * Stk Call Control modified Video DIAL request to Video DIAL request.
298      */
299     public static final int DIAL_VIDEO_MODIFIED_TO_DIAL_VIDEO = 70;
300 
301     /**
302      * The network has reported that an alternative emergency number has been dialed, but the user
303      * must exit airplane mode to place the call.
304      */
305     public static final int IMS_SIP_ALTERNATE_EMERGENCY_CALL = 71;
306 
307     /**
308      * Indicates that a new outgoing call cannot be placed because there is already an outgoing
309      * call dialing out.
310      */
311     public static final int ALREADY_DIALING = 72;
312 
313     /**
314      * Indicates that a new outgoing call cannot be placed while there is a ringing call.
315      */
316     public static final int CANT_CALL_WHILE_RINGING = 73;
317 
318     /**
319      * Indicates that a new outgoing call cannot be placed because calling has been disabled using
320      * the ro.telephony.disable-call system property.
321      */
322     public static final int CALLING_DISABLED = 74;
323 
324     /**
325      * Indicates that a new outgoing call cannot be placed because there is currently an ongoing
326      * foreground and background call.
327      */
328     public static final int TOO_MANY_ONGOING_CALLS = 75;
329 
330     /**
331      * Indicates that a new outgoing call cannot be placed because OTASP provisioning is currently
332      * in process.
333      */
334     public static final int OTASP_PROVISIONING_IN_PROCESS = 76;
335 
336     //*********************************************************************************************
337     // When adding a disconnect type:
338     // 1) Update toString() with the newly added disconnect type.
339     // 2) Update android.telecom.DisconnectCauseUtil with any mappings to a telecom.DisconnectCause.
340     //*********************************************************************************************
341 
342     /** Private constructor to avoid class instantiation. */
DisconnectCause()343     private DisconnectCause() {
344         // Do nothing.
345     }
346 
347     /**
348      * Returns descriptive string for the specified disconnect cause.
349      * @hide
350      */
351     @UnsupportedAppUsage
toString(int cause)352     public static String toString(int cause) {
353         switch (cause) {
354         case NOT_DISCONNECTED:
355             return "NOT_DISCONNECTED";
356         case INCOMING_MISSED:
357             return "INCOMING_MISSED";
358         case NORMAL:
359             return "NORMAL";
360         case LOCAL:
361             return "LOCAL";
362         case BUSY:
363             return "BUSY";
364         case CONGESTION:
365             return "CONGESTION";
366         case INVALID_NUMBER:
367             return "INVALID_NUMBER";
368         case NUMBER_UNREACHABLE:
369             return "NUMBER_UNREACHABLE";
370         case SERVER_UNREACHABLE:
371             return "SERVER_UNREACHABLE";
372         case INVALID_CREDENTIALS:
373             return "INVALID_CREDENTIALS";
374         case OUT_OF_NETWORK:
375             return "OUT_OF_NETWORK";
376         case SERVER_ERROR:
377             return "SERVER_ERROR";
378         case TIMED_OUT:
379             return "TIMED_OUT";
380         case LOST_SIGNAL:
381             return "LOST_SIGNAL";
382         case LIMIT_EXCEEDED:
383             return "LIMIT_EXCEEDED";
384         case INCOMING_REJECTED:
385             return "INCOMING_REJECTED";
386         case POWER_OFF:
387             return "POWER_OFF";
388         case OUT_OF_SERVICE:
389             return "OUT_OF_SERVICE";
390         case ICC_ERROR:
391             return "ICC_ERROR";
392         case CALL_BARRED:
393             return "CALL_BARRED";
394         case FDN_BLOCKED:
395             return "FDN_BLOCKED";
396         case CS_RESTRICTED:
397             return "CS_RESTRICTED";
398         case CS_RESTRICTED_NORMAL:
399             return "CS_RESTRICTED_NORMAL";
400         case CS_RESTRICTED_EMERGENCY:
401             return "CS_RESTRICTED_EMERGENCY";
402         case UNOBTAINABLE_NUMBER:
403             return "UNOBTAINABLE_NUMBER";
404         case CDMA_LOCKED_UNTIL_POWER_CYCLE:
405             return "CDMA_LOCKED_UNTIL_POWER_CYCLE";
406         case CDMA_DROP:
407             return "CDMA_DROP";
408         case CDMA_INTERCEPT:
409             return "CDMA_INTERCEPT";
410         case CDMA_REORDER:
411             return "CDMA_REORDER";
412         case CDMA_SO_REJECT:
413             return "CDMA_SO_REJECT";
414         case CDMA_RETRY_ORDER:
415             return "CDMA_RETRY_ORDER";
416         case CDMA_ACCESS_FAILURE:
417             return "CDMA_ACCESS_FAILURE";
418         case CDMA_PREEMPTED:
419             return "CDMA_PREEMPTED";
420         case CDMA_NOT_EMERGENCY:
421             return "CDMA_NOT_EMERGENCY";
422         case CDMA_ACCESS_BLOCKED:
423             return "CDMA_ACCESS_BLOCKED";
424         case EMERGENCY_ONLY:
425             return "EMERGENCY_ONLY";
426         case NO_PHONE_NUMBER_SUPPLIED:
427             return "NO_PHONE_NUMBER_SUPPLIED";
428         case DIALED_MMI:
429             return "DIALED_MMI";
430         case VOICEMAIL_NUMBER_MISSING:
431             return "VOICEMAIL_NUMBER_MISSING";
432         case CDMA_CALL_LOST:
433             return "CDMA_CALL_LOST";
434         case EXITED_ECM:
435             return "EXITED_ECM";
436         case DIAL_MODIFIED_TO_USSD:
437             return "DIAL_MODIFIED_TO_USSD";
438         case DIAL_MODIFIED_TO_SS:
439             return "DIAL_MODIFIED_TO_SS";
440         case DIAL_MODIFIED_TO_DIAL:
441             return "DIAL_MODIFIED_TO_DIAL";
442         case DIAL_MODIFIED_TO_DIAL_VIDEO:
443             return "DIAL_MODIFIED_TO_DIAL_VIDEO";
444         case DIAL_VIDEO_MODIFIED_TO_SS:
445             return "DIAL_VIDEO_MODIFIED_TO_SS";
446         case DIAL_VIDEO_MODIFIED_TO_USSD:
447             return "DIAL_VIDEO_MODIFIED_TO_USSD";
448         case DIAL_VIDEO_MODIFIED_TO_DIAL:
449             return "DIAL_VIDEO_MODIFIED_TO_DIAL";
450         case DIAL_VIDEO_MODIFIED_TO_DIAL_VIDEO:
451             return "DIAL_VIDEO_MODIFIED_TO_DIAL_VIDEO";
452         case ERROR_UNSPECIFIED:
453             return "ERROR_UNSPECIFIED";
454         case OUTGOING_FAILURE:
455             return "OUTGOING_FAILURE";
456         case OUTGOING_CANCELED:
457             return "OUTGOING_CANCELED";
458         case IMS_MERGED_SUCCESSFULLY:
459             return "IMS_MERGED_SUCCESSFULLY";
460         case CDMA_ALREADY_ACTIVATED:
461             return "CDMA_ALREADY_ACTIVATED";
462         case VIDEO_CALL_NOT_ALLOWED_WHILE_TTY_ENABLED:
463             return "VIDEO_CALL_NOT_ALLOWED_WHILE_TTY_ENABLED";
464         case CALL_PULLED:
465             return "CALL_PULLED";
466         case ANSWERED_ELSEWHERE:
467             return "ANSWERED_ELSEWHERE";
468         case MAXIMUM_NUMBER_OF_CALLS_REACHED:
469             return "MAXIMUM_NUMER_OF_CALLS_REACHED";
470         case DATA_DISABLED:
471             return "DATA_DISABLED";
472         case DATA_LIMIT_REACHED:
473             return "DATA_LIMIT_REACHED";
474         case DIALED_CALL_FORWARDING_WHILE_ROAMING:
475             return "DIALED_CALL_FORWARDING_WHILE_ROAMING";
476         case IMEI_NOT_ACCEPTED:
477             return "IMEI_NOT_ACCEPTED";
478         case WIFI_LOST:
479             return "WIFI_LOST";
480         case IMS_ACCESS_BLOCKED:
481             return "IMS_ACCESS_BLOCKED";
482         case LOW_BATTERY:
483             return "LOW_BATTERY";
484         case DIAL_LOW_BATTERY:
485             return "DIAL_LOW_BATTERY";
486         case EMERGENCY_TEMP_FAILURE:
487             return "EMERGENCY_TEMP_FAILURE";
488         case EMERGENCY_PERM_FAILURE:
489             return "EMERGENCY_PERM_FAILURE";
490         case NORMAL_UNSPECIFIED:
491             return "NORMAL_UNSPECIFIED";
492         case IMS_SIP_ALTERNATE_EMERGENCY_CALL:
493             return "IMS_SIP_ALTERNATE_EMERGENCY_CALL";
494         case ALREADY_DIALING:
495             return "ALREADY_DIALING";
496         case CANT_CALL_WHILE_RINGING:
497             return "CANT_CALL_WHILE_RINGING";
498         case CALLING_DISABLED:
499             return "CALLING_DISABLED";
500         case TOO_MANY_ONGOING_CALLS:
501             return "TOO_MANY_ONGOING_CALLS";
502         case OTASP_PROVISIONING_IN_PROCESS:
503             return "OTASP_PROVISIONING_IN_PROCESS";
504         default:
505             return "INVALID: " + cause;
506         }
507     }
508 }
509