aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-10-30 20:52:51 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-10-30 20:52:51 +0000
commit8cac9c184e4b8c7ab6455a9497723f6724091e6d (patch)
treec465fdebb82803186cac4b43ee2a03acc2368287
parentc7d60556c350b3810c927993c9b850f5d4307b76 (diff)
parent3ea6fb00730c9cc4edd12169a4f4e755b096146d (diff)
downloadservice_entitlement-8cac9c184e4b8c7ab6455a9497723f6724091e6d.tar.gz
Snap for 11024862 from 3ea6fb00730c9cc4edd12169a4f4e755b096146d to simpleperf-release
Change-Id: Ie573f51b145798387b4f52a8a7c3266dceca0de3
-rw-r--r--java/com/android/libraries/entitlement/ServiceEntitlement.java10
-rw-r--r--java/com/android/libraries/entitlement/utils/DebugUtils.java24
2 files changed, 27 insertions, 7 deletions
diff --git a/java/com/android/libraries/entitlement/ServiceEntitlement.java b/java/com/android/libraries/entitlement/ServiceEntitlement.java
index 5151c32..0ced9e0 100644
--- a/java/com/android/libraries/entitlement/ServiceEntitlement.java
+++ b/java/com/android/libraries/entitlement/ServiceEntitlement.java
@@ -23,6 +23,7 @@ import androidx.annotation.VisibleForTesting;
import com.android.libraries.entitlement.eapaka.EapAkaApi;
import com.android.libraries.entitlement.http.HttpResponse;
+import com.android.libraries.entitlement.utils.DebugUtils;
import com.android.libraries.entitlement.utils.Ts43Constants;
import com.google.common.collect.ImmutableList;
@@ -98,12 +99,7 @@ public class ServiceEntitlement {
* for how to get the subscription ID.
*/
public ServiceEntitlement(Context context, CarrierConfig carrierConfig, int simSubscriptionId) {
- this(
- context,
- carrierConfig,
- simSubscriptionId,
- /* saveHttpHistory= */ false,
- /* bypassEapAkaResponse= */ "");
+ this(context, carrierConfig, simSubscriptionId, /* saveHttpHistory= */ false);
}
/**
@@ -128,7 +124,7 @@ public class ServiceEntitlement {
carrierConfig,
simSubscriptionId,
saveHttpHistory,
- /* bypassEapAkaResponse= */ "");
+ DebugUtils.getBypassEapAkaResponse());
}
/**
diff --git a/java/com/android/libraries/entitlement/utils/DebugUtils.java b/java/com/android/libraries/entitlement/utils/DebugUtils.java
index 062c9b4..d89c572 100644
--- a/java/com/android/libraries/entitlement/utils/DebugUtils.java
+++ b/java/com/android/libraries/entitlement/utils/DebugUtils.java
@@ -18,14 +18,19 @@ package com.android.libraries.entitlement.utils;
import android.os.Build;
import android.os.SystemProperties;
+import android.text.TextUtils;
import android.util.Log;
+import androidx.annotation.NonNull;
+
/** Provides API for debugging and not allow to debug on user build. */
public final class DebugUtils {
private static final String TAG = "ServiceEntitlement";
private static final String PROP_PII_LOGGABLE = "dbg.se.pii_loggable";
private static final String BUILD_TYPE_USER = "user";
+ private static final String PROP_FAKE_EAP_AKA_RESPONSE =
+ "persist.entitlement.fake_eap_aka_response";
private DebugUtils() {}
@@ -36,6 +41,25 @@ public final class DebugUtils {
}
}
+ /**
+ * Get the bypass EAP-AKA response. This is only available on debug builds and can be set by
+ * running the following commands, where {@code response} should be the expected response from
+ * an EAP-AKA request:
+ * adb root
+ * adb shell setprop persist.entitlement.fake_eap_aka_response response
+ *
+ * @return The bypass EAP-AKA response, or an empty string if it is either not set or the device
+ * is not on a debug build.
+ */
+ @NonNull
+ public static String getBypassEapAkaResponse() {
+ String bypassResponse = SystemProperties.get(PROP_FAKE_EAP_AKA_RESPONSE);
+ if (TextUtils.isEmpty(bypassResponse) || !isDebugBuild()) {
+ return "";
+ }
+ return bypassResponse;
+ }
+
private static boolean isDebugBuild() {
return !BUILD_TYPE_USER.equals(Build.TYPE);
}