1 /* 2 * Copyright (C) 2021 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 17 package com.android.libraries.entitlement; 18 19 import com.google.auto.value.AutoValue; 20 import com.google.common.collect.ImmutableList; 21 22 /** 23 * HTTP request parameters specific to on device service actiavation (ODSA). See GSMA spec TS.43 24 * section 6.2. 25 */ 26 @AutoValue 27 public abstract class EsimOdsaOperation { 28 /** 29 * OSDA operation: CheckEligibility. 30 */ 31 public static final String OPERATION_CHECK_ELIGIBILITY = "CheckEligibility"; 32 /** 33 * OSDA operation: ManageSubscription. 34 */ 35 public static final String OPERATION_MANAGE_SUBSCRIPTION = "ManageSubscription"; 36 /** 37 * OSDA operation: ManageService. 38 */ 39 public static final String OPERATION_MANAGE_SERVICE = "ManageService"; 40 /** 41 * OSDA operation: AcquireConfiguration. 42 */ 43 public static final String OPERATION_ACQUIRE_CONFIGURATION = "AcquireConfiguration"; 44 /** 45 * OSDA operation: AcquireTemporaryToken. 46 */ 47 public static final String OPERATION_ACQUIRE_TEMPORARY_TOKEN = "AcquireTemporaryToken"; 48 49 /** 50 * Indicates that operation_type is not set. 51 */ 52 public static final int OPERATION_TYPE_NOT_SET = -1; 53 /** 54 * To activate a subscription, used by {@link #OPERATION_MANAGE_SUBSCRIPTION}. 55 */ 56 public static final int OPERATION_TYPE_SUBSCRIBE = 0; 57 /** 58 * To cancel a subscription, used by {@link #OPERATION_MANAGE_SUBSCRIPTION}. 59 */ 60 public static final int OPERATION_TYPE_UNSUBSCRIBE = 1; 61 /** 62 * To manage an existing subscription, for {@link #OPERATION_MANAGE_SUBSCRIPTION}. 63 */ 64 public static final int OPERATION_TYPE_CHANGE_SUBSCRIPTION = 2; 65 /** 66 * To transfer a subscription from an existing device, used by {@link 67 * #OPERATION_MANAGE_SUBSCRIPTION}. 68 */ 69 public static final int OPERATION_TYPE_TRANSFER_SUBSCRIPTION = 3; 70 /** 71 * To inform the network of a subscription update, used by 72 * {@link #OPERATION_MANAGE_SUBSCRIPTION}. 73 */ 74 public static final int OPERATION_TYPE_UPDATE_SUBSCRIPTION = 4; 75 /** 76 * To activate a service, used by {@link #OPERATION_MANAGE_SERVICE}. 77 */ 78 public static final int OPERATION_TYPE_ACTIVATE_SERVICE = 10; 79 /** 80 * To deactivate a service, used by {@link #OPERATION_MANAGE_SERVICE}. 81 */ 82 public static final int OPERATION_TYPE_DEACTIVATE_SERVICE = 11; 83 84 /** 85 * Indicates the companion device carries the same MSISDN as the primary device. 86 */ 87 public static final String COMPANION_SERVICE_SHAERED_NUMBER = "SharedNumber"; 88 /** 89 * Indicates the companion device carries a different MSISDN as the primary device. 90 */ 91 public static final String COMPANION_SERVICE_DIFFERENT_NUMBER = "DiffNumber"; 92 93 /** 94 * Returns the eSIM ODSA operation. Used by HTTP parameter "operation". 95 */ operation()96 public abstract String operation(); 97 98 /** 99 * Returns the detiled type of the eSIM ODSA operation. Used by HTTP parameter 100 * "operation_type". 101 */ operationType()102 public abstract int operationType(); 103 104 /** 105 * Returns the comma separated list of operation targets used with temporary token from 106 * AcquireTemporaryToken operation. Used by HTTP parameter "operation_targets". 107 */ operationTargets()108 public abstract ImmutableList<String> operationTargets(); 109 110 /** 111 * Returns the unique identifier of the companion device, like IMEI. Used by HTTP parameter 112 * "companion_terminal_id". 113 */ companionTerminalId()114 public abstract String companionTerminalId(); 115 116 /** 117 * Returns the OEM of the companion device. Used by HTTP parameter "companion_terminal_vendor". 118 */ companionTerminalVendor()119 public abstract String companionTerminalVendor(); 120 121 /** 122 * Returns the model of the companion device. Used by HTTP parameter 123 * "companion_terminal_model". 124 */ companionTerminalModel()125 public abstract String companionTerminalModel(); 126 127 /** 128 * Returns the software version of the companion device. Used by HTTP parameter 129 * "companion_terminal_sw_version". 130 */ companionTerminalSoftwareVersion()131 public abstract String companionTerminalSoftwareVersion(); 132 133 /** 134 * Returns the user-friendly version of the companion device. Used by HTTP parameter 135 * "companion_terminal_friendly_name". 136 */ companionTerminalFriendlyName()137 public abstract String companionTerminalFriendlyName(); 138 139 /** 140 * Returns the service type of the companion device, e.g. if the MSISDN is same as the primary 141 * device. Used by HTTP parameter "companion_terminal_service". 142 */ companionTerminalService()143 public abstract String companionTerminalService(); 144 145 /** 146 * Returns the ICCID of the companion device. Used by HTTP parameter 147 * "companion_terminal_iccid". 148 */ companionTerminalIccid()149 public abstract String companionTerminalIccid(); 150 151 /** 152 * Returns the EID of the companion device. Used by HTTP parameter "companion_terminal_eid". 153 */ companionTerminalEid()154 public abstract String companionTerminalEid(); 155 156 /** 157 * Returns the ICCID of the primary device eSIM. Used by HTTP parameter "terminal_iccid". 158 */ terminalIccid()159 public abstract String terminalIccid(); 160 161 /** 162 * Returns the eUICC identifier (EID) of the primary device eSIM. Used by HTTP parameter 163 * "terminal_eid". 164 */ terminalEid()165 public abstract String terminalEid(); 166 167 /** 168 * Returns the unique identifier of the primary device eSIM, like the IMEI associated with the 169 * eSIM. Used by HTTP parameter "target_terminal_id". 170 */ targetTerminalId()171 public abstract String targetTerminalId(); 172 173 /** 174 * Returns the ICCID primary device eSIM. Used by HTTP parameter "target_terminal_iccid". 175 */ targetTerminalIccid()176 public abstract String targetTerminalIccid(); 177 178 /** 179 * Returns the eUICC identifier (EID) of the primary device eSIM. Used by HTTP parameter 180 * "target_terminal_eid". 181 */ targetTerminalEid()182 public abstract String targetTerminalEid(); 183 184 185 /** 186 * Returns the unique identifier of the old device eSIM, like the IMEI associated with the 187 * eSIM. Used by HTTP parameter "old_terminal_id". 188 */ oldTerminalId()189 public abstract String oldTerminalId(); 190 191 /** 192 * Returns the ICCID of old device eSIM. Used by HTTP parameter "old_terminal_iccid". 193 */ oldTerminalIccid()194 public abstract String oldTerminalIccid(); 195 196 /** 197 * Returns a new {@link Builder} object. 198 */ builder()199 public static Builder builder() { 200 return new AutoValue_EsimOdsaOperation.Builder() 201 .setOperation("") 202 .setOperationType(OPERATION_TYPE_NOT_SET) 203 .setOperationTargets(ImmutableList.of()) 204 .setCompanionTerminalId("") 205 .setCompanionTerminalVendor("") 206 .setCompanionTerminalModel("") 207 .setCompanionTerminalSoftwareVersion("") 208 .setCompanionTerminalFriendlyName("") 209 .setCompanionTerminalService("") 210 .setCompanionTerminalIccid("") 211 .setCompanionTerminalEid("") 212 .setTerminalIccid("") 213 .setTerminalEid("") 214 .setTargetTerminalId("") 215 .setTargetTerminalIccid("") 216 .setTargetTerminalEid("") 217 .setOldTerminalId("") 218 .setOldTerminalIccid(""); 219 } 220 221 /** 222 * Builder. 223 * 224 * <p>For ODSA, the rule of which parameters are required varies or each 225 * operation/opeation_type. The Javadoc below gives high-level description, but please refer to 226 * GMSA spec TS.43 section 6.2 for details. 227 */ 228 @AutoValue.Builder 229 public abstract static class Builder { 230 /** 231 * Sets the eSIM ODSA operation. Used by HTTP parameter "operation". 232 * 233 * <p>Required. 234 * 235 * @see #OPERATION_CHECK_ELIGIBILITY 236 * @see #OPERATION_MANAGE_SUBSCRIPTION 237 * @see #OPERATION_MANAGE_SERVICE 238 * @see #OPERATION_ACQUIRE_CONFIGURATION 239 */ setOperation(String value)240 public abstract Builder setOperation(String value); 241 242 /** 243 * Sets the detiled type of the eSIM ODSA operation. Used by HTTP parameter "operation_type" 244 * if set. 245 * 246 * <p>Required by some operation. 247 * 248 * @see #OPERATION_TYPE_SUBSCRIBE 249 * @see #OPERATION_TYPE_UNSUBSCRIBE 250 * @see #OPERATION_TYPE_CHANGE_SUBSCRIPTION 251 * @see #OPERATION_TYPE_TRANSFER_SUBSCRIPTION 252 * @see #OPERATION_TYPE_UPDATE_SUBSCRIPTION 253 * @see #OPERATION_TYPE_ACTIVATE_SERVICE 254 * @see #OPERATION_TYPE_DEACTIVATE_SERVICE 255 */ setOperationType(int value)256 public abstract Builder setOperationType(int value); 257 258 /** 259 * Sets the operation targets to be used with temporary token from AcquireTemporaryToken 260 * operation. Used by HTTP parameter "operation_targets" if set. 261 */ setOperationTargets(ImmutableList<String> value)262 public abstract Builder setOperationTargets(ImmutableList<String> value); 263 264 /** 265 * Sets the unique identifier of the companion device, like IMEI. Used by HTTP parameter 266 * "companion_terminal_id" if set. 267 * 268 * <p>Used by companion device ODSA operation. 269 */ setCompanionTerminalId(String value)270 public abstract Builder setCompanionTerminalId(String value); 271 272 /** 273 * Sets the OEM of the companion device. Used by HTTP parameter "companion_terminal_vendor" 274 * if set. 275 * 276 * <p>Used by companion device ODSA operation. 277 */ setCompanionTerminalVendor(String value)278 public abstract Builder setCompanionTerminalVendor(String value); 279 280 /** 281 * Sets the model of the companion device. Used by HTTP parameter "companion_terminal_model" 282 * if set. 283 * 284 * <p>Used by companion device ODSA operation. 285 */ setCompanionTerminalModel(String value)286 public abstract Builder setCompanionTerminalModel(String value); 287 288 /** 289 * Sets the software version of the companion device. Used by HTTP parameter 290 * "companion_terminal_sw_version" if set. 291 * 292 * <p>Used by companion device ODSA operation. 293 */ setCompanionTerminalSoftwareVersion(String value)294 public abstract Builder setCompanionTerminalSoftwareVersion(String value); 295 296 /** 297 * Sets the user-friendly version of the companion device. Used by HTTP parameter 298 * "companion_terminal_friendly_name" if set. 299 * 300 * <p>Used by companion device ODSA operation. 301 */ setCompanionTerminalFriendlyName(String value)302 public abstract Builder setCompanionTerminalFriendlyName(String value); 303 304 /** 305 * Sets the service type of the companion device, e.g. if the MSISDN is same as the primary 306 * device. Used by HTTP parameter "companion_terminal_service" if set. 307 * 308 * <p>Used by companion device ODSA operation. 309 * 310 * @see #COMPANION_SERVICE_SHAERED_NUMBER 311 * @see #COMPANION_SERVICE_DIFFERENT_NUMBER 312 */ setCompanionTerminalService(String value)313 public abstract Builder setCompanionTerminalService(String value); 314 315 /** 316 * Sets the ICCID of the companion device. Used by HTTP parameter "companion_terminal_iccid" 317 * if set. 318 * 319 * <p>Used by companion device ODSA operation. 320 */ setCompanionTerminalIccid(String value)321 public abstract Builder setCompanionTerminalIccid(String value); 322 323 /** 324 * Sets the eUICC identifier (EID) of the companion device. Used by HTTP parameter 325 * "companion_terminal_eid" if set. 326 * 327 * <p>Used by companion device ODSA operation. 328 */ setCompanionTerminalEid(String value)329 public abstract Builder setCompanionTerminalEid(String value); 330 331 /** 332 * Sets the ICCID of the primary device eSIM in case of primary SIM not present. Used by 333 * HTTP parameter "terminal_eid" if set. 334 * 335 * <p>Used by primary device ODSA operation. 336 */ setTerminalIccid(String value)337 public abstract Builder setTerminalIccid(String value); 338 339 /** 340 * Sets the eUICC identifier (EID) of the primary device eSIM in case of primary SIM not 341 * present. Used by HTTP parameter "terminal_eid" if set. 342 * 343 * <p>Used by primary device ODSA operation. 344 */ setTerminalEid(String value)345 public abstract Builder setTerminalEid(String value); 346 347 /** 348 * Sets the unique identifier of the primary device eSIM in case of multiple SIM, like the 349 * IMEI associated with the eSIM. Used by HTTP parameter "target_terminal_id" if set. 350 * 351 * <p>Used by primary device ODSA operation. 352 */ setTargetTerminalId(String value)353 public abstract Builder setTargetTerminalId(String value); 354 355 /** 356 * Sets the ICCID primary device eSIM in case of multiple SIM. Used by HTTP parameter 357 * "target_terminal_iccid" if set. 358 * 359 * <p>Used by primary device ODSA operation. 360 */ setTargetTerminalIccid(String value)361 public abstract Builder setTargetTerminalIccid(String value); 362 363 /** 364 * Sets the eUICC identifier (EID) of the primary device eSIM in case of multiple SIM. Used 365 * by HTTP parameter "target_terminal_eid" if set. 366 * 367 * <p>Used by primary device ODSA operation. 368 */ setTargetTerminalEid(String value)369 public abstract Builder setTargetTerminalEid(String value); 370 371 /** 372 * Sets the unique identifier of the old device eSIM, like the IMEI associated with the 373 * eSIM. Used by HTTP parameter "old_terminal_id" if set. 374 * 375 * <p>Used by primary device ODSA operation. 376 */ setOldTerminalId(String value)377 public abstract Builder setOldTerminalId(String value); 378 379 /** 380 * Sets the ICCID old device eSIM. Used by HTTP parameter "old_terminal_iccid" if set. 381 * 382 * <p>Used by primary device ODSA operation. 383 */ setOldTerminalIccid(String value)384 public abstract Builder setOldTerminalIccid(String value); 385 build()386 public abstract EsimOdsaOperation build(); 387 } 388 } 389