ImsReasonInfo.java revision f38780b483de489635749f523258003506c8bbbc
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 * Call pull request failure from the network. 245 */ 246 public static final int CODE_CALL_PULL_OUT_OF_SYNC = 1015; 247 248 /** 249 * Call ended due to being pulled onto another device. 250 */ 251 public static final int CODE_CALL_END_CAUSE_CALL_PULL = 1016; 252 253 /** 254 * Supplementary services (HOLD/RESUME) failure error codes. 255 * Values for Supplemetary services failure - Failed, Cancelled and Re-Invite collision. 256 */ 257 public static final int CODE_SUPP_SVC_FAILED = 1201; 258 public static final int CODE_SUPP_SVC_CANCELLED = 1202; 259 public static final int CODE_SUPP_SVC_REINVITE_COLLISION = 1203; 260 261 /** 262 * DPD Procedure received no response or send failed 263 */ 264 public static final int CODE_IWLAN_DPD_FAILURE = 1300; 265 266 /** 267 * Establishment of the ePDG Tunnel Failed 268 */ 269 public static final int CODE_EPDG_TUNNEL_ESTABLISH_FAILURE = 1400; 270 271 /** 272 * Re-keying of the ePDG Tunnel Failed; may not always result in teardown 273 */ 274 public static final int CODE_EPDG_TUNNEL_REKEY_FAILURE = 1401; 275 276 /** 277 * Connection to the packet gateway is lost 278 */ 279 public static final int CODE_EPDG_TUNNEL_LOST_CONNECTION = 1402; 280 281 /** 282 * Network string error messages. 283 * mExtraMessage may have these values. 284 */ 285 public static final String EXTRA_MSG_SERVICE_NOT_AUTHORIZED 286 = "Forbidden. Not Authorized for Service"; 287 288 289 // For main reason code 290 public int mCode; 291 // For the extra code value; it depends on the code value. 292 public int mExtraCode; 293 // For the additional message of the reason info. 294 public String mExtraMessage; 295 public ImsReasonInfo() { 296 mCode = CODE_UNSPECIFIED; 297 mExtraCode = CODE_UNSPECIFIED; 298 mExtraMessage = null; 299 } 300 301 public ImsReasonInfo(Parcel in) { 302 readFromParcel(in); 303 } 304 305 public ImsReasonInfo(int code, int extraCode) { 306 mCode = code; 307 mExtraCode = extraCode; 308 mExtraMessage = null; 309 } 310 311 public ImsReasonInfo(int code, int extraCode, String extraMessage) { 312 mCode = code; 313 mExtraCode = extraCode; 314 mExtraMessage = extraMessage; 315 } 316 317 /** 318 * 319 */ 320 public int getCode() { 321 return mCode; 322 } 323 324 /** 325 * 326 */ 327 public int getExtraCode() { 328 return mExtraCode; 329 } 330 331 /** 332 * 333 */ 334 public String getExtraMessage() { 335 return mExtraMessage; 336 } 337 338 /** 339 * Returns the string format of {@link ImsReasonInfo} 340 * 341 * @return the string format of {@link ImsReasonInfo} 342 */ 343 public String toString() { 344 return "ImsReasonInfo :: {" + mCode + ", " + mExtraCode + ", " + mExtraMessage + "}"; 345 } 346 347 @Override 348 public int describeContents() { 349 return 0; 350 } 351 352 @Override 353 public void writeToParcel(Parcel out, int flags) { 354 out.writeInt(mCode); 355 out.writeInt(mExtraCode); 356 out.writeString(mExtraMessage); 357 } 358 359 private void readFromParcel(Parcel in) { 360 mCode = in.readInt(); 361 mExtraCode = in.readInt(); 362 mExtraMessage = in.readString(); 363 } 364 365 public static final Creator<ImsReasonInfo> CREATOR = new Creator<ImsReasonInfo>() { 366 @Override 367 public ImsReasonInfo createFromParcel(Parcel in) { 368 return new ImsReasonInfo(in); 369 } 370 371 @Override 372 public ImsReasonInfo[] newArray(int size) { 373 return new ImsReasonInfo[size]; 374 } 375 }; 376} 377