aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Yu <jackyu@google.com>2023-07-24 19:14:43 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-07-24 19:14:43 +0000
commitaec5af98245460f70244edf6a1201cf237904be2 (patch)
treefb9e0c162f669c181fc495114fba43360383d258
parentbca5aa5f14971dfe194d10054a22ffb3768cb967 (diff)
parent37ec83c3b878e380a246d827300ca1b1d970346e (diff)
downloadservice_entitlement-aec5af98245460f70244edf6a1201cf237904be2.tar.gz
Fixed incorrect nullability am: 2003d51422 am: 37ec83c3b8
Original change: https://android-review.googlesource.com/c/platform/frameworks/libs/service_entitlement/+/2670168 Change-Id: I7b729ea7a0c5e3645a38a02199d3dd009f5df555 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--java/com/android/libraries/entitlement/ServiceEntitlement.java25
-rw-r--r--java/com/android/libraries/entitlement/eapaka/EapAkaApi.java10
2 files changed, 23 insertions, 12 deletions
diff --git a/java/com/android/libraries/entitlement/ServiceEntitlement.java b/java/com/android/libraries/entitlement/ServiceEntitlement.java
index a4c3b3b..398e0a9 100644
--- a/java/com/android/libraries/entitlement/ServiceEntitlement.java
+++ b/java/com/android/libraries/entitlement/ServiceEntitlement.java
@@ -18,7 +18,7 @@ package com.android.libraries.entitlement;
import android.content.Context;
-import androidx.annotation.Nullable;
+import androidx.annotation.NonNull;
import androidx.annotation.VisibleForTesting;
import com.android.libraries.entitlement.eapaka.EapAkaApi;
@@ -201,7 +201,7 @@ public class ServiceEntitlement {
* @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.
*/
- @Nullable
+ @NonNull
public String queryEntitlementStatus(String appId, ServiceEntitlementRequest request)
throws ServiceEntitlementException {
return queryEntitlementStatus(ImmutableList.of(appId), request);
@@ -216,12 +216,11 @@ public class ServiceEntitlement {
* multiple "app" parameters will be set in the HTTP request, in the order as they appear in
* parameter {@code appIds}.
*/
- @Nullable
+ @NonNull
public String queryEntitlementStatus(ImmutableList<String> appIds,
ServiceEntitlementRequest request)
throws ServiceEntitlementException {
- HttpResponse response = getEntitlementStatusResponse(appIds, request);
- return response == null ? null : response.body();
+ return getEntitlementStatusResponse(appIds, request).body();
}
/**
@@ -232,7 +231,7 @@ public class ServiceEntitlement {
* <p>Same as {@link #queryEntitlementStatus(ImmutableList, ServiceEntitlementRequest)}
* except that it returns the full HTTP response instead of just the body.
*/
- @Nullable
+ @NonNull
public HttpResponse getEntitlementStatusResponse(ImmutableList<String> appIds,
ServiceEntitlementRequest request)
throws ServiceEntitlementException {
@@ -249,20 +248,21 @@ public class ServiceEntitlement {
* 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.
*/
+ @NonNull
public String performEsimOdsa(
String appId, ServiceEntitlementRequest request, EsimOdsaOperation operation)
throws ServiceEntitlementException {
- HttpResponse response = getEsimOdsaResponse(appId, request, operation);
- return response == null ? null : response.body();
+ return getEsimOdsaResponse(appId, request, operation).body();
}
/**
* Retrieves the HTTP response after performing on device service activation (ODSA) of eSIM for
* companion/primary devices.
*
- * <p>Same as {@link #performEsimOdsa(String, ServiceEntitlementRequest, OdsaOperation)}
+ * <p>Same as {@link #performEsimOdsa(String, ServiceEntitlementRequest, EsimOdsaOperation)}
* except that it returns the full HTTP response instead of just the body.
*/
+ @NonNull
public HttpResponse getEsimOdsaResponse(
String appId, ServiceEntitlementRequest request, EsimOdsaOperation operation)
throws ServiceEntitlementException {
@@ -280,6 +280,7 @@ public class ServiceEntitlement {
* @param appId an app ID string defined in TS.43 section 2.2
* @param request contains parameters that can be used in the HTTP request
*/
+ @NonNull
public String acquireOidcAuthenticationEndpoint(String appId, ServiceEntitlementRequest request)
throws ServiceEntitlementException {
mOidcAcceptContentType = request.acceptContentType();
@@ -295,9 +296,9 @@ public class ServiceEntitlement {
*
* @param url the redirect url from OIDC authentication result.
*/
+ @NonNull
public String queryEntitlementStatusFromOidc(String url) throws ServiceEntitlementException {
- HttpResponse response = getEntitlementStatusResponseFromOidc(url);
- return response == null ? null : response.body();
+ return getEntitlementStatusResponseFromOidc(url).body();
}
/**
@@ -309,6 +310,7 @@ public class ServiceEntitlement {
*
* @param url the redirect url from OIDC authentication result.
*/
+ @NonNull
public HttpResponse getEntitlementStatusResponseFromOidc(String url)
throws ServiceEntitlementException {
return eapAkaApi.queryEntitlementStatusFromOidc(url, carrierConfig, mOidcAcceptContentType);
@@ -318,6 +320,7 @@ public class ServiceEntitlement {
* Retrieves the history of past HTTP request and responses if {@code saveHttpHistory} was set
* in constructor.
*/
+ @NonNull
public List<String> getHistory() {
return eapAkaApi.getHistory();
}
diff --git a/java/com/android/libraries/entitlement/eapaka/EapAkaApi.java b/java/com/android/libraries/entitlement/eapaka/EapAkaApi.java
index adb4140..a54c669 100644
--- a/java/com/android/libraries/entitlement/eapaka/EapAkaApi.java
+++ b/java/com/android/libraries/entitlement/eapaka/EapAkaApi.java
@@ -26,6 +26,7 @@ import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;
+import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
@@ -135,7 +136,7 @@ public class EapAkaApi {
*
* @throws ServiceEntitlementException when getting an unexpected http response.
*/
- @Nullable
+ @NonNull
public HttpResponse queryEntitlementStatus(ImmutableList<String> appIds,
CarrierConfig carrierConfig, ServiceEntitlementRequest request)
throws ServiceEntitlementException {
@@ -188,6 +189,7 @@ public class EapAkaApi {
*
* @return Challenge response from server whose content type is JSON
*/
+ @NonNull
private HttpResponse respondToEapAkaChallenge(
CarrierConfig carrierConfig,
String eapAkaChallenge,
@@ -256,6 +258,7 @@ public class EapAkaApi {
}
}
+ @NonNull
private HttpResponse challengeResponse(
String eapAkaChallengeResponse,
CarrierConfig carrierConfig,
@@ -292,6 +295,7 @@ public class EapAkaApi {
*
* <p>Implementation based on GSMA TS.43-v5.0 6.1.
*/
+ @NonNull
public HttpResponse performEsimOdsaOperation(String appId, CarrierConfig carrierConfig,
ServiceEntitlementRequest request, EsimOdsaOperation odsaOperation)
throws ServiceEntitlementException {
@@ -337,6 +341,7 @@ public class EapAkaApi {
* {@link #queryEntitlementStatusFromOidc(String, CarrierConfig, String)} with the
* authentication result to retrieve the service entitlement configuration.
*/
+ @NonNull
public String acquireOidcAuthenticationEndpoint(String appId, CarrierConfig carrierConfig,
ServiceEntitlementRequest request) throws ServiceEntitlementException {
Uri.Builder urlBuilder = Uri.parse(carrierConfig.serverUrl()).buildUpon();
@@ -354,6 +359,7 @@ public class EapAkaApi {
*
* <p>{@link #acquireOidcAuthenticationEndpoint} must be called before calling this method.
*/
+ @NonNull
public HttpResponse queryEntitlementStatusFromOidc(
String url, CarrierConfig carrierConfig, String acceptContentType)
throws ServiceEntitlementException {
@@ -468,6 +474,7 @@ public class EapAkaApi {
odsaOperation.oldTerminalId());
}
+ @NonNull
private HttpResponse httpGet(String url, CarrierConfig carrierConfig, String contentType)
throws ServiceEntitlementException {
HttpRequest httpRequest =
@@ -545,6 +552,7 @@ public class EapAkaApi {
/**
* Retrieves the history of past HTTP request and responses.
*/
+ @NonNull
public List<String> getHistory() {
return mHttpClient.getHistory();
}