2 * Copyright (C) 2014 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package android.telephony;
20 * Contains disconnect call causes generated by the framework and the RIL.
23 public class DisconnectCause {
25 /** The disconnect cause is not valid (Not received a disconnect cause) */
26 public static final int NOT_VALID = -1;
27 /** Has not yet disconnected */
28 public static final int NOT_DISCONNECTED = 0;
29 /** An incoming call that was missed and never answered */
30 public static final int INCOMING_MISSED = 1;
31 /** Normal; Remote hangup*/
32 public static final int NORMAL = 2;
33 /** Normal; Local hangup */
34 public static final int LOCAL = 3;
35 /** Outgoing call to busy line */
36 public static final int BUSY = 4;
37 /** Outgoing call to congested network */
38 public static final int CONGESTION = 5;
39 /** Not presently used */
40 public static final int MMI = 6;
41 /** Invalid dial string */
42 public static final int INVALID_NUMBER = 7;
43 /** Cannot reach the peer */
44 public static final int NUMBER_UNREACHABLE = 8;
45 /** Cannot reach the server */
46 public static final int SERVER_UNREACHABLE = 9;
47 /** Invalid credentials */
48 public static final int INVALID_CREDENTIALS = 10;
49 /** Calling from out of network is not allowed */
50 public static final int OUT_OF_NETWORK = 11;
52 public static final int SERVER_ERROR = 12;
53 /** Client timed out */
54 public static final int TIMED_OUT = 13;
55 /** Client went out of network range */
56 public static final int LOST_SIGNAL = 14;
57 /** GSM or CDMA ACM limit exceeded */
58 public static final int LIMIT_EXCEEDED = 15;
59 /** An incoming call that was rejected */
60 public static final int INCOMING_REJECTED = 16;
61 /** Radio is turned off explicitly */
62 public static final int POWER_OFF = 17;
64 public static final int OUT_OF_SERVICE = 18;
65 /** No ICC, ICC locked, or other ICC error */
66 public static final int ICC_ERROR = 19;
67 /** Call was blocked by call barring */
68 public static final int CALL_BARRED = 20;
69 /** Call was blocked by fixed dial number */
70 public static final int FDN_BLOCKED = 21;
71 /** Call was blocked by restricted all voice access */
72 public static final int CS_RESTRICTED = 22;
73 /** Call was blocked by restricted normal voice access */
74 public static final int CS_RESTRICTED_NORMAL = 23;
75 /** Call was blocked by restricted emergency voice access */
76 public static final int CS_RESTRICTED_EMERGENCY = 24;
77 /** Unassigned number */
78 public static final int UNOBTAINABLE_NUMBER = 25;
79 /** MS is locked until next power cycle */
80 public static final int CDMA_LOCKED_UNTIL_POWER_CYCLE = 26;
82 public static final int CDMA_DROP = 27;
83 /** INTERCEPT order received, MS state idle entered */
84 public static final int CDMA_INTERCEPT = 28;
85 /** MS has been redirected, call is cancelled */
86 public static final int CDMA_REORDER = 29;
87 /** Service option rejection */
88 public static final int CDMA_SO_REJECT = 30;
89 /** Requested service is rejected, retry delay is set */
90 public static final int CDMA_RETRY_ORDER = 31;
91 /** Unable to obtain access to the CDMA system */
92 public static final int CDMA_ACCESS_FAILURE = 32;
93 /** Not a preempted call */
94 public static final int CDMA_PREEMPTED = 33;
95 /** Not an emergency call */
96 public static final int CDMA_NOT_EMERGENCY = 34;
97 /** Access Blocked by CDMA network */
98 public static final int CDMA_ACCESS_BLOCKED = 35;
99 /** Unknown error or not specified */
100 public static final int ERROR_UNSPECIFIED = 36;
102 * Only emergency numbers are allowed, but we tried to dial
103 * a non-emergency number.
105 // TODO: This should be the same as NOT_EMERGENCY
106 public static final int EMERGENCY_ONLY = 37;
108 * The supplied CALL Intent didn't contain a valid phone number.
110 public static final int NO_PHONE_NUMBER_SUPPLIED = 38;
112 * Our initial phone number was actually an MMI sequence.
114 public static final int DIALED_MMI = 39;
116 * We tried to call a voicemail: URI but the device has no
117 * voicemail number configured.
119 public static final int VOICEMAIL_NUMBER_MISSING = 40;
121 * This status indicates that InCallScreen should display the
122 * CDMA-specific "call lost" dialog. (If an outgoing call fails,
123 * and the CDMA "auto-retry" feature is enabled, *and* the retried
124 * call fails too, we display this specific dialog.)
126 * TODO: this is currently unused, since the "call lost" dialog
127 * needs to be triggered by a *disconnect* event, rather than when
128 * the InCallScreen first comes to the foreground. For now we use
129 * the needToShowCallLostDialog field for this (see below.)
131 public static final int CDMA_CALL_LOST = 41;
133 * This status indicates that the call was placed successfully,
134 * but additionally, the InCallScreen needs to display the
135 * "Exiting ECM" dialog.
137 * (Details: "Emergency callback mode" is a CDMA-specific concept
138 * where the phone disallows data connections over the cell
139 * network for some period of time after you make an emergency
140 * call. If the phone is in ECM and you dial a non-emergency
141 * number, that automatically *cancels* ECM, but we additionally
142 * need to warn the user that ECM has been canceled (see bug
145 * TODO: Rethink where the best place to put this is. It is not a notification
146 * of a failure of the connection -- it is an additional message that accompanies
147 * a successful connection giving the user important information about what happened.
151 public static final int EXITED_ECM = 42;
154 * The outgoing call failed with an unknown cause.
156 public static final int OUTGOING_FAILURE = 43;
159 * The outgoing call was canceled by the {@link android.telecom.ConnectionService}.
161 public static final int OUTGOING_CANCELED = 44;
164 * The call, which was an IMS call, disconnected because it merged with another call.
166 public static final int IMS_MERGED_SUCCESSFULLY = 45;
169 * Stk Call Control modified DIAL request to USSD request.
172 public static final int DIAL_MODIFIED_TO_USSD = 46;
174 * Stk Call Control modified DIAL request to SS request.
177 public static final int DIAL_MODIFIED_TO_SS = 47;
179 * Stk Call Control modified DIAL request to DIAL with modified data.
182 public static final int DIAL_MODIFIED_TO_DIAL = 48;
184 //*********************************************************************************************
185 // When adding a disconnect type:
186 // 1) Please assign the new type the next id value below.
187 // 2) Increment the next id value below to a new value.
188 // 3) Update MAXIMUM_VALID_VALUE to the new disconnect type.
189 // 4) Update toString() with the newly added disconnect type.
190 // 5) Update android.telecom.DisconnectCauseUtil with any mappings to a telecom.DisconnectCause.
193 //*********************************************************************************************
195 /** Smallest valid value for call disconnect codes. */
196 public static final int MINIMUM_VALID_VALUE = NOT_DISCONNECTED;
198 /** Largest valid value for call disconnect codes. */
199 public static final int MAXIMUM_VALID_VALUE = DIAL_MODIFIED_TO_DIAL;
201 /** Private constructor to avoid class instantiation. */
202 private DisconnectCause() {
206 /** Returns descriptive string for the specified disconnect cause. */
207 public static String toString(int cause) {
209 case NOT_DISCONNECTED:
210 return "NOT_DISCONNECTED";
211 case INCOMING_MISSED:
212 return "INCOMING_MISSED";
222 return "INVALID_NUMBER";
223 case NUMBER_UNREACHABLE:
224 return "NUMBER_UNREACHABLE";
225 case SERVER_UNREACHABLE:
226 return "SERVER_UNREACHABLE";
227 case INVALID_CREDENTIALS:
228 return "INVALID_CREDENTIALS";
230 return "OUT_OF_NETWORK";
232 return "SERVER_ERROR";
236 return "LOST_SIGNAL";
238 return "LIMIT_EXCEEDED";
239 case INCOMING_REJECTED:
240 return "INCOMING_REJECTED";
244 return "OUT_OF_SERVICE";
248 return "CALL_BARRED";
250 return "FDN_BLOCKED";
252 return "CS_RESTRICTED";
253 case CS_RESTRICTED_NORMAL:
254 return "CS_RESTRICTED_NORMAL";
255 case CS_RESTRICTED_EMERGENCY:
256 return "CS_RESTRICTED_EMERGENCY";
257 case UNOBTAINABLE_NUMBER:
258 return "UNOBTAINABLE_NUMBER";
259 case CDMA_LOCKED_UNTIL_POWER_CYCLE:
260 return "CDMA_LOCKED_UNTIL_POWER_CYCLE";
264 return "CDMA_INTERCEPT";
266 return "CDMA_REORDER";
268 return "CDMA_SO_REJECT";
269 case CDMA_RETRY_ORDER:
270 return "CDMA_RETRY_ORDER";
271 case CDMA_ACCESS_FAILURE:
272 return "CDMA_ACCESS_FAILURE";
274 return "CDMA_PREEMPTED";
275 case CDMA_NOT_EMERGENCY:
276 return "CDMA_NOT_EMERGENCY";
277 case CDMA_ACCESS_BLOCKED:
278 return "CDMA_ACCESS_BLOCKED";
280 return "EMERGENCY_ONLY";
281 case NO_PHONE_NUMBER_SUPPLIED:
282 return "NO_PHONE_NUMBER_SUPPLIED";
285 case VOICEMAIL_NUMBER_MISSING:
286 return "VOICEMAIL_NUMBER_MISSING";
288 return "CDMA_CALL_LOST";
291 case DIAL_MODIFIED_TO_USSD:
292 return "DIAL_MODIFIED_TO_USSD";
293 case DIAL_MODIFIED_TO_SS:
294 return "DIAL_MODIFIED_TO_SS";
295 case DIAL_MODIFIED_TO_DIAL:
296 return "DIAL_MODIFIED_TO_DIAL";
297 case ERROR_UNSPECIFIED:
298 return "ERROR_UNSPECIFIED";
299 case OUTGOING_FAILURE:
300 return "OUTGOING_FAILURE";
301 case OUTGOING_CANCELED:
302 return "OUTGOING_CANCELED";
303 case IMS_MERGED_SUCCESSFULLY:
304 return "IMS_MERGED_SUCCESSFULLY";
306 return "INVALID: " + cause;