ImsReasonInfo.java revision 87f208b3b3bc873c46800d77c42e285cfb586e95
1/*
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 {
28
29    /**
30     * Specific code of each types
31     */
32    public static final int CODE_UNSPECIFIED = 0;
33
34    /**
35     * LOCAL
36     */
37    // IMS -> Telephony
38    // The passed argument is an invalid
39    public static final int CODE_LOCAL_ILLEGAL_ARGUMENT = 101;
40    // The operation is invoked in invalid call state
41    public static final int CODE_LOCAL_ILLEGAL_STATE = 102;
42    // IMS service internal error
43    public static final int CODE_LOCAL_INTERNAL_ERROR = 103;
44    // IMS service goes down (service connection is lost)
45    public static final int CODE_LOCAL_IMS_SERVICE_DOWN = 106;
46    // No pending incoming call exists
47    public static final int CODE_LOCAL_NO_PENDING_CALL = 107;
48
49    // IMS -> Telephony
50    // Service unavailable; by power off
51    public static final int CODE_LOCAL_POWER_OFF = 111;
52    // Service unavailable; by low battery
53    public static final int CODE_LOCAL_LOW_BATTERY = 112;
54    // Service unavailable; by out of service (data service state)
55    public static final int CODE_LOCAL_NETWORK_NO_SERVICE = 121;
56    // Service unavailable; by no LTE coverage
57    // (VoLTE is not supported even though IMS is registered)
58    public static final int CODE_LOCAL_NETWORK_NO_LTE_COVERAGE = 122;
59    // Service unavailable; by located in roaming area
60    public static final int CODE_LOCAL_NETWORK_ROAMING = 123;
61    // Service unavailable; by IP changed
62    public static final int CODE_LOCAL_NETWORK_IP_CHANGED = 124;
63    // Service unavailable; other
64    public static final int CODE_LOCAL_SERVICE_UNAVAILABLE = 131;
65    // Service unavailable; IMS connection is lost (IMS is not registered)
66    public static final int CODE_LOCAL_NOT_REGISTERED = 132;
67
68    // IMS <-> Telephony
69    // Max call exceeded
70    public static final int CODE_LOCAL_CALL_EXCEEDED = 141;
71    // IMS <- Telephony
72    // Call busy
73    public static final int CODE_LOCAL_CALL_BUSY = 142;
74    // Call decline
75    public static final int CODE_LOCAL_CALL_DECLINE = 143;
76    // IMS -> Telephony
77    // SRVCC is in progress
78    public static final int CODE_LOCAL_CALL_VCC_ON_PROGRESSING = 144;
79    // Resource reservation is failed (QoS precondition)
80    public static final int CODE_LOCAL_CALL_RESOURCE_RESERVATION_FAILED = 145;
81    // Retry CS call; VoLTE service can't be provided by the network or remote end
82    // Resolve the extra code(EXTRA_CODE_CALL_RETRY_*) if the below code is set
83    public static final int CODE_LOCAL_CALL_CS_RETRY_REQUIRED = 146;
84    // Retry VoLTE call; VoLTE service can't be provided by the network temporarily
85    public static final int CODE_LOCAL_CALL_VOLTE_RETRY_REQUIRED = 147;
86    // IMS call is already terminated (in TERMINATED state)
87    public static final int CODE_LOCAL_CALL_TERMINATED = 148;
88    // Handover not feasible
89    public static final int CODE_LOCAL_HO_NOT_FEASIBLE = 149;
90
91    /**
92     * TIMEOUT (IMS -> Telephony)
93     */
94    // 1xx waiting timer is expired after sending INVITE request (MO only)
95    public static final int CODE_TIMEOUT_1XX_WAITING = 201;
96    // User no answer during call setup operation (MO/MT)
97    // MO : 200 OK to INVITE request is not received,
98    // MT : No action from user after alerting the call
99    public static final int CODE_TIMEOUT_NO_ANSWER = 202;
100    // User no answer during call update operation (MO/MT)
101    // MO : 200 OK to re-INVITE request is not received,
102    // MT : No action from user after alerting the call
103    public static final int CODE_TIMEOUT_NO_ANSWER_CALL_UPDATE = 203;
104
105    //Call failures for FDN
106    public static final int CODE_FDN_BLOCKED = 241;
107
108    /**
109     * STATUSCODE (SIP response code) (IMS -> Telephony)
110     */
111    // 3xx responses
112    // SIP request is redirected
113    public static final int CODE_SIP_REDIRECTED = 321;
114    // 4xx responses
115    // 400 : Bad Request
116    public static final int CODE_SIP_BAD_REQUEST = 331;
117    // 403 : Forbidden
118    public static final int CODE_SIP_FORBIDDEN = 332;
119    // 404 : Not Found
120    public static final int CODE_SIP_NOT_FOUND = 333;
121    // 415 : Unsupported Media Type
122    // 416 : Unsupported URI Scheme
123    // 420 : Bad Extension
124    public static final int CODE_SIP_NOT_SUPPORTED = 334;
125    // 408 : Request Timeout
126    public static final int CODE_SIP_REQUEST_TIMEOUT = 335;
127    // 480 : Temporarily Unavailable
128    public static final int CODE_SIP_TEMPRARILY_UNAVAILABLE = 336;
129    // 484 : Address Incomplete
130    public static final int CODE_SIP_BAD_ADDRESS = 337;
131    // 486 : Busy Here
132    // 600 : Busy Everywhere
133    public static final int CODE_SIP_BUSY = 338;
134    // 487 : Request Terminated
135    public static final int CODE_SIP_REQUEST_CANCELLED = 339;
136    // 406 : Not Acceptable
137    // 488 : Not Acceptable Here
138    // 606 : Not Acceptable
139    public static final int CODE_SIP_NOT_ACCEPTABLE = 340;
140    // 410 : Gone
141    // 604 : Does Not Exist Anywhere
142    public static final int CODE_SIP_NOT_REACHABLE = 341;
143    // Others
144    public static final int CODE_SIP_CLIENT_ERROR = 342;
145    // 5xx responses
146    // 501 : Server Internal Error
147    public static final int CODE_SIP_SERVER_INTERNAL_ERROR = 351;
148    // 503 : Service Unavailable
149    public static final int CODE_SIP_SERVICE_UNAVAILABLE = 352;
150    // 504 : Server Time-out
151    public static final int CODE_SIP_SERVER_TIMEOUT = 353;
152    // Others
153    public static final int CODE_SIP_SERVER_ERROR = 354;
154    // 6xx responses
155    // 603 : Decline
156    public static final int CODE_SIP_USER_REJECTED = 361;
157    // Others
158    public static final int CODE_SIP_GLOBAL_ERROR = 362;
159    // Emergency failure
160    public static final int CODE_EMERGENCY_TEMP_FAILURE = 363;
161    public static final int CODE_EMERGENCY_PERM_FAILURE = 364;
162
163    /**
164     * MEDIA (IMS -> Telephony)
165     */
166    // Media resource initialization failed
167    public static final int CODE_MEDIA_INIT_FAILED = 401;
168    // RTP timeout (no audio / video traffic in the session)
169    public static final int CODE_MEDIA_NO_DATA = 402;
170    // Media is not supported; so dropped the call
171    public static final int CODE_MEDIA_NOT_ACCEPTABLE = 403;
172    // Unknown media related errors
173    public static final int CODE_MEDIA_UNSPECIFIED = 404;
174
175    /**
176     * USER
177     */
178    // Telephony -> IMS
179    // User triggers the call end
180    public static final int CODE_USER_TERMINATED = 501;
181    // No action while an incoming call is ringing
182    public static final int CODE_USER_NOANSWER = 502;
183    // User ignores an incoming call
184    public static final int CODE_USER_IGNORE = 503;
185    // User declines an incoming call
186    public static final int CODE_USER_DECLINE = 504;
187    // Device declines/ends a call due to low battery
188    public static final int CODE_LOW_BATTERY = 505;
189    // Device declines call due to blacklisted call ID
190    public static final int CODE_BLACKLISTED_CALL_ID = 506;
191    // IMS -> Telephony
192    // The call is terminated by the network or remote user
193    public static final int CODE_USER_TERMINATED_BY_REMOTE = 510;
194
195    /**
196     * Extra codes for the specific code value
197     * This value can be referred when the code is CODE_LOCAL_CALL_CS_RETRY_REQUIRED.
198     */
199    // Try to connect CS call; normal
200    public static final int EXTRA_CODE_CALL_RETRY_NORMAL = 1;
201    // Try to connect CS call without the notification to user
202    public static final int EXTRA_CODE_CALL_RETRY_SILENT_REDIAL = 2;
203    // Try to connect CS call by the settings of the menu
204    public static final int EXTRA_CODE_CALL_RETRY_BY_SETTINGS = 3;
205
206    /**
207     * UT
208     */
209    public static final int CODE_UT_NOT_SUPPORTED = 801;
210    public static final int CODE_UT_SERVICE_UNAVAILABLE = 802;
211    public static final int CODE_UT_OPERATION_NOT_ALLOWED = 803;
212    public static final int CODE_UT_NETWORK_ERROR = 804;
213    public static final int CODE_UT_CB_PASSWORD_MISMATCH = 821;
214
215    /**
216     * ECBM
217     */
218    public static final int CODE_ECBM_NOT_SUPPORTED = 901;
219
220    /**
221     * Fail code used to indicate that Multi-endpoint is not supported by the Ims framework.
222     */
223    public static final int CODE_MULTIENDPOINT_NOT_SUPPORTED = 902;
224
225    /**
226     * Ims Registration error code
227     */
228    public static final int CODE_REGISTRATION_ERROR = 1000;
229
230    /**
231     * CALL DROP error codes (Call could drop because of many reasons like Network not available,
232     *  handover, failed, etc)
233     */
234
235    /**
236     * CALL DROP error code for the case when a device is ePDG capable and when the user is on an
237     * active wifi call and at the edge of coverage and there is no qualified LTE network available
238     * to handover the call to. We get a handover NOT_TRIGERRED message from the modem. This error
239     * code is received as part of the handover message.
240     */
241    public static final int CODE_CALL_DROP_IWLAN_TO_LTE_UNAVAILABLE = 1100;
242
243    /**
244     * MT call has ended due to a release from the network
245     * because the call was answered elsewhere
246     */
247    public static final int CODE_ANSWERED_ELSEWHERE = 1014;
248
249    /**
250     * For MultiEndpoint - Call Pull request has failed
251     */
252    public static final int CODE_CALL_PULL_OUT_OF_SYNC = 1015;
253
254    /**
255     * For MultiEndpoint - Call has been pulled from primary to secondary
256     */
257    public static final int CODE_CALL_END_CAUSE_CALL_PULL = 1016;
258
259    /**
260     * Supplementary services (HOLD/RESUME) failure error codes.
261     * Values for Supplemetary services failure - Failed, Cancelled and Re-Invite collision.
262     */
263    public static final int CODE_SUPP_SVC_FAILED = 1201;
264    public static final int CODE_SUPP_SVC_CANCELLED = 1202;
265    public static final int CODE_SUPP_SVC_REINVITE_COLLISION = 1203;
266
267    /**
268     * DPD Procedure received no response or send failed
269     */
270    public static final int CODE_IWLAN_DPD_FAILURE = 1300;
271
272    /**
273     * Establishment of the ePDG Tunnel Failed
274     */
275    public static final int CODE_EPDG_TUNNEL_ESTABLISH_FAILURE = 1400;
276
277    /**
278     * Re-keying of the ePDG Tunnel Failed; may not always result in teardown
279     */
280    public static final int CODE_EPDG_TUNNEL_REKEY_FAILURE = 1401;
281
282    /**
283     * Connection to the packet gateway is lost
284     */
285    public static final int CODE_EPDG_TUNNEL_LOST_CONNECTION = 1402;
286
287    /**
288     * The maximum number of calls allowed has been reached.  Used in a multi-endpoint scenario
289     * where the number of calls across all connected devices has reached the maximum.
290     */
291    public static final int CODE_MAXIMUM_NUMBER_OF_CALLS_REACHED = 1403;
292
293    /**
294     * Similar to {@link #CODE_LOCAL_CALL_DECLINE}, except indicates that a remote device has
295     * declined the call.  Used in a multi-endpoint scenario where a remote device declined an
296     * incoming call.
297     */
298    public static final int CODE_REMOTE_CALL_DECLINE = 1404;
299
300    /**
301     * Indicates the call was disconnected due to the user reaching their data limit.
302     */
303    public static final int CODE_DATA_LIMIT_REACHED = 1405;
304
305    /**
306     * Indicates the call was disconnected due to the user disabling cellular data.
307     */
308    public static final int CODE_DATA_DISABLED = 1406;
309
310    /**
311     * Indicates a call was disconnected due to loss of wifi signal.
312     */
313    public static final int CODE_WIFI_LOST = 1407;
314
315    /**
316     * Network string error messages.
317     * mExtraMessage may have these values.
318     */
319    public static final String EXTRA_MSG_SERVICE_NOT_AUTHORIZED
320            = "Forbidden. Not Authorized for Service";
321
322
323    // For main reason code
324    public int mCode;
325    // For the extra code value; it depends on the code value.
326    public int mExtraCode;
327    // For the additional message of the reason info.
328    public String mExtraMessage;
329    public ImsReasonInfo() {
330        mCode = CODE_UNSPECIFIED;
331        mExtraCode = CODE_UNSPECIFIED;
332        mExtraMessage = null;
333    }
334
335    public ImsReasonInfo(Parcel in) {
336        readFromParcel(in);
337    }
338
339    public ImsReasonInfo(int code, int extraCode) {
340        mCode = code;
341        mExtraCode = extraCode;
342        mExtraMessage = null;
343    }
344
345    public ImsReasonInfo(int code, int extraCode, String extraMessage) {
346        mCode = code;
347        mExtraCode = extraCode;
348        mExtraMessage = extraMessage;
349    }
350
351    /**
352     *
353     */
354    public int getCode() {
355        return mCode;
356    }
357
358    /**
359     *
360     */
361    public int getExtraCode() {
362        return mExtraCode;
363    }
364
365    /**
366     *
367     */
368    public String getExtraMessage() {
369        return mExtraMessage;
370    }
371
372    /**
373     * Returns the string format of {@link ImsReasonInfo}
374     *
375     * @return the string format of {@link ImsReasonInfo}
376     */
377    public String toString() {
378        return "ImsReasonInfo :: {" + mCode + ", " + mExtraCode + ", " + mExtraMessage + "}";
379    }
380
381    @Override
382    public int describeContents() {
383        return 0;
384    }
385
386    @Override
387    public void writeToParcel(Parcel out, int flags) {
388        out.writeInt(mCode);
389        out.writeInt(mExtraCode);
390        out.writeString(mExtraMessage);
391    }
392
393    private void readFromParcel(Parcel in) {
394        mCode = in.readInt();
395        mExtraCode = in.readInt();
396        mExtraMessage = in.readString();
397    }
398
399    public static final Creator<ImsReasonInfo> CREATOR = new Creator<ImsReasonInfo>() {
400        @Override
401        public ImsReasonInfo createFromParcel(Parcel in) {
402            return new ImsReasonInfo(in);
403        }
404
405        @Override
406        public ImsReasonInfo[] newArray(int size) {
407            return new ImsReasonInfo[size];
408        }
409    };
410}
411