Wink Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 1 | /* |
Brad Ebinger | 0e370b4 | 2018-01-22 13:51:52 -0800 | [diff] [blame] | 2 | * Copyright (C) 2018 The Android Open Source Project |
Wink Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 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 |
Brad Ebinger | 0e370b4 | 2018-01-22 13:51:52 -0800 | [diff] [blame] | 14 | * limitations under the License |
Wink Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 15 | */ |
| 16 | |
Brad Ebinger | 0e370b4 | 2018-01-22 13:51:52 -0800 | [diff] [blame] | 17 | package android.telephony.ims; |
Wink Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 18 | |
Ashit Sood | 51832a7 | 2018-05-02 11:25:22 -0700 | [diff] [blame] | 19 | import android.annotation.IntDef; |
Brad Ebinger | 4123f95 | 2018-10-11 16:21:22 -0700 | [diff] [blame] | 20 | import android.annotation.NonNull; |
| 21 | import android.annotation.Nullable; |
Brad Ebinger | 0e370b4 | 2018-01-22 13:51:52 -0800 | [diff] [blame] | 22 | import android.annotation.SystemApi; |
Mathew Inwood | a838206 | 2018-08-16 17:01:12 +0100 | [diff] [blame] | 23 | import android.annotation.UnsupportedAppUsage; |
Wink Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 24 | import android.os.Parcel; |
| 25 | import android.os.Parcelable; |
| 26 | |
Ashit Sood | 51832a7 | 2018-05-02 11:25:22 -0700 | [diff] [blame] | 27 | import java.lang.annotation.Retention; |
| 28 | import java.lang.annotation.RetentionPolicy; |
| 29 | |
Wink Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 30 | /** |
| 31 | * Provides the result to the update operation for the supplementary service configuration. |
| 32 | * |
Brad Ebinger | 4123f95 | 2018-10-11 16:21:22 -0700 | [diff] [blame] | 33 | * Also supports IMS specific Incoming Communication Barring (ICB) as well as Anonymous |
| 34 | * Communication Rejection (ACR), as per 3GPP 24.611. |
| 35 | * |
| 36 | * @see Builder |
Wink Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 37 | * @hide |
| 38 | */ |
Brad Ebinger | 0e370b4 | 2018-01-22 13:51:52 -0800 | [diff] [blame] | 39 | @SystemApi |
| 40 | public final class ImsSsInfo implements Parcelable { |
Brad Ebinger | 4123f95 | 2018-10-11 16:21:22 -0700 | [diff] [blame] | 41 | |
| 42 | /**@hide*/ |
| 43 | @IntDef(value = { |
| 44 | NOT_REGISTERED, |
| 45 | DISABLED, |
| 46 | ENABLED |
| 47 | }) |
| 48 | @Retention(RetentionPolicy.SOURCE) |
| 49 | public @interface ServiceStatus {} |
| 50 | |
Wink Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 51 | /** |
| 52 | * For the status of service registration or activation/deactivation. |
| 53 | */ |
| 54 | public static final int NOT_REGISTERED = (-1); |
| 55 | public static final int DISABLED = 0; |
| 56 | public static final int ENABLED = 1; |
| 57 | |
Ashit Sood | 51832a7 | 2018-05-02 11:25:22 -0700 | [diff] [blame] | 58 | /** |
Brad Ebinger | 4123f95 | 2018-10-11 16:21:22 -0700 | [diff] [blame] | 59 | * Provision status of service. |
| 60 | * @hide |
Ashit Sood | 51832a7 | 2018-05-02 11:25:22 -0700 | [diff] [blame] | 61 | */ |
Brad Ebinger | 4123f95 | 2018-10-11 16:21:22 -0700 | [diff] [blame] | 62 | @IntDef(value = { |
Ashit Sood | 51832a7 | 2018-05-02 11:25:22 -0700 | [diff] [blame] | 63 | SERVICE_PROVISIONING_UNKNOWN, |
| 64 | SERVICE_NOT_PROVISIONED, |
| 65 | SERVICE_PROVISIONED |
Brad Ebinger | 4123f95 | 2018-10-11 16:21:22 -0700 | [diff] [blame] | 66 | }, prefix = "SERVICE_") |
Ashit Sood | 51832a7 | 2018-05-02 11:25:22 -0700 | [diff] [blame] | 67 | @Retention(RetentionPolicy.SOURCE) |
| 68 | public @interface ServiceProvisionStatus {} |
Brad Ebinger | 4123f95 | 2018-10-11 16:21:22 -0700 | [diff] [blame] | 69 | |
Ashit Sood | 51832a7 | 2018-05-02 11:25:22 -0700 | [diff] [blame] | 70 | /** |
| 71 | * Unknown provision status for the service. |
| 72 | */ |
| 73 | public static final int SERVICE_PROVISIONING_UNKNOWN = (-1); |
Brad Ebinger | 4123f95 | 2018-10-11 16:21:22 -0700 | [diff] [blame] | 74 | |
Ashit Sood | 51832a7 | 2018-05-02 11:25:22 -0700 | [diff] [blame] | 75 | /** |
| 76 | * Service is not provisioned. |
| 77 | */ |
| 78 | public static final int SERVICE_NOT_PROVISIONED = 0; |
Brad Ebinger | 4123f95 | 2018-10-11 16:21:22 -0700 | [diff] [blame] | 79 | |
Ashit Sood | 51832a7 | 2018-05-02 11:25:22 -0700 | [diff] [blame] | 80 | /** |
| 81 | * Service is provisioned. |
| 82 | */ |
| 83 | public static final int SERVICE_PROVISIONED = 1; |
| 84 | |
Brad Ebinger | c9a6aab | 2018-11-29 17:02:35 -0800 | [diff] [blame] | 85 | /**@hide*/ |
Brad Ebinger | 4123f95 | 2018-10-11 16:21:22 -0700 | [diff] [blame] | 86 | @IntDef(value = { |
| 87 | CLIR_OUTGOING_DEFAULT, |
| 88 | CLIR_OUTGOING_INVOCATION, |
| 89 | CLIR_OUTGOING_SUPPRESSION |
| 90 | }, prefix = "CLIR_OUTGOING_") |
| 91 | @Retention(RetentionPolicy.SOURCE) |
| 92 | public @interface ClirOutgoingState {} |
| 93 | |
| 94 | /** |
| 95 | * Calling line identification restriction (CLIR) is set to the default according to the |
| 96 | * subscription of the CLIR service. |
| 97 | * |
| 98 | * See TS 27.007, section 7.7 for more information. |
| 99 | */ |
| 100 | public static final int CLIR_OUTGOING_DEFAULT = 0; |
| 101 | /** |
| 102 | * Activate Calling line identification restriction for outgoing calls. |
| 103 | * |
| 104 | * See TS 27.007, section 7.7 for more information. |
| 105 | */ |
| 106 | public static final int CLIR_OUTGOING_INVOCATION = 1; |
| 107 | /** |
| 108 | * Deactivate Calling line identification restriction for outgoing calls. |
| 109 | * |
| 110 | * See TS 27.007, section 7.7 for more information. |
| 111 | */ |
| 112 | public static final int CLIR_OUTGOING_SUPPRESSION = 2; |
| 113 | |
| 114 | /** |
| 115 | * Calling line identification restriction is currently not provisioned. |
| 116 | * |
| 117 | * See TS 27.007, section 7.7 for more information. |
| 118 | */ |
| 119 | public static final int CLIR_STATUS_NOT_PROVISIONED = 0; |
| 120 | /** |
| 121 | * Calling line identification restriction is currently provisioned in permanent mode. |
| 122 | * |
| 123 | * See TS 27.007, section 7.7 for more information. |
| 124 | */ |
| 125 | public static final int CLIR_STATUS_PROVISIONED_PERMANENT = 1; |
| 126 | /** |
| 127 | * Calling line identification restriction is currently unknown, e.g. no network, etc. |
| 128 | * |
| 129 | * See TS 27.007, section 7.7 for more information. |
| 130 | */ |
| 131 | public static final int CLIR_STATUS_UNKNOWN = 2; |
| 132 | /** |
| 133 | * Calling line identification restriction temporary mode, temporarily restricted. |
| 134 | * |
| 135 | * See TS 27.007, section 7.7 for more information. |
| 136 | */ |
| 137 | public static final int CLIR_STATUS_TEMPORARILY_RESTRICTED = 3; |
| 138 | /** |
| 139 | * Calling line identification restriction temporary mode, temporarily allowed. |
| 140 | * |
| 141 | * See TS 27.007, section 7.7 for more information. |
| 142 | */ |
| 143 | public static final int CLIR_STATUS_TEMPORARILY_ALLOWED = 4; |
| 144 | |
Brad Ebinger | c9a6aab | 2018-11-29 17:02:35 -0800 | [diff] [blame] | 145 | /**@hide*/ |
Brad Ebinger | 4123f95 | 2018-10-11 16:21:22 -0700 | [diff] [blame] | 146 | @IntDef(value = { |
| 147 | CLIR_STATUS_NOT_PROVISIONED, |
| 148 | CLIR_STATUS_PROVISIONED_PERMANENT, |
| 149 | CLIR_STATUS_UNKNOWN, |
| 150 | CLIR_STATUS_TEMPORARILY_RESTRICTED, |
| 151 | CLIR_STATUS_TEMPORARILY_ALLOWED |
| 152 | }, prefix = "CLIR_STATUS_") |
| 153 | @Retention(RetentionPolicy.SOURCE) |
| 154 | public @interface ClirInterrogationStatus {} |
| 155 | |
Wink Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 156 | // 0: disabled, 1: enabled |
Brad Ebinger | 0e370b4 | 2018-01-22 13:51:52 -0800 | [diff] [blame] | 157 | /** @hide */ |
Mathew Inwood | a838206 | 2018-08-16 17:01:12 +0100 | [diff] [blame] | 158 | @UnsupportedAppUsage |
Wink Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 159 | public int mStatus; |
Brad Ebinger | 0e370b4 | 2018-01-22 13:51:52 -0800 | [diff] [blame] | 160 | /** @hide */ |
Mathew Inwood | a838206 | 2018-08-16 17:01:12 +0100 | [diff] [blame] | 161 | @UnsupportedAppUsage |
Shriram Ganesh | ddf570e | 2015-05-31 09:18:48 -0700 | [diff] [blame] | 162 | public String mIcbNum; |
Ashit Sood | 51832a7 | 2018-05-02 11:25:22 -0700 | [diff] [blame] | 163 | /** @hide */ |
| 164 | public int mProvisionStatus = SERVICE_PROVISIONING_UNKNOWN; |
Brad Ebinger | 4123f95 | 2018-10-11 16:21:22 -0700 | [diff] [blame] | 165 | private int mClirInterrogationStatus = CLIR_STATUS_UNKNOWN; |
| 166 | private int mClirOutgoingState = CLIR_OUTGOING_DEFAULT; |
Wink Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 167 | |
Brad Ebinger | 4ae252f | 2018-03-29 11:12:24 -0700 | [diff] [blame] | 168 | /**@hide*/ |
Mathew Inwood | a838206 | 2018-08-16 17:01:12 +0100 | [diff] [blame] | 169 | @UnsupportedAppUsage |
Wink Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 170 | public ImsSsInfo() { |
| 171 | } |
| 172 | |
Brad Ebinger | 4ae252f | 2018-03-29 11:12:24 -0700 | [diff] [blame] | 173 | /** |
Brad Ebinger | 4123f95 | 2018-10-11 16:21:22 -0700 | [diff] [blame] | 174 | * Builds {@link ImsSsInfo} instances, which may include optional parameters. |
Brad Ebinger | 4ae252f | 2018-03-29 11:12:24 -0700 | [diff] [blame] | 175 | */ |
Brad Ebinger | 4123f95 | 2018-10-11 16:21:22 -0700 | [diff] [blame] | 176 | public static class Builder { |
| 177 | |
| 178 | private final ImsSsInfo mImsSsInfo; |
| 179 | |
| 180 | public Builder(@ServiceStatus int status) { |
| 181 | mImsSsInfo = new ImsSsInfo(); |
| 182 | mImsSsInfo.mStatus = status; |
| 183 | } |
| 184 | |
| 185 | /** |
| 186 | * Set the ICB number for IMS call barring. |
| 187 | * @param number The number in E.164 international format. |
| 188 | */ |
Brad Ebinger | c9a6aab | 2018-11-29 17:02:35 -0800 | [diff] [blame] | 189 | public @NonNull Builder setIncomingCommunicationBarringNumber(@NonNull String number) { |
Brad Ebinger | 4123f95 | 2018-10-11 16:21:22 -0700 | [diff] [blame] | 190 | mImsSsInfo.mIcbNum = number; |
| 191 | return this; |
| 192 | } |
| 193 | |
| 194 | /** |
| 195 | * Set the provisioning status for a Supplementary Service interrogation response. |
| 196 | */ |
Brad Ebinger | c9a6aab | 2018-11-29 17:02:35 -0800 | [diff] [blame] | 197 | public @NonNull Builder setProvisionStatus(@ServiceProvisionStatus int provisionStatus) { |
Brad Ebinger | 4123f95 | 2018-10-11 16:21:22 -0700 | [diff] [blame] | 198 | mImsSsInfo.mProvisionStatus = provisionStatus; |
| 199 | return this; |
| 200 | } |
| 201 | |
| 202 | /** |
| 203 | * Set the Calling Line Identification Restriction (CLIR) status for a supplementary service |
| 204 | * interrogation response. |
| 205 | */ |
Brad Ebinger | c9a6aab | 2018-11-29 17:02:35 -0800 | [diff] [blame] | 206 | public @NonNull Builder setClirInterrogationStatus(@ClirInterrogationStatus int status) { |
Brad Ebinger | 4123f95 | 2018-10-11 16:21:22 -0700 | [diff] [blame] | 207 | mImsSsInfo.mClirInterrogationStatus = status; |
| 208 | return this; |
| 209 | } |
| 210 | |
| 211 | /** |
| 212 | * Set the Calling line identification Restriction (CLIR) state for outgoing calls. |
| 213 | */ |
Brad Ebinger | c9a6aab | 2018-11-29 17:02:35 -0800 | [diff] [blame] | 214 | public @NonNull Builder setClirOutgoingState(@ClirOutgoingState int state) { |
Brad Ebinger | 4123f95 | 2018-10-11 16:21:22 -0700 | [diff] [blame] | 215 | mImsSsInfo.mClirOutgoingState = state; |
| 216 | return this; |
| 217 | } |
| 218 | |
| 219 | /** |
| 220 | * @return a built {@link ImsSsInfo} containing optional the parameters that were set. |
| 221 | */ |
Brad Ebinger | c9a6aab | 2018-11-29 17:02:35 -0800 | [diff] [blame] | 222 | public @NonNull ImsSsInfo build() { |
Brad Ebinger | 4123f95 | 2018-10-11 16:21:22 -0700 | [diff] [blame] | 223 | return mImsSsInfo; |
| 224 | } |
| 225 | } |
| 226 | |
| 227 | /** |
| 228 | * |
| 229 | * @param status The status of the service registration of activation/deactiviation. |
| 230 | * @param icbNum The Incoming barring number. |
| 231 | * @deprecated use {@link ImsSsInfo.Builder} instead. |
| 232 | */ |
| 233 | @Deprecated |
| 234 | public ImsSsInfo(@ServiceStatus int status, @Nullable String icbNum) { |
Brad Ebinger | 4ae252f | 2018-03-29 11:12:24 -0700 | [diff] [blame] | 235 | mStatus = status; |
| 236 | mIcbNum = icbNum; |
| 237 | } |
| 238 | |
Brad Ebinger | 0e370b4 | 2018-01-22 13:51:52 -0800 | [diff] [blame] | 239 | private ImsSsInfo(Parcel in) { |
Wink Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 240 | readFromParcel(in); |
| 241 | } |
| 242 | |
| 243 | @Override |
| 244 | public int describeContents() { |
| 245 | return 0; |
| 246 | } |
| 247 | |
| 248 | @Override |
| 249 | public void writeToParcel(Parcel out, int flags) { |
| 250 | out.writeInt(mStatus); |
Shriram Ganesh | ddf570e | 2015-05-31 09:18:48 -0700 | [diff] [blame] | 251 | out.writeString(mIcbNum); |
Ashit Sood | 51832a7 | 2018-05-02 11:25:22 -0700 | [diff] [blame] | 252 | out.writeInt(mProvisionStatus); |
Wink Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 253 | } |
| 254 | |
| 255 | @Override |
| 256 | public String toString() { |
Ashit Sood | 51832a7 | 2018-05-02 11:25:22 -0700 | [diff] [blame] | 257 | return super.toString() + ", Status: " + ((mStatus == 0) ? "disabled" : "enabled") |
| 258 | + ", ProvisionStatus: " + provisionStatusToString(mProvisionStatus); |
| 259 | } |
| 260 | |
| 261 | private static String provisionStatusToString(int pStatus) { |
| 262 | switch (pStatus) { |
| 263 | case SERVICE_NOT_PROVISIONED: |
| 264 | return "Service not provisioned"; |
| 265 | case SERVICE_PROVISIONED: |
| 266 | return "Service provisioned"; |
| 267 | default: |
| 268 | return "Service provisioning unknown"; |
| 269 | } |
Wink Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 270 | } |
| 271 | |
| 272 | private void readFromParcel(Parcel in) { |
| 273 | mStatus = in.readInt(); |
Shriram Ganesh | ddf570e | 2015-05-31 09:18:48 -0700 | [diff] [blame] | 274 | mIcbNum = in.readString(); |
Ashit Sood | 51832a7 | 2018-05-02 11:25:22 -0700 | [diff] [blame] | 275 | mProvisionStatus = in.readInt(); |
Wink Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 276 | } |
| 277 | |
Jeff Sharkey | 9e8f83d | 2019-02-28 12:06:45 -0700 | [diff] [blame^] | 278 | public static final @android.annotation.NonNull Creator<ImsSsInfo> CREATOR = |
Wink Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 279 | new Creator<ImsSsInfo>() { |
| 280 | @Override |
| 281 | public ImsSsInfo createFromParcel(Parcel in) { |
| 282 | return new ImsSsInfo(in); |
| 283 | } |
| 284 | |
| 285 | @Override |
| 286 | public ImsSsInfo[] newArray(int size) { |
| 287 | return new ImsSsInfo[size]; |
| 288 | } |
| 289 | }; |
Brad Ebinger | 0e370b4 | 2018-01-22 13:51:52 -0800 | [diff] [blame] | 290 | |
Brad Ebinger | 4ae252f | 2018-03-29 11:12:24 -0700 | [diff] [blame] | 291 | /** |
Brad Ebinger | 4123f95 | 2018-10-11 16:21:22 -0700 | [diff] [blame] | 292 | * @return Supplementary Service Configuration status. |
Brad Ebinger | 4ae252f | 2018-03-29 11:12:24 -0700 | [diff] [blame] | 293 | */ |
Brad Ebinger | 4123f95 | 2018-10-11 16:21:22 -0700 | [diff] [blame] | 294 | public @ServiceStatus int getStatus() { |
Brad Ebinger | 0e370b4 | 2018-01-22 13:51:52 -0800 | [diff] [blame] | 295 | return mStatus; |
| 296 | } |
| 297 | |
Brad Ebinger | 4123f95 | 2018-10-11 16:21:22 -0700 | [diff] [blame] | 298 | /** @deprecated Use {@link #getIncomingCommunicationBarringNumber()} instead.*/ |
| 299 | @Deprecated |
Brad Ebinger | 0e370b4 | 2018-01-22 13:51:52 -0800 | [diff] [blame] | 300 | public String getIcbNum() { |
| 301 | return mIcbNum; |
| 302 | } |
Ashit Sood | 51832a7 | 2018-05-02 11:25:22 -0700 | [diff] [blame] | 303 | |
| 304 | /** |
Brad Ebinger | 4123f95 | 2018-10-11 16:21:22 -0700 | [diff] [blame] | 305 | * @return The Incoming Communication Barring (ICB) number. |
Ashit Sood | 51832a7 | 2018-05-02 11:25:22 -0700 | [diff] [blame] | 306 | */ |
Brad Ebinger | 4123f95 | 2018-10-11 16:21:22 -0700 | [diff] [blame] | 307 | public String getIncomingCommunicationBarringNumber() { |
| 308 | return mIcbNum; |
| 309 | } |
| 310 | |
| 311 | /** |
| 312 | * @return Supplementary Service Provision status. |
| 313 | */ |
| 314 | public @ServiceProvisionStatus int getProvisionStatus() { |
Ashit Sood | 51832a7 | 2018-05-02 11:25:22 -0700 | [diff] [blame] | 315 | return mProvisionStatus; |
| 316 | } |
Brad Ebinger | 4123f95 | 2018-10-11 16:21:22 -0700 | [diff] [blame] | 317 | |
| 318 | /** |
| 319 | * @return the Calling Line Identification Restriction State for outgoing calls with respect to |
| 320 | * this subscription. Will be {@link #CLIR_OUTGOING_DEFAULT} if not applicable to this SS info. |
| 321 | */ |
| 322 | public @ClirOutgoingState int getClirOutgoingState() { |
| 323 | return mClirOutgoingState; |
| 324 | } |
| 325 | |
| 326 | /** |
| 327 | * @return the calling line identification restriction provisioning status upon interrogation of |
| 328 | * the service for this subscription. Will be {@link #CLIR_STATUS_UNKNOWN} if not applicable to |
| 329 | * this SS info. |
| 330 | */ |
| 331 | public @ClirInterrogationStatus int getClirInterrogationStatus() { |
| 332 | return mClirInterrogationStatus; |
| 333 | } |
Wink Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 334 | } |