aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSarah Chin <sarahchin@google.com>2023-10-18 19:17:48 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-10-18 19:17:48 +0000
commit4651deada052bd75b91b775ffb0b123375cd16d1 (patch)
treec465fdebb82803186cac4b43ee2a03acc2368287
parentdef2b3e9180d45526d4cdd8400342d5ccf7328ea (diff)
parente639ce3d5df444bbf3023f3dd4d1965ab7ffc299 (diff)
downloadservice_entitlement-4651deada052bd75b91b775ffb0b123375cd16d1.tar.gz
Add support for EAP-AKA authentication bypass am: 3ea6fb0073 am: e639ce3d5d
Original change: https://android-review.googlesource.com/c/platform/frameworks/libs/service_entitlement/+/2727055 Change-Id: I291fb6d497dc11b364c30890c3e82168557106b1 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-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);
}