diff options
author | samalin <samalin@google.com> | 2020-12-21 17:33:02 +0800 |
---|---|---|
committer | samalin <samalin@google.com> | 2020-12-24 23:20:52 +0800 |
commit | e2877642062a4ee7ef20219755b9fa3bae39eba7 (patch) | |
tree | 9aa64d7996dfcac271b5e08c449cd5b2e671bfdc | |
parent | 2819bd5a84782a57ab062baf95a6a10568506c03 (diff) | |
download | service_entitlement-e2877642062a4ee7ef20219755b9fa3bae39eba7.tar.gz |
Add TS.43 lib interfaces and data classes
This CL is for uploading interfaces of service entitlement, the
implementatiob will submit in the follow CLs.
Bug: 173450048
Test: presubmit
Change-Id: I2ad37afc27cbfbd05e66d30eb7cbb178053c2ef6
7 files changed, 718 insertions, 0 deletions
diff --git a/Android.bp b/Android.bp new file mode 100644 index 0000000..4e110e7 --- /dev/null +++ b/Android.bp @@ -0,0 +1,28 @@ +// +// Copyright (C) 2020 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. + +java_library { + name: "service-entitlement", + + srcs: [ + "java/**/*.java", + ], + libs: [ + "auto_value_annotations", + ], + plugins: ["auto_value_plugin"], + sdk_version: "current", + min_sdk_version: "30", +} @@ -0,0 +1,3 @@ +mewan@google.com +samalin@google.com +danielwbhuang@google.com diff --git a/java/com/google/android/libraries/entitlement/CarrierData.java b/java/com/google/android/libraries/entitlement/CarrierData.java new file mode 100644 index 0000000..2153fda --- /dev/null +++ b/java/com/google/android/libraries/entitlement/CarrierData.java @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2020 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.google.android.libraries.entitlement; + +import com.google.auto.value.AutoValue; + +/** + * Carrier specific customization to be used in the service entitlement queries and operations. + * + * @see #ServiceEntitlement + */ +@AutoValue +public abstract class CarrierData { + /** + * The carrier's entitlement server URL. If not set, will use {@code + * https://aes.mnc<MNC>.mcc<MCC>.pub.3gppnetwork.org} as defined in GSMA spec TS.43 section 2.1. + */ + public abstract String serverUrl(); + + // Builder... +} diff --git a/java/com/google/android/libraries/entitlement/EsimOdsaOperation.java b/java/com/google/android/libraries/entitlement/EsimOdsaOperation.java new file mode 100644 index 0000000..1247824 --- /dev/null +++ b/java/com/google/android/libraries/entitlement/EsimOdsaOperation.java @@ -0,0 +1,288 @@ +/* + * Copyright (C) 2020 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.google.android.libraries.entitlement; + +import com.google.auto.value.AutoValue; + +/** + * HTTP request parameters specific to on device service actiavation (ODSA). See GSMA spec TS.43 + * section 6.2. + */ +@AutoValue +public abstract class EsimOdsaOperation { + /** OSDA operation: CheckEligibility. */ + public static final String OPERATION_CHECK_ELIGIBILITY = "CheckEligibility"; + /** OSDA operation: ManageSubscription. */ + public static final String OPERATION_MANAGE_SUBSCRIPTION = "ManageSubscription"; + /** OSDA operation: ManageService. */ + public static final String OPERATION_MANAGE_SERVICE = "ManageService"; + /** OSDA operation: AcquireConfiguration. */ + public static final String OPERATION_ACQUIRE_CONFIGURATION = "AcquireConfiguration"; + + /** Indicates that operation_type is not set. */ + static final int OPERATION_TYPE_NOT_SET = -1; + /** To activate a subscription, used by {@link #OPERATION_MANAGE_SUBSCRIPTION}. */ + public static final int OPERATION_TYPE_SUBSCRIBE = 0; + /** To cancel a subscription, used by {@link #OPERATION_MANAGE_SUBSCRIPTION}. */ + public static final int OPERATION_TYPE_UNSUBSCRIBE = 1; + /** To manage an existing subscription, for {@link #OPERATION_MANAGE_SUBSCRIPTION}. */ + public static final int OPERATION_TYPE_CHANGE_SUBSCRIPTION = 2; + /** + * To transfer a subscription from an existing device, used by {@link + * #OPERATION_MANAGE_SUBSCRIPTION}. + */ + public static final int OPERATION_TYPE_TRANSFER_SUBSCRIPTION = 3; + /** + * To inform the network of a subscription update, used by {@link #OPERATION_MANAGE_SUBSCRIPTION}. + */ + public static final int OPERATION_TYPE_UPDATE_SUBSCRIPTION = 4; + /** To activate a service, used by {@link #OPERATION_MANAGE_SERVICE}. */ + public static final int OPERATION_TYPE_ACTIVATE_SERVICE = 10; + /** To deactivate a service, used by {@link #OPERATION_MANAGE_SERVICE}. */ + public static final int OPERATION_TYPE_DEACTIVATE_SERVICE = 11; + + /** Indicates the companion device carries the same MSISDN as the primary device. */ + public static final String COMPANION_SERVICE_SHAERED_NUMBER = "SharedNumber"; + /** Indicates the companion device carries a different MSISDN as the primary device. */ + public static final String COMPANION_SERVICE_DIFFERENT_NUMBER = "DiffNumber"; + + /** Returns the eSIM ODSA operation. Used by HTTP parameter "operation". */ + public abstract String operation(); + + /** + * Returns the detiled type of the eSIM ODSA operation. Used by HTTP parameter "operation_type". + */ + public abstract int operationType(); + + /** + * Returns the unique identifier of the companion device, like IMEI. Used by HTTP parameter + * "companion_terminal_id". + */ + public abstract String companionTerminalId(); + + /** + * Returns the OEM of the companion device. Used by HTTP parameter "companion_terminal_vendor". + */ + public abstract String companionTerminalVendor(); + + /** + * Returns the model of the companion device. Used by HTTP parameter "companion_terminal_model". + */ + public abstract String companionTerminalModel(); + + /** + * Returns the software version of the companion device. Used by HTTP parameter + * "companion_terminal_sw_version". + */ + public abstract String companionTerminalSoftwareVersion(); + + /** + * Returns the user-friendly version of the companion device. Used by HTTP parameter + * "companion_terminal_friendly_name". + */ + public abstract String companionTerminalFriendlyName(); + + /** + * Returns the service type of the companion device, e.g. if the MSISDN is same as the primary + * device. Used by HTTP parameter "companion_terminal_service". + */ + public abstract String companionTerminalService(); + + /** + * Returns the ICCID of the companion device. Used by HTTP parameter "companion_terminal_iccid". + */ + public abstract String companionTerminalIccid(); + + /** + * Returns the ICCID of the companion device. Used by HTTP parameter "companion_terminal_iccid". + */ + public abstract String companionTerminalEid(); + + /** Returns the ICCID of the primary device eSIM. Used by HTTP parameter "terminal_eid". */ + public abstract String terminalIccid(); + + /** + * Returns the eUICC identifier (EID) of the primary device eSIM. Used by HTTP parameter + * "terminal_eid". + */ + public abstract String terminalEid(); + + /** + * Returns the unique identifier of the primary device eSIM, like the IMEI associated with the + * eSIM. Used by HTTP parameter "target_terminal_id". + */ + public abstract String targetTerminalId(); + + /** Returns the ICCID primary device eSIM. Used by HTTP parameter "target_terminal_iccid". */ + public abstract String targetTerminalIccid(); + + /** + * Returns the eUICC identifier (EID) of the primary device eSIM. Used by HTTP parameter + * "target_terminal_eid". + */ + public abstract String targetTerminalEid(); + + /** Returns a new {@link Builder} object. */ + public static Builder builder() { + return new AutoValue_EsimOdsaOperation.Builder().setOperationType(OPERATION_TYPE_NOT_SET); + } + + /** + * Builder. + * + * <p>For ODSA, the rule of which parameters are required varies or each operation/opeation_type. + * The Javadoc below gives high-level description, but please refer to GMSA spec TS.43 section 6.2 + * for details. + */ + @AutoValue.Builder + public abstract static class Builder { + /** + * Sets the eSIM ODSA operation. Used by HTTP parameter "operation". + * + * <p>Required. + * + * @see #OPERATION_CHECK_ELIGIBILITY + * @see #OPERATION_MANAGE_SUBSCRIPTION + * @see #OPERATION_MANAGE_SERVICE + * @see #OPERATION_ACQUIRE_CONFIGURATION + */ + public abstract Builder setOperation(String value); + + /** + * Sets the detiled type of the eSIM ODSA operation. Used by HTTP parameter "operation_type" if + * set. + * + * <p>Required by some operation. + * + * @see #OPERATION_TYPE_SUBSCRIBE + * @see #OPERATION_TYPE_UNSUBSCRIBE + * @see #OPERATION_TYPE_CHANGE_SUBSCRIPTION + * @see #OPERATION_TYPE_TRANSFER_SUBSCRIPTION + * @see #OPERATION_TYPE_UPDATE_SUBSCRIPTION + * @see #OPERATION_TYPE_ACTIVATE_SERVICE + * @see #OPERATION_TYPE_DEACTIVATE_SERVICE + */ + public abstract Builder setOperationType(int value); + + /** + * Sets the unique identifier of the companion device, like IMEI. Used by HTTP parameter + * "companion_terminal_id" if set. + * + * <p>Used by companion device ODSA operation. + */ + public abstract Builder setCompanionTerminalId(String value); + + /** + * Sets the OEM of the companion device. Used by HTTP parameter "companion_terminal_vendor" if + * set. + * + * <p>Used by companion device ODSA operation. + */ + public abstract Builder setCompanionTerminalVendor(String value); + + /** + * Sets the model of the companion device. Used by HTTP parameter "companion_terminal_model" if + * set. + * + * <p>Used by companion device ODSA operation. + */ + public abstract Builder setCompanionTerminalModel(String value); + + /** + * Sets the software version of the companion device. Used by HTTP parameter + * "companion_terminal_sw_version" if set. + * + * <p>Used by companion device ODSA operation. + */ + public abstract Builder setCompanionTerminalSoftwareVersion(String value); + + /** + * Sets the user-friendly version of the companion device. Used by HTTP parameter + * "companion_terminal_friendly_name" if set. + * + * <p>Used by companion device ODSA operation. + */ + public abstract Builder setCompanionTerminalFriendlyName(String value); + + /** + * Sets the service type of the companion device, e.g. if the MSISDN is same as the primary + * device. Used by HTTP parameter "companion_terminal_service" if set. + * + * <p>Used by companion device ODSA operation. + * + * @see #COMPANION_SERVICE_SHAERED_NUMBER + * @see #COMPANION_SERVICE_DIFFERENT_NUMBER + */ + public abstract Builder setCompanionTerminalService(String value); + + /** + * Sets the ICCID of the companion device. Used by HTTP parameter "companion_terminal_iccid" if + * set. + * + * <p>Used by companion device ODSA operation. + */ + public abstract Builder setCompanionTerminalIccid(String value); + + /** + * Sets the eUICC identifier (EID) of the companion device. Used by HTTP parameter + * "companion_terminal_eid" if set. + * + * <p>Used by companion device ODSA operation. + */ + public abstract Builder setCompanionTerminalEid(String value); + + /** + * Sets the ICCID of the primary device eSIM. Used by HTTP parameter "terminal_eid" if set. + * + * <p>Used by primary device ODSA operation. + */ + public abstract Builder setTerminalIccid(String value); + + /** + * Sets the eUICC identifier (EID) of the primary device eSIM. Used by HTTP parameter + * "terminal_eid" if set. + * + * <p>Used by primary device ODSA operation. + */ + public abstract Builder setTerminalEid(String value); + + /** + * Sets the unique identifier of the primary device eSIM, like the IMEI associated with the + * eSIM. Used by HTTP parameter "target_terminal_id" if set. + * + * <p>Used by primary device ODSA operation. + */ + public abstract Builder setTargetTerminalId(String value); + + /** + * Sets the ICCID primary device eSIM. Used by HTTP parameter "target_terminal_iccid" if set. + * + * <p>Used by primary device ODSA operation. + */ + public abstract Builder setTargetTerminalIccid(String value); + + /** + * Sets the eUICC identifier (EID) of the primary device eSIM. Used by HTTP parameter + * "target_terminal_eid" if set. + * + * <p>Used by primary device ODSA operation. + */ + public abstract Builder setTargetTerminalEid(String value); + + public abstract EsimOdsaOperation build(); + } +} diff --git a/java/com/google/android/libraries/entitlement/ServiceEntitlement.java b/java/com/google/android/libraries/entitlement/ServiceEntitlement.java new file mode 100644 index 0000000..ea4eec1 --- /dev/null +++ b/java/com/google/android/libraries/entitlement/ServiceEntitlement.java @@ -0,0 +1,122 @@ +/* + * Copyright (C) 2020 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.google.android.libraries.entitlement; + +import java.util.List; + +/** + * Implemnets protocol for carrier service entitlement configuration query and operation, based on + * GSMA TS.43 spec. + */ +public class ServiceEntitlement { + /** App ID for Voice-Over-LTE entitlement. */ + public static final String APP_VOLTE = "ap2003"; + /** App ID for Voice-Over-WiFi entitlement. */ + public static final String APP_VOWIFI = "ap2004"; + /** App ID for SMS-Over-IP entitlement. */ + public static final String APP_SMSOIP = "ap2005"; + /** App ID for on device service activation (OSDA) for companion device. */ + public static final String APP_ODSA_COMPANION = "ap2006"; + /** App ID for on device service activation (OSDA) for primary device. */ + public static final String APP_ODSA_PRIMARY = "ap2009"; + + /** + * Creates an instance for service entitlement configuration query and operation for the carrier. + * + * @param carrierData carrier specific data used in the queries and operations. + * @param simSubscriptionId the subscroption ID of the carrier's SIM on device. This indicates + * which SIM to retrieve IMEI/IMSI from and perform EAP-AKA authentication with. See {@link + * android.telephony.SubscriptionManager} for how to get the subscroption ID. + */ + public ServiceEntitlement(CarrierData carrierData, int simSubscriptionId) {} + + /** + * Retrieves service entitlement configuration. For on device service activation (ODSA) of eSIM + * for companion/primary devices, use {@link #performEsimOdsa} instead. + * + * <p>Supported {@code appId}: {@link #APP_VOLTE}, {@link #APP_VOWIFI}, {@link #APP_SMSOIP}. + * + * <p>This method sends an HTTP GET request to entitlement server, responds to EAP-AKA challenge + * if needed, and returns the raw configuration doc as a string. The following parameters are set + * in the HTTP request: + * + * <ul> + * <li>"app": {@code appId} + * <li>"vers": 0, or {@code request.configurationVersion()} if it's not 0. + * <li>"entitlement_version": "2.0", or {@code request.entitlementVersion()} if it's not empty. + * <li>"token": not set, or {@code request.authenticationToken()} if it's not empty. + * <li>"IMSI": if "token" is set, set to {@link android.telephony.TelephonyManager#getImei}. + * <li>"EAP_ID": if "token" is not set, set this parameter to trigger embedded EAP-AKA + * authentication as decribed in TS.43 section 2.6.1. Its value is derived from IMSI as per + * GSMA spec RCC.14 section C.2. + * <li>"terminal_id": IMEI, or {@code request.terminalId()} if it's not empty. + * <li>"terminal_vendor": {@link android.os.Build#MANUFACTURER}, or {@code + * request.terminalVendor()} if it's not empty. + * <li>"terminal_model": {@link android.os.Build#MODEL}, or {@code request.terminalModel()} if + * it's not empty. + * <li>"terminal_sw_version": {@llink android.os.Build.VERSION#BASE_OS}, or {@code + * request.terminalSoftwareVersion()} if it's not empty. + * <li>"app_name": not set, or {@code request.appName()} if it's not empty. + * <li>"app_version": not set, or {@code request.appVersion()} if it's not empty. + * <li>"notif_token": not set, or {@code request.notificationToken()} if it's not empty. + * <li>"notif_action": {@code request.notificationAction()} if "notif_token" is set, otherwise + * not set. + * </ul> + * + * <p>Requires permission: READ_PRIVILEGED_PHONE_STATE, or carrier privilege. + * + * @param appId an app ID string defined in TS.43 section 2.2, e.g. {@link #APP_VOWIFI}. + * @param request contains parameters that can be used in the HTTP request. + */ + public String queryEntitlementStatus(String appId, ServiceEntitlementRequest request) + throws ServiceEntitlementException { + // TODO(samalin): Add implementation + return null; + } + + /** + * Retrieves service entitlement configurations for multiple app IDs in one HTTP request/response. + * For on device service activation (ODSA) of eSIM for companion/primary devices, use {@link + * #performEsimOdsa} instead. + * + * <p>Same with {@link #queryEntitlementStatus(String, ServiceEntitlementRequest)} except that + * multiple "app" parameters will be set in the HTTP request, in the order as they appear in + * parameter {@code appIds}. + */ + public String queryEntitlementStatus(List<String> appIds, ServiceEntitlementRequest request) + throws ServiceEntitlementException { + // TODO(samalin): Add implementation + return null; + } + + /** + * Performs on device service activation (ODSA) of eSIM for companion/primary devices. + * + * <p>Supported {@code appId}: {@link #APP_ODSA_COMPANION}, {@link #APP_ODSA_PRIMARY}. + * + * <p>Similar to {@link #queryEntitlementStatus(String, ServiceEntitlementRequest)}, this method + * sends an HTTP GET request to entitlement server, responds to EAP-AKA challenge if needed, and + * returns the raw configuration doc as a string. Additional parameters from {@code operation} + * are set to the HTTP request. See {@link EsimOdsaOperation} for details. + */ + public String performEsimOdsa( + String appId, ServiceEntitlementRequest request, EsimOdsaOperation operation) + throws ServiceEntitlementException { + // TODO(samalin): Add implementation + return null; + } +} diff --git a/java/com/google/android/libraries/entitlement/ServiceEntitlementException.java b/java/com/google/android/libraries/entitlement/ServiceEntitlementException.java new file mode 100644 index 0000000..b632e2f --- /dev/null +++ b/java/com/google/android/libraries/entitlement/ServiceEntitlementException.java @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2020 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.google.android.libraries.entitlement; + +/** Indicates errors happened in retrieving service entitlement configuration. */ +public class ServiceEntitlementException extends Exception { + /** Unknown error. */ + public static final int ERROR_UNKNOWN = 0; + /** Android telephony is unable to provide info like IMSI, e.g. when modem crashed. */ + public static final int ERROR_PHONE_NOT_AVAILABLE = 1; + /** + * SIM not returning a response to the EAP-AKA challenge, e.g. when the challenge is invalid. This + * can happen only when an embedded EAP-AKA challange is conducted, as per GMSA spec TS.43 section + * 2.6.1. + */ + public static final int ERROR_ICC_AUTHENTICATION_NOT_AVAILABLE = 2; + /** + * Cannot connect to the entitlment server, e.g. due to weak mobile network and Wi-Fi connection. + */ + public static final int ERROR_SEVER_NOT_CONNECTABLE = 3; + /** + * HTTP response received with a status code indicating failure, e.g. 4xx and 5xx. Use {@link + * #getHttpStatus} to get the status code and {@link #getMessage} the error message in the + * response body. + */ + public static final int ERROR_HTTP_STATUS_NOT_SUCCESS = 4; + + public ServiceEntitlementException( + int error, int httpStatus, String retryAfter, String message, Throwable cause) {} + + /** Returns the error code, see {@link #ERROR_*}. */ + public int getErrorCode() { + // TODO(samalin): add implementation + return ERROR_UNKNOWN; + } + /** Returns the HTTP status code returned by entitlement server; 0 if unavailable. */ + public int getHttpStatus() { + // TODO(samalin): add implementation + return ERROR_SEVER_NOT_CONNECTABLE; + } + /** + * Returns the "Retry-After" header in HTTP response, often set with HTTP status code 503; an + * empty string if unavailable. + * + * @return the HTTP-date or a number of seconds to delay, as defiend in RFC 7231: + * https://tools.ietf.org/html/rfc7231#section-7.1.3 + */ + public String getRetryAfter() { + // TODO(samalin): add implementation + return null; + } +} diff --git a/java/com/google/android/libraries/entitlement/ServiceEntitlementRequest.java b/java/com/google/android/libraries/entitlement/ServiceEntitlementRequest.java new file mode 100644 index 0000000..032579c --- /dev/null +++ b/java/com/google/android/libraries/entitlement/ServiceEntitlementRequest.java @@ -0,0 +1,176 @@ +/* + * Copyright (C) 2020 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.google.android.libraries.entitlement; + +import com.google.auto.value.AutoValue; + +/** Service entitlement HTTP request parameters, as defiend in GSMA spec TS.43 section 2.2. */ +@AutoValue +public abstract class ServiceEntitlementRequest { + /** Disables notification token. */ + public static final int NOTICATION_ACTION_DISABLE = 0; + /** Enables FCM notification token. */ + public static final int NOTICATION_ACTION_ENABLE_FCM = 2; + + /** + * Returns the version of configuration currently stored on the client. Used by HTTP parameter + * "vers". + */ + public abstract int configurationVersion(); + + /** + * Returns the version of the entitlement specification. Used by HTTP parameter + * "entitlement_version". + */ + public abstract String entitlementVersion(); + + /** Returns the authentication token. Used by HTTP parameter "token". */ + public abstract String authenticationToken(); + + /** + * Returns the unique identifier of the device like IMEI. Used by HTTP parameter "terminal_id". + */ + public abstract String terminalId(); + + /** Returns the OEM of the device. Used by HTTP parameter "terminal_vendor". */ + public abstract String terminalVendor(); + + /** Returns the model of the device. Used by HTTP parameter "terminal_model". */ + public abstract String terminalModel(); + + /** Returns the software version of the device. Used by HTTP parameter "terminal_sw_version". */ + public abstract String terminalSoftwareVersion(); + + /** + * Returns the name of the device application making the request. Used by HTTP parameter + * "app_name". + */ + public abstract String appName(); + + /** + * Returns the version of the device application making the request. Used by HTTP parameter + * "app_version". + */ + public abstract String appVersion(); + + /** + * Returns the FCM registration token used to register for entitlement configuration request from + * network. Used by HTTP parameter "notif_token". + */ + public abstract String notificationToken(); + + /** + * Returns the action associated with the FCM registration token. Used by HTTP parameter + * "notif_action". + * + * @see #NOTICATION_ACTION_ENABLE_FCM + * @see #NOTICATION_ACTION_DISABLE + */ + public abstract int notificationAction(); + + /** Returns a new {@link Builder} object. */ + public static Builder builder() { + return new AutoValue_ServiceEntitlementRequest.Builder() + .setConfigurationVersion(0) + .setEntitlementVersion("2.0") + .setNotificationAction(NOTICATION_ACTION_ENABLE_FCM); + } + + /** Builder. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * Sets the version of configuration currently stored on the client. Used by HTTP parameter + * "vers". + * + * <p>If not set, default to 0 indicating no existing configuration. + */ + public abstract Builder setConfigurationVersion(int value); + /** + * Sets the version of configuration currently stored on the client. Used by HTTP parameter + * "vers". + * + * <p>If not set, default to "2.0". + */ + public abstract Builder setEntitlementVersion(String value); + /** + * Sets the authentication token. Used by HTTP parameter "token". + * + * <p>If not set, will trigger embedded EAP-AKA authentication as decribed in TS.43 section + * 2.6.1. + */ + public abstract Builder setAuthenticationToken(String value); + /** + * Sets the unique identifier of the device like IMEI. Used by HTTP parameter "terminal_id". + * + * <p>If not set, will use the device IMEI. + */ + public abstract Builder setTerminalId(String value); + /** + * Sets the OEM of the device. Used by HTTP parameter "terminal_vendor". + * + * <p>If not set, will use {@link android.os.Build#MANUFACTURER}. + */ + public abstract Builder setTerminalVendor(String value); + /** + * Sets the model of the device. Used by HTTP parameter "terminal_model". + * + * <p>If not set, will use {@link android.os.Build#MODEL}. + */ + public abstract Builder setTerminalModel(String value); + /** + * Sets the software version of the device. Used by HTTP parameter "terminal_sw_version". + * + * <p>If not set, will use {@link android.os.Build.VERSION#BASE_OS}. + */ + public abstract Builder setTerminalSoftwareVersion(String value); + /** + * Sets the name of the device application making the request. Used by HTTP parameter + * "app_name". + * + * <p>Optional. + */ + public abstract Builder setAppName(String value); + /** + * Sets the version of the device application making the request. Used by HTTP parameter + * "app_version". + * + * <p>Optional. + */ + public abstract Builder setAppVersion(String value); + /** + * Sets the FCM registration token used to register for entitlement configuration request from + * network. Used by HTTP parameter "notif_token". + * + * <p>Optional. + */ + public abstract Builder setNotificationToken(String value); + /** + * Sets the action associated with the FCM registration token. Used by HTTP parameter + * "notif_action". + * + * <p>Required if a token is set with {@link #setNotificationToken}, and default to {@link + * #NOTICATION_ACTION_ENABLE_FCM}; otherwise ignored. + * + * @see #NOTICATION_ACTION_ENABLE_FCM + * @see #NOTICATION_ACTION_DISABLE + */ + public abstract Builder setNotificationAction(int value); + + public abstract ServiceEntitlementRequest build(); + } +} |