blob: 96289158cc0553e271a0dcfec664c768b3e99ea4 [file] [log] [blame]
Wink Savillef8458ff2014-06-25 16:08:02 -07001/*
2 * Copyright (c) 2013 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.ims;
18
19import android.os.Parcel;
20import android.os.Parcelable;
21
22/**
23 * This class enables an application to get details on why a method call failed.
24 *
25 * @hide
26 */
27public class ImsReasonInfo implements Parcelable {
Wink Savillef8458ff2014-06-25 16:08:02 -070028 /**
29 * Specific code of each types
30 */
31 public static final int CODE_UNSPECIFIED = 0;
32
33 /**
34 * LOCAL
35 */
36 // IMS -> Telephony
37 // The passed argument is an invalid
38 public static final int CODE_LOCAL_ILLEGAL_ARGUMENT = 101;
39 // The operation is invoked in invalid call state
40 public static final int CODE_LOCAL_ILLEGAL_STATE = 102;
41 // IMS service internal error
42 public static final int CODE_LOCAL_INTERNAL_ERROR = 103;
43 // IMS service goes down (service connection is lost)
44 public static final int CODE_LOCAL_IMS_SERVICE_DOWN = 106;
45 // No pending incoming call exists
46 public static final int CODE_LOCAL_NO_PENDING_CALL = 107;
47
48 // IMS -> Telephony
49 // Service unavailable; by power off
50 public static final int CODE_LOCAL_POWER_OFF = 111;
51 // Service unavailable; by low battery
52 public static final int CODE_LOCAL_LOW_BATTERY = 112;
53 // Service unavailable; by out of service (data service state)
54 public static final int CODE_LOCAL_NETWORK_NO_SERVICE = 121;
55 // Service unavailable; by no LTE coverage
56 // (VoLTE is not supported even though IMS is registered)
57 public static final int CODE_LOCAL_NETWORK_NO_LTE_COVERAGE = 122;
58 // Service unavailable; by located in roaming area
59 public static final int CODE_LOCAL_NETWORK_ROAMING = 123;
60 // Service unavailable; by IP changed
61 public static final int CODE_LOCAL_NETWORK_IP_CHANGED = 124;
62 // Service unavailable; other
63 public static final int CODE_LOCAL_SERVICE_UNAVAILABLE = 131;
64 // Service unavailable; IMS connection is lost (IMS is not registered)
65 public static final int CODE_LOCAL_NOT_REGISTERED = 132;
66
67 // IMS <-> Telephony
68 // Max call exceeded
69 public static final int CODE_LOCAL_CALL_EXCEEDED = 141;
70 // IMS <- Telephony
71 // Call busy
72 public static final int CODE_LOCAL_CALL_BUSY = 142;
73 // Call decline
74 public static final int CODE_LOCAL_CALL_DECLINE = 143;
75 // IMS -> Telephony
76 // SRVCC is in progress
77 public static final int CODE_LOCAL_CALL_VCC_ON_PROGRESSING = 144;
78 // Resource reservation is failed (QoS precondition)
79 public static final int CODE_LOCAL_CALL_RESOURCE_RESERVATION_FAILED = 145;
80 // Retry CS call; VoLTE service can't be provided by the network or remote end
81 // Resolve the extra code(EXTRA_CODE_CALL_RETRY_*) if the below code is set
82 public static final int CODE_LOCAL_CALL_CS_RETRY_REQUIRED = 146;
83 // Retry VoLTE call; VoLTE service can't be provided by the network temporarily
84 public static final int CODE_LOCAL_CALL_VOLTE_RETRY_REQUIRED = 147;
85 // IMS call is already terminated (in TERMINATED state)
86 public static final int CODE_LOCAL_CALL_TERMINATED = 148;
87
88 /**
89 * TIMEOUT (IMS -> Telephony)
90 */
91 // 1xx waiting timer is expired after sending INVITE request (MO only)
92 public static final int CODE_TIMEOUT_1XX_WAITING = 201;
93 // User no answer during call setup operation (MO/MT)
94 // MO : 200 OK to INVITE request is not received,
95 // MT : No action from user after alerting the call
96 public static final int CODE_TIMEOUT_NO_ANSWER = 202;
97 // User no answer during call update operation (MO/MT)
98 // MO : 200 OK to re-INVITE request is not received,
99 // MT : No action from user after alerting the call
100 public static final int CODE_TIMEOUT_NO_ANSWER_CALL_UPDATE = 203;
101
102 /**
103 * STATUSCODE (SIP response code) (IMS -> Telephony)
104 */
105 // 3xx responses
106 // SIP request is redirected
107 public static final int CODE_SIP_REDIRECTED = 321;
108 // 4xx responses
109 // 400 : Bad Request
110 public static final int CODE_SIP_BAD_REQUEST = 331;
111 // 403 : Forbidden
112 public static final int CODE_SIP_FORBIDDEN = 332;
113 // 404 : Not Found
114 public static final int CODE_SIP_NOT_FOUND = 333;
115 // 415 : Unsupported Media Type
116 // 416 : Unsupported URI Scheme
117 // 420 : Bad Extension
118 public static final int CODE_SIP_NOT_SUPPORTED = 334;
119 // 408 : Request Timeout
120 public static final int CODE_SIP_REQUEST_TIMEOUT = 335;
121 // 480 : Temporarily Unavailable
122 public static final int CODE_SIP_TEMPRARILY_UNAVAILABLE = 336;
123 // 484 : Address Incomplete
124 public static final int CODE_SIP_BAD_ADDRESS = 337;
125 // 486 : Busy Here
126 // 600 : Busy Everywhere
127 public static final int CODE_SIP_BUSY = 338;
128 // 487 : Request Terminated
129 public static final int CODE_SIP_REQUEST_CANCELLED = 339;
130 // 406 : Not Acceptable
131 // 488 : Not Acceptable Here
132 // 606 : Not Acceptable
133 public static final int CODE_SIP_NOT_ACCEPTABLE = 340;
134 // 410 : Gone
135 // 604 : Does Not Exist Anywhere
136 public static final int CODE_SIP_NOT_REACHABLE = 341;
137 // Others
138 public static final int CODE_SIP_CLIENT_ERROR = 342;
139 // 5xx responses
140 // 501 : Server Internal Error
141 public static final int CODE_SIP_SERVER_INTERNAL_ERROR = 351;
142 // 503 : Service Unavailable
143 public static final int CODE_SIP_SERVICE_UNAVAILABLE = 352;
144 // 504 : Server Time-out
145 public static final int CODE_SIP_SERVER_TIMEOUT = 353;
146 // Others
147 public static final int CODE_SIP_SERVER_ERROR = 354;
148 // 6xx responses
149 // 603 : Decline
150 public static final int CODE_SIP_USER_REJECTED = 361;
151 // Others
152 public static final int CODE_SIP_GLOBAL_ERROR = 362;
153
154 /**
155 * MEDIA (IMS -> Telephony)
156 */
157 // Media resource initialization failed
158 public static final int CODE_MEDIA_INIT_FAILED = 401;
159 // RTP timeout (no audio / video traffic in the session)
160 public static final int CODE_MEDIA_NO_DATA = 402;
161 // Media is not supported; so dropped the call
162 public static final int CODE_MEDIA_NOT_ACCEPTABLE = 403;
163 // Unknown media related errors
164 public static final int CODE_MEDIA_UNSPECIFIED = 404;
165
166 /**
167 * USER
168 */
169 // Telephony -> IMS
170 // User triggers the call end
171 public static final int CODE_USER_TERMINATED = 501;
172 // No action while an incoming call is ringing
173 public static final int CODE_USER_NOANSWER = 502;
174 // User ignores an incoming call
175 public static final int CODE_USER_IGNORE = 503;
176 // User declines an incoming call
177 public static final int CODE_USER_DECLINE = 504;
Omkar Kolangade93c33d72014-12-01 16:23:25 -0800178 // Device declines/ends a call due to low battery
179 public static final int CODE_LOW_BATTERY = 505;
180 // Device declines call due to blacklisted call ID
181 public static final int CODE_BLACKLISTED_CALL_ID = 506;
Wink Savillef8458ff2014-06-25 16:08:02 -0700182 // IMS -> Telephony
183 // The call is terminated by the network or remote user
184 public static final int CODE_USER_TERMINATED_BY_REMOTE = 510;
185
186 /**
187 * Extra codes for the specific code value
188 * This value can be referred when the code is CODE_LOCAL_CALL_CS_RETRY_REQUIRED.
189 */
190 // Try to connect CS call; normal
191 public static final int EXTRA_CODE_CALL_RETRY_NORMAL = 1;
192 // Try to connect CS call without the notification to user
193 public static final int EXTRA_CODE_CALL_RETRY_SILENT_REDIAL = 2;
194 // Try to connect CS call by the settings of the menu
195 public static final int EXTRA_CODE_CALL_RETRY_BY_SETTINGS = 3;
196
197 /**
198 * UT
199 */
200 public static final int CODE_UT_NOT_SUPPORTED = 801;
201 public static final int CODE_UT_SERVICE_UNAVAILABLE = 802;
202 public static final int CODE_UT_OPERATION_NOT_ALLOWED = 803;
Shriram Ganesh61aac3a2014-07-08 18:48:35 -0700203 public static final int CODE_UT_NETWORK_ERROR = 804;
Wink Savillef8458ff2014-06-25 16:08:02 -0700204 public static final int CODE_UT_CB_PASSWORD_MISMATCH = 821;
205
Uma Maheswari Ramalingam1c182852014-07-31 15:54:52 -0700206 /**
207 * ECBM
208 */
209 public static final int CODE_ECBM_NOT_SUPPORTED = 901;
Wink Savillef8458ff2014-06-25 16:08:02 -0700210
Omkar Kolangade827fcb72014-12-03 18:35:10 -0800211 /**
Rekha Kumarb54d2182015-02-24 11:45:36 -0800212 * Ims Registration error code
213 */
214 public static final int CODE_REGISTRATION_ERROR = 1000;
215
216 /**
217 * CALL DROP error codes (Call could drop because of many reasons like Network not available,
218 * handover, failed, etc)
219 */
220
221 /**
222 * CALL DROP error code for the case when a device is ePDG capable and when the user is on an
223 * active wifi call and at the edge of coverage and there is no qualified LTE network available
224 * to handover the call to. We get a handover NOT_TRIGERRED message from the modem. This error
225 * code is received as part of the handover message.
226 */
227 public static final int CODE_CALL_DROP_IWLAN_TO_LTE_UNAVAILABLE = 1100;
228
229 /**
Omkar Kolangade827fcb72014-12-03 18:35:10 -0800230 * Network string error messages.
231 * mExtraMessage may have these values.
232 */
233 public static final String EXTRA_MSG_SERVICE_NOT_AUTHORIZED
234 = "Forbidden. Not Authorized for Service";
235
Wink Savillef8458ff2014-06-25 16:08:02 -0700236 // For main reason code
237 public int mCode;
238 // For the extra code value; it depends on the code value.
239 public int mExtraCode;
240 // For the additional message of the reason info.
241 public String mExtraMessage;
Wink Savillef8458ff2014-06-25 16:08:02 -0700242 public ImsReasonInfo() {
Wink Savillef8458ff2014-06-25 16:08:02 -0700243 mCode = CODE_UNSPECIFIED;
244 mExtraCode = CODE_UNSPECIFIED;
245 mExtraMessage = null;
246 }
247
248 public ImsReasonInfo(Parcel in) {
249 readFromParcel(in);
250 }
251
252 public ImsReasonInfo(int code, int extraCode) {
Wink Savillef8458ff2014-06-25 16:08:02 -0700253 mCode = code;
254 mExtraCode = extraCode;
255 mExtraMessage = null;
256 }
257
258 public ImsReasonInfo(int code, int extraCode, String extraMessage) {
Wink Savillef8458ff2014-06-25 16:08:02 -0700259 mCode = code;
260 mExtraCode = extraCode;
261 mExtraMessage = extraMessage;
262 }
263
264 /**
265 *
266 */
267 public int getCode() {
268 return mCode;
269 }
270
271 /**
272 *
273 */
274 public int getExtraCode() {
275 return mExtraCode;
276 }
277
278 /**
279 *
280 */
281 public String getExtraMessage() {
282 return mExtraMessage;
283 }
284
285 /**
Wink Savillef8458ff2014-06-25 16:08:02 -0700286 * Returns the string format of {@link ImsReasonInfo}
287 *
288 * @return the string format of {@link ImsReasonInfo}
289 */
290 public String toString() {
Rekha Kumarb54d2182015-02-24 11:45:36 -0800291 return "ImsReasonInfo :: {" + mCode + ", " + mExtraCode + ", " + mExtraMessage + "}";
Wink Savillef8458ff2014-06-25 16:08:02 -0700292 }
293
294 @Override
295 public int describeContents() {
296 return 0;
297 }
298
299 @Override
300 public void writeToParcel(Parcel out, int flags) {
Wink Savillef8458ff2014-06-25 16:08:02 -0700301 out.writeInt(mCode);
302 out.writeInt(mExtraCode);
303 out.writeString(mExtraMessage);
304 }
305
306 private void readFromParcel(Parcel in) {
Wink Savillef8458ff2014-06-25 16:08:02 -0700307 mCode = in.readInt();
308 mExtraCode = in.readInt();
309 mExtraMessage = in.readString();
310 }
311
312 public static final Creator<ImsReasonInfo> CREATOR = new Creator<ImsReasonInfo>() {
313 @Override
314 public ImsReasonInfo createFromParcel(Parcel in) {
315 return new ImsReasonInfo(in);
316 }
317
318 @Override
319 public ImsReasonInfo[] newArray(int size) {
320 return new ImsReasonInfo[size];
321 }
322 };
323}