1 /* 2 * Copyright (c) 2019, The Android Open Source Project 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are met: 7 * - Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * - Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * - Neither the name of The Android Open Source Project nor the names of its contributors may 13 * be used to endorse or promote products derived from this software 14 * without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 18 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MOTOROLA MOBILITY LLC BE LIABLE 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 26 * DAMAGE. 27 */ 28 29 package com.android.ims; 30 31 public class ResultCode { 32 /** 33 * The code is used when the request is success. 34 */ 35 public static final int SUCCESS =0; 36 37 /** 38 * Return this code if the service doesn't be enabled on the phone. 39 * As per the requirement the feature can be enabled/disabled by DM. 40 */ 41 public static final int ERROR_SERVICE_NOT_ENABLED = -1; 42 43 /** 44 * Return this code if the service didn't publish yet. 45 */ 46 public static final int ERROR_SERVICE_NOT_PUBLISHED = -2; 47 48 /** 49 * The service is not available, for example it is 1x only 50 */ 51 public static final int ERROR_SERVICE_NOT_AVAILABLE = -3; 52 53 /** 54 * SUBSCRIBE Error base 55 */ 56 public static final int SUBSCRIBER_ERROR_CODE_START = ERROR_SERVICE_NOT_AVAILABLE; 57 58 /** 59 * Temporary error and need retry later. 60 * such as: 61 * 503 Service Unavailable 62 * Device shall retry with exponential back-off 63 * 64 * 408 Request Timeout 65 * Device shall retry with exponential back-off 66 * 67 * 423 Interval Too Short. Requested expiry interval too short and server rejects it 68 * Device shall re-attempt subscription after changing the expiration interval in 69 * the Expires header field to be equal to or greater than the expiration interval 70 * within the Min-Expires header field of the 423 response 71 */ 72 public static final int SUBSCRIBE_TEMPORARY_ERROR = SUBSCRIBER_ERROR_CODE_START - 1; 73 74 /** 75 * receives 403 (reason="User Not Registered"). 76 * Re-Register to IMS then retry the single resource subscription if capability polling. 77 * availability fetch: no retry. 78 */ 79 public static final int SUBSCRIBE_NOT_REGISTERED = SUBSCRIBER_ERROR_CODE_START - 2; 80 81 /** 82 * Responding for 403 - not authorized (Requestor) 83 * No retry. 84 */ 85 public static final int SUBSCRIBE_NOT_AUTHORIZED_FOR_PRESENCE = 86 SUBSCRIBER_ERROR_CODE_START - 3; 87 88 /** 89 * Responding for "403 Forbidden" or "403" 90 * Handle it as same as 404 Not found. 91 * No retry. 92 */ 93 public static final int SUBSCRIBE_FORBIDDEN = SUBSCRIBER_ERROR_CODE_START - 4; 94 95 /** 96 * Responding for 404 (target number) 97 * No retry. 98 */ 99 public static final int SUBSCRIBE_NOT_FOUND = SUBSCRIBER_ERROR_CODE_START - 5; 100 101 /** 102 * Responding for 413 - Too Large. Top app need shrink the size 103 * of request contact list and resend the request 104 */ 105 public static final int SUBSCRIBE_TOO_LARGE = SUBSCRIBER_ERROR_CODE_START - 6; 106 107 /** 108 * All subscribe errors not covered by specific errors 109 * Other 4xx/5xx/6xx 110 * 111 * Device shall not retry 112 */ 113 public static final int SUBSCRIBE_GENIRIC_FAILURE = SUBSCRIBER_ERROR_CODE_START - 7; 114 115 /** 116 * Invalid parameter - The caller should check the parameter. 117 */ 118 public static final int SUBSCRIBE_INVALID_PARAM = SUBSCRIBER_ERROR_CODE_START - 8; 119 120 /** 121 * Fetch error - The RCS statck failed to fetch the presence information. 122 */ 123 public static final int SUBSCRIBE_FETCH_ERROR = SUBSCRIBER_ERROR_CODE_START - 9; 124 125 /** 126 * Request timeout - The RCS statck returns timeout error. 127 */ 128 public static final int SUBSCRIBE_REQUEST_TIMEOUT = SUBSCRIBER_ERROR_CODE_START - 10; 129 130 /** 131 * Insufficient memory - The RCS statck returns the insufficient memory error. 132 */ 133 public static final int SUBSCRIBE_INSUFFICIENT_MEMORY = SUBSCRIBER_ERROR_CODE_START - 11; 134 135 /** 136 * Lost network error - The RCS statck returns the lost network error. 137 */ 138 public static final int SUBSCRIBE_LOST_NETWORK = SUBSCRIBER_ERROR_CODE_START - 12; 139 140 /** 141 * Not supported error - The RCS statck returns the not supported error. 142 */ 143 public static final int SUBSCRIBE_NOT_SUPPORTED = SUBSCRIBER_ERROR_CODE_START - 13; 144 145 /** 146 * Generic error - RCS Presence stack returns generic error 147 */ 148 public static final int SUBSCRIBE_GENERIC = SUBSCRIBER_ERROR_CODE_START - 14; 149 150 /** 151 * There is a request for the same number in queue. 152 */ 153 public static final int SUBSCRIBE_ALREADY_IN_QUEUE = SUBSCRIBER_ERROR_CODE_START - 16; 154 155 /** 156 * Request too frequently. 157 */ 158 public static final int SUBSCRIBE_TOO_FREQUENTLY = SUBSCRIBER_ERROR_CODE_START - 17; 159 160 /** 161 * The last Subscriber error code 162 */ 163 public static final int SUBSCRIBER_ERROR_CODE_END = SUBSCRIBER_ERROR_CODE_START - 17; 164 165 /** 166 * All publish errors not covered by specific errors 167 */ 168 public static final int PUBLISH_GENERIC_FAILURE = ResultCode.SUBSCRIBER_ERROR_CODE_END - 1; 169 170 /** 171 * Responding for 403 - not authorized 172 */ 173 public static final int PUBLISH_NOT_AUTHORIZED_FOR_PRESENCE 174 = ResultCode.SUBSCRIBER_ERROR_CODE_END - 2; 175 176 /** 177 * Responding for 404 error code. The subscriber is not provisioned. 178 * The Client should not send any EAB traffic after get this error. 179 */ 180 public static final int PUBLISH_NOT_PROVISIONED = ResultCode.SUBSCRIBER_ERROR_CODE_END - 3; 181 182 public static final int PUBLISH_NOT_REGISTERED = ResultCode.SUBSCRIBER_ERROR_CODE_END - 4; 183 184 public static final int PUBLISH_FORBIDDEN = ResultCode.SUBSCRIBER_ERROR_CODE_END - 5; 185 186 public static final int PUBLISH_NOT_FOUND = ResultCode.SUBSCRIBER_ERROR_CODE_END - 6; 187 188 public static final int PUBLISH_REQUEST_TIMEOUT = ResultCode.SUBSCRIBER_ERROR_CODE_END - 7; 189 190 public static final int PUBLISH_TOO_LARGE = ResultCode.SUBSCRIBER_ERROR_CODE_END - 8; 191 192 public static final int PUBLISH_TOO_SHORT = ResultCode.SUBSCRIBER_ERROR_CODE_END - 9; 193 194 public static final int PUBLISH_TEMPORARY_ERROR = ResultCode.SUBSCRIBER_ERROR_CODE_END - 10; 195 } 196