summaryrefslogtreecommitdiffstats
path: root/telephony/java/com/android/ims/ImsReasonInfo.java
blob: 3ab415c12e445194ad62835d0a5e273a404f9993 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
/*
 * Copyright (c) 2013 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.ims;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * This class enables an application to get details on why a method call failed.
 *
 * @hide
 */
public class ImsReasonInfo implements Parcelable {
    /**
     * Specific code of each types
     */
    public static final int CODE_UNSPECIFIED = 0;

    /**
     * LOCAL
     */
    // IMS -> Telephony
    // The passed argument is an invalid
    public static final int CODE_LOCAL_ILLEGAL_ARGUMENT = 101;
    // The operation is invoked in invalid call state
    public static final int CODE_LOCAL_ILLEGAL_STATE = 102;
    // IMS service internal error
    public static final int CODE_LOCAL_INTERNAL_ERROR = 103;
    // IMS service goes down (service connection is lost)
    public static final int CODE_LOCAL_IMS_SERVICE_DOWN = 106;
    // No pending incoming call exists
    public static final int CODE_LOCAL_NO_PENDING_CALL = 107;

    // IMS -> Telephony
    // Service unavailable; by power off
    public static final int CODE_LOCAL_POWER_OFF = 111;
    // Service unavailable; by low battery
    public static final int CODE_LOCAL_LOW_BATTERY = 112;
    // Service unavailable; by out of service (data service state)
    public static final int CODE_LOCAL_NETWORK_NO_SERVICE = 121;
    // Service unavailable; by no LTE coverage
    // (VoLTE is not supported even though IMS is registered)
    public static final int CODE_LOCAL_NETWORK_NO_LTE_COVERAGE = 122;
    // Service unavailable; by located in roaming area
    public static final int CODE_LOCAL_NETWORK_ROAMING = 123;
    // Service unavailable; by IP changed
    public static final int CODE_LOCAL_NETWORK_IP_CHANGED = 124;
    // Service unavailable; other
    public static final int CODE_LOCAL_SERVICE_UNAVAILABLE = 131;
    // Service unavailable; IMS connection is lost (IMS is not registered)
    public static final int CODE_LOCAL_NOT_REGISTERED = 132;

    // IMS <-> Telephony
    // Max call exceeded
    public static final int CODE_LOCAL_CALL_EXCEEDED = 141;
    // IMS <- Telephony
    // Call busy
    public static final int CODE_LOCAL_CALL_BUSY = 142;
    // Call decline
    public static final int CODE_LOCAL_CALL_DECLINE = 143;
    // IMS -> Telephony
    // SRVCC is in progress
    public static final int CODE_LOCAL_CALL_VCC_ON_PROGRESSING = 144;
    // Resource reservation is failed (QoS precondition)
    public static final int CODE_LOCAL_CALL_RESOURCE_RESERVATION_FAILED = 145;
    // Retry CS call; VoLTE service can't be provided by the network or remote end
    // Resolve the extra code(EXTRA_CODE_CALL_RETRY_*) if the below code is set
    public static final int CODE_LOCAL_CALL_CS_RETRY_REQUIRED = 146;
    // Retry VoLTE call; VoLTE service can't be provided by the network temporarily
    public static final int CODE_LOCAL_CALL_VOLTE_RETRY_REQUIRED = 147;
    // IMS call is already terminated (in TERMINATED state)
    public static final int CODE_LOCAL_CALL_TERMINATED = 148;
    // Handover not feasible
    public static final int CODE_LOCAL_HO_NOT_FEASIBLE = 149;

    /**
     * TIMEOUT (IMS -> Telephony)
     */
    // 1xx waiting timer is expired after sending INVITE request (MO only)
    public static final int CODE_TIMEOUT_1XX_WAITING = 201;
    // User no answer during call setup operation (MO/MT)
    // MO : 200 OK to INVITE request is not received,
    // MT : No action from user after alerting the call
    public static final int CODE_TIMEOUT_NO_ANSWER = 202;
    // User no answer during call update operation (MO/MT)
    // MO : 200 OK to re-INVITE request is not received,
    // MT : No action from user after alerting the call
    public static final int CODE_TIMEOUT_NO_ANSWER_CALL_UPDATE = 203;

    //Call failures for FDN
    public static final int CODE_FDN_BLOCKED = 241;

    /**
     * STATUSCODE (SIP response code) (IMS -> Telephony)
     */
    // 3xx responses
    // SIP request is redirected
    public static final int CODE_SIP_REDIRECTED = 321;
    // 4xx responses
    // 400 : Bad Request
    public static final int CODE_SIP_BAD_REQUEST = 331;
    // 403 : Forbidden
    public static final int CODE_SIP_FORBIDDEN = 332;
    // 404 : Not Found
    public static final int CODE_SIP_NOT_FOUND = 333;
    // 415 : Unsupported Media Type
    // 416 : Unsupported URI Scheme
    // 420 : Bad Extension
    public static final int CODE_SIP_NOT_SUPPORTED = 334;
    // 408 : Request Timeout
    public static final int CODE_SIP_REQUEST_TIMEOUT = 335;
    // 480 : Temporarily Unavailable
    public static final int CODE_SIP_TEMPRARILY_UNAVAILABLE = 336;
    // 484 : Address Incomplete
    public static final int CODE_SIP_BAD_ADDRESS = 337;
    // 486 : Busy Here
    // 600 : Busy Everywhere
    public static final int CODE_SIP_BUSY = 338;
    // 487 : Request Terminated
    public static final int CODE_SIP_REQUEST_CANCELLED = 339;
    // 406 : Not Acceptable
    // 488 : Not Acceptable Here
    // 606 : Not Acceptable
    public static final int CODE_SIP_NOT_ACCEPTABLE = 340;
    // 410 : Gone
    // 604 : Does Not Exist Anywhere
    public static final int CODE_SIP_NOT_REACHABLE = 341;
    // Others
    public static final int CODE_SIP_CLIENT_ERROR = 342;
    // 5xx responses
    // 501 : Server Internal Error
    public static final int CODE_SIP_SERVER_INTERNAL_ERROR = 351;
    // 503 : Service Unavailable
    public static final int CODE_SIP_SERVICE_UNAVAILABLE = 352;
    // 504 : Server Time-out
    public static final int CODE_SIP_SERVER_TIMEOUT = 353;
    // Others
    public static final int CODE_SIP_SERVER_ERROR = 354;
    // 6xx responses
    // 603 : Decline
    public static final int CODE_SIP_USER_REJECTED = 361;
    // Others
    public static final int CODE_SIP_GLOBAL_ERROR = 362;
    // Emergency failure
    public static final int CODE_EMERGENCY_TEMP_FAILURE = 363;
    public static final int CODE_EMERGENCY_PERM_FAILURE = 364;

    /**
     * MEDIA (IMS -> Telephony)
     */
    // Media resource initialization failed
    public static final int CODE_MEDIA_INIT_FAILED = 401;
    // RTP timeout (no audio / video traffic in the session)
    public static final int CODE_MEDIA_NO_DATA = 402;
    // Media is not supported; so dropped the call
    public static final int CODE_MEDIA_NOT_ACCEPTABLE = 403;
    // Unknown media related errors
    public static final int CODE_MEDIA_UNSPECIFIED = 404;

    /**
     * USER
     */
    // Telephony -> IMS
    // User triggers the call end
    public static final int CODE_USER_TERMINATED = 501;
    // No action while an incoming call is ringing
    public static final int CODE_USER_NOANSWER = 502;
    // User ignores an incoming call
    public static final int CODE_USER_IGNORE = 503;
    // User declines an incoming call
    public static final int CODE_USER_DECLINE = 504;
    // Device declines/ends a call due to low battery
    public static final int CODE_LOW_BATTERY = 505;
    // Device declines call due to blacklisted call ID
    public static final int CODE_BLACKLISTED_CALL_ID = 506;
    // IMS -> Telephony
    // The call is terminated by the network or remote user
    public static final int CODE_USER_TERMINATED_BY_REMOTE = 510;

    /**
     * Extra codes for the specific code value
     * This value can be referred when the code is CODE_LOCAL_CALL_CS_RETRY_REQUIRED.
     */
    // Try to connect CS call; normal
    public static final int EXTRA_CODE_CALL_RETRY_NORMAL = 1;
    // Try to connect CS call without the notification to user
    public static final int EXTRA_CODE_CALL_RETRY_SILENT_REDIAL = 2;
    // Try to connect CS call by the settings of the menu
    public static final int EXTRA_CODE_CALL_RETRY_BY_SETTINGS = 3;

    /**
     * UT
     */
    public static final int CODE_UT_NOT_SUPPORTED = 801;
    public static final int CODE_UT_SERVICE_UNAVAILABLE = 802;
    public static final int CODE_UT_OPERATION_NOT_ALLOWED = 803;
    public static final int CODE_UT_NETWORK_ERROR = 804;
    public static final int CODE_UT_CB_PASSWORD_MISMATCH = 821;

    /**
     * ECBM
     */
    public static final int CODE_ECBM_NOT_SUPPORTED = 901;

    /**
     * Ims Registration error code
     */
    public static final int CODE_REGISTRATION_ERROR = 1000;

    /**
     * CALL DROP error codes (Call could drop because of many reasons like Network not available,
     *  handover, failed, etc)
     */

    /**
     * CALL DROP error code for the case when a device is ePDG capable and when the user is on an
     * active wifi call and at the edge of coverage and there is no qualified LTE network available
     * to handover the call to. We get a handover NOT_TRIGERRED message from the modem. This error
     * code is received as part of the handover message.
     */
    public static final int CODE_CALL_DROP_IWLAN_TO_LTE_UNAVAILABLE = 1100;

    /**
     * MT call has ended due to a release from the network
     * because the call was answered elsewhere
     */
    public static final int CODE_ANSWERED_ELSEWHERE = 1014;

    /**
     * For VICE - Call Pull request has failed
     */
    public static final int CODE_CALL_PULL_OUT_OF_SYNC = 1015;

    /**
     * For VICE - Call has been pulled from primary to secondary
     */
    public static final int CODE_CALL_END_CAUSE_CALL_PULL = 1016;

    /**
     * Network string error messages.
     * mExtraMessage may have these values.
     */
    public static final String EXTRA_MSG_SERVICE_NOT_AUTHORIZED
            = "Forbidden. Not Authorized for Service";

    // For main reason code
    public int mCode;
    // For the extra code value; it depends on the code value.
    public int mExtraCode;
    // For the additional message of the reason info.
    public String mExtraMessage;
    public ImsReasonInfo() {
        mCode = CODE_UNSPECIFIED;
        mExtraCode = CODE_UNSPECIFIED;
        mExtraMessage = null;
    }

    public ImsReasonInfo(Parcel in) {
        readFromParcel(in);
    }

    public ImsReasonInfo(int code, int extraCode) {
        mCode = code;
        mExtraCode = extraCode;
        mExtraMessage = null;
    }

    public ImsReasonInfo(int code, int extraCode, String extraMessage) {
        mCode = code;
        mExtraCode = extraCode;
        mExtraMessage = extraMessage;
    }

    /**
     *
     */
    public int getCode() {
        return mCode;
    }

    /**
     *
     */
    public int getExtraCode() {
        return mExtraCode;
    }

    /**
     *
     */
    public String getExtraMessage() {
        return mExtraMessage;
    }

    /**
     * Returns the string format of {@link ImsReasonInfo}
     *
     * @return the string format of {@link ImsReasonInfo}
     */
    public String toString() {
        return "ImsReasonInfo :: {" + mCode + ", " + mExtraCode + ", " + mExtraMessage + "}";
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel out, int flags) {
        out.writeInt(mCode);
        out.writeInt(mExtraCode);
        out.writeString(mExtraMessage);
    }

    private void readFromParcel(Parcel in) {
        mCode = in.readInt();
        mExtraCode = in.readInt();
        mExtraMessage = in.readString();
    }

    public static final Creator<ImsReasonInfo> CREATOR = new Creator<ImsReasonInfo>() {
        @Override
        public ImsReasonInfo createFromParcel(Parcel in) {
            return new ImsReasonInfo(in);
        }

        @Override
        public ImsReasonInfo[] newArray(int size) {
            return new ImsReasonInfo[size];
        }
    };
}