diff options
author | Sarah Chin <sarahchin@google.com> | 2023-10-18 18:50:57 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2023-10-18 18:50:57 +0000 |
commit | e639ce3d5df444bbf3023f3dd4d1965ab7ffc299 (patch) | |
tree | c465fdebb82803186cac4b43ee2a03acc2368287 | |
parent | def2b3e9180d45526d4cdd8400342d5ccf7328ea (diff) | |
parent | 3ea6fb00730c9cc4edd12169a4f4e755b096146d (diff) | |
download | service_entitlement-e639ce3d5df444bbf3023f3dd4d1965ab7ffc299.tar.gz |
Add support for EAP-AKA authentication bypass am: 3ea6fb0073
Original change: https://android-review.googlesource.com/c/platform/frameworks/libs/service_entitlement/+/2727055
Change-Id: Idf3fffed7448fd0c116f83ec7e9a528fac4aab04
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | java/com/android/libraries/entitlement/ServiceEntitlement.java | 10 | ||||
-rw-r--r-- | java/com/android/libraries/entitlement/utils/DebugUtils.java | 24 |
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); } |