ImsReasonInfo.java revision 4b6d38938e1c6756c61456503099af714d1908e3
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     * 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    // Handover not feasible
88    public static final int CODE_LOCAL_HO_NOT_FEASIBLE = 149;
89
90    /**
91     * TIMEOUT (IMS -> Telephony)
92     */
93    // 1xx waiting timer is expired after sending INVITE request (MO only)
94    public static final int CODE_TIMEOUT_1XX_WAITING = 201;
95    // User no answer during call setup operation (MO/MT)
96    // MO : 200 OK to INVITE request is not received,
97    // MT : No action from user after alerting the call
98    public static final int CODE_TIMEOUT_NO_ANSWER = 202;
99    // User no answer during call update operation (MO/MT)
100    // MO : 200 OK to re-INVITE request is not received,
101    // MT : No action from user after alerting the call
102    public static final int CODE_TIMEOUT_NO_ANSWER_CALL_UPDATE = 203;
103
104    //Call failures for FDN
105    public static final int CODE_FDN_BLOCKED = 241;
106
107    /**
108     * STATUSCODE (SIP response code) (IMS -> Telephony)
109     */
110    // 3xx responses
111    // SIP request is redirected
112    public static final int CODE_SIP_REDIRECTED = 321;
113    // 4xx responses
114    // 400 : Bad Request
115    public static final int CODE_SIP_BAD_REQUEST = 331;
116    // 403 : Forbidden
117    public static final int CODE_SIP_FORBIDDEN = 332;
118    // 404 : Not Found
119    public static final int CODE_SIP_NOT_FOUND = 333;
120    // 415 : Unsupported Media Type
121    // 416 : Unsupported URI Scheme
122    // 420 : Bad Extension
123    public static final int CODE_SIP_NOT_SUPPORTED = 334;
124    // 408 : Request Timeout
125    public static final int CODE_SIP_REQUEST_TIMEOUT = 335;
126    // 480 : Temporarily Unavailable
127    public static final int CODE_SIP_TEMPRARILY_UNAVAILABLE = 336;
128    // 484 : Address Incomplete
129    public static final int CODE_SIP_BAD_ADDRESS = 337;
130    // 486 : Busy Here
131    // 600 : Busy Everywhere
132    public static final int CODE_SIP_BUSY = 338;
133    // 487 : Request Terminated
134    public static final int CODE_SIP_REQUEST_CANCELLED = 339;
135    // 406 : Not Acceptable
136    // 488 : Not Acceptable Here
137    // 606 : Not Acceptable
138    public static final int CODE_SIP_NOT_ACCEPTABLE = 340;
139    // 410 : Gone
140    // 604 : Does Not Exist Anywhere
141    public static final int CODE_SIP_NOT_REACHABLE = 341;
142    // Others
143    public static final int CODE_SIP_CLIENT_ERROR = 342;
144    // 5xx responses
145    // 501 : Server Internal Error
146    public static final int CODE_SIP_SERVER_INTERNAL_ERROR = 351;
147    // 503 : Service Unavailable
148    public static final int CODE_SIP_SERVICE_UNAVAILABLE = 352;
149    // 504 : Server Time-out
150    public static final int CODE_SIP_SERVER_TIMEOUT = 353;
151    // Others
152    public static final int CODE_SIP_SERVER_ERROR = 354;
153    // 6xx responses
154    // 603 : Decline
155    public static final int CODE_SIP_USER_REJECTED = 361;
156    // Others
157    public static final int CODE_SIP_GLOBAL_ERROR = 362;
158    // Emergency failure
159    public static final int CODE_EMERGENCY_TEMP_FAILURE = 363;
160    public static final int CODE_EMERGENCY_PERM_FAILURE = 364;
161
162    /**
163     * MEDIA (IMS -> Telephony)
164     */
165    // Media resource initialization failed
166    public static final int CODE_MEDIA_INIT_FAILED = 401;
167    // RTP timeout (no audio / video traffic in the session)
168    public static final int CODE_MEDIA_NO_DATA = 402;
169    // Media is not supported; so dropped the call
170    public static final int CODE_MEDIA_NOT_ACCEPTABLE = 403;
171    // Unknown media related errors
172    public static final int CODE_MEDIA_UNSPECIFIED = 404;
173
174    /**
175     * USER
176     */
177    // Telephony -> IMS
178    // User triggers the call end
179    public static final int CODE_USER_TERMINATED = 501;
180    // No action while an incoming call is ringing
181    public static final int CODE_USER_NOANSWER = 502;
182    // User ignores an incoming call
183    public static final int CODE_USER_IGNORE = 503;
184    // User declines an incoming call
185    public static final int CODE_USER_DECLINE = 504;
186    // Device declines/ends a call due to low battery
187    public static final int CODE_LOW_BATTERY = 505;
188    // Device declines call due to blacklisted call ID
189    public static final int CODE_BLACKLISTED_CALL_ID = 506;
190    // IMS -> Telephony
191    // The call is terminated by the network or remote user
192    public static final int CODE_USER_TERMINATED_BY_REMOTE = 510;
193
194    /**
195     * Extra codes for the specific code value
196     * This value can be referred when the code is CODE_LOCAL_CALL_CS_RETRY_REQUIRED.
197     */
198    // Try to connect CS call; normal
199    public static final int EXTRA_CODE_CALL_RETRY_NORMAL = 1;
200    // Try to connect CS call without the notification to user
201    public static final int EXTRA_CODE_CALL_RETRY_SILENT_REDIAL = 2;
202    // Try to connect CS call by the settings of the menu
203    public static final int EXTRA_CODE_CALL_RETRY_BY_SETTINGS = 3;
204
205    /**
206     * UT
207     */
208    public static final int CODE_UT_NOT_SUPPORTED = 801;
209    public static final int CODE_UT_SERVICE_UNAVAILABLE = 802;
210    public static final int CODE_UT_OPERATION_NOT_ALLOWED = 803;
211    public static final int CODE_UT_NETWORK_ERROR = 804;
212    public static final int CODE_UT_CB_PASSWORD_MISMATCH = 821;
213
214    /**
215     * ECBM
216     */
217    public static final int CODE_ECBM_NOT_SUPPORTED = 901;
218
219    /**
220     * Ims Registration error code
221     */
222    public static final int CODE_REGISTRATION_ERROR = 1000;
223
224    /**
225     * CALL DROP error codes (Call could drop because of many reasons like Network not available,
226     *  handover, failed, etc)
227     */
228
229    /**
230     * CALL DROP error code for the case when a device is ePDG capable and when the user is on an
231     * active wifi call and at the edge of coverage and there is no qualified LTE network available
232     * to handover the call to. We get a handover NOT_TRIGERRED message from the modem. This error
233     * code is received as part of the handover message.
234     */
235    public static final int CODE_CALL_DROP_IWLAN_TO_LTE_UNAVAILABLE = 1100;
236
237    /**
238     * MT call has ended due to a release from the network
239     * because the call was answered elsewhere
240     */
241    public static final int CODE_ANSWERED_ELSEWHERE = 1014;
242
243    /**
244     * Supplementary services (HOLD/RESUME) failure error codes.
245     * Values for Supplemetary services failure - Failed, Cancelled and Re-Invite collision.
246     */
247    public static final int CODE_SUPP_SVC_FAILED = 1201;
248    public static final int CODE_SUPP_SVC_CANCELLED = 1202;
249    public static final int CODE_SUPP_SVC_REINVITE_COLLISION = 1203;
250
251    /**
252     * DPD Procedure received no response or send failed
253     */
254    public static final int CODE_IWLAN_DPD_FAILURE = 1300;
255
256    /**
257     * Establishment of the ePDG Tunnel Failed
258     */
259    public static final int CODE_EPDG_TUNNEL_ESTABLISH_FAILURE = 1400;
260
261    /**
262     * Re-keying of the ePDG Tunnel Failed; may not always result in teardown
263     */
264    public static final int CODE_EPDG_TUNNEL_REKEY_FAILURE = 1401;
265
266    /**
267     * Connection to the packet gateway is lost
268     */
269    public static final int CODE_EPDG_TUNNEL_LOST_CONNECTION = 1402;
270
271    /**
272     * Network string error messages.
273     * mExtraMessage may have these values.
274     */
275    public static final String EXTRA_MSG_SERVICE_NOT_AUTHORIZED
276            = "Forbidden. Not Authorized for Service";
277
278
279    // For main reason code
280    public int mCode;
281    // For the extra code value; it depends on the code value.
282    public int mExtraCode;
283    // For the additional message of the reason info.
284    public String mExtraMessage;
285    public ImsReasonInfo() {
286        mCode = CODE_UNSPECIFIED;
287        mExtraCode = CODE_UNSPECIFIED;
288        mExtraMessage = null;
289    }
290
291    public ImsReasonInfo(Parcel in) {
292        readFromParcel(in);
293    }
294
295    public ImsReasonInfo(int code, int extraCode) {
296        mCode = code;
297        mExtraCode = extraCode;
298        mExtraMessage = null;
299    }
300
301    public ImsReasonInfo(int code, int extraCode, String extraMessage) {
302        mCode = code;
303        mExtraCode = extraCode;
304        mExtraMessage = extraMessage;
305    }
306
307    /**
308     *
309     */
310    public int getCode() {
311        return mCode;
312    }
313
314    /**
315     *
316     */
317    public int getExtraCode() {
318        return mExtraCode;
319    }
320
321    /**
322     *
323     */
324    public String getExtraMessage() {
325        return mExtraMessage;
326    }
327
328    /**
329     * Returns the string format of {@link ImsReasonInfo}
330     *
331     * @return the string format of {@link ImsReasonInfo}
332     */
333    public String toString() {
334        return "ImsReasonInfo :: {" + mCode + ", " + mExtraCode + ", " + mExtraMessage + "}";
335    }
336
337    @Override
338    public int describeContents() {
339        return 0;
340    }
341
342    @Override
343    public void writeToParcel(Parcel out, int flags) {
344        out.writeInt(mCode);
345        out.writeInt(mExtraCode);
346        out.writeString(mExtraMessage);
347    }
348
349    private void readFromParcel(Parcel in) {
350        mCode = in.readInt();
351        mExtraCode = in.readInt();
352        mExtraMessage = in.readString();
353    }
354
355    public static final Creator<ImsReasonInfo> CREATOR = new Creator<ImsReasonInfo>() {
356        @Override
357        public ImsReasonInfo createFromParcel(Parcel in) {
358            return new ImsReasonInfo(in);
359        }
360
361        @Override
362        public ImsReasonInfo[] newArray(int size) {
363            return new ImsReasonInfo[size];
364        }
365    };
366}
367