summaryrefslogtreecommitdiff
path: root/test/com/google/android
diff options
context:
space:
mode:
authorTreehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com>2024-01-03 11:50:28 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2024-01-03 11:50:28 +0000
commitb566fd533558dcbacf62719ec7a01216fb31d125 (patch)
treed3e2a2ea1b19c8e2d3305209bd53daa554012465 /test/com/google/android
parent1f2c5411f1f1ef6b3a7fb8470da5c453826becb1 (diff)
parentcc738e61f3632607eec60e33c06c6cd2fffab476 (diff)
downloadIwlan-b566fd533558dcbacf62719ec7a01216fb31d125.tar.gz
Merge "Fix Iwlan Error not unthrottling by WIFI_AP_CHANGED_EVENT" into main am: 150b5930e5 am: 17f572a2ac am: cc738e61f3
Original change: https://android-review.googlesource.com/c/platform/packages/services/Iwlan/+/2858807 Change-Id: I61ece05c19a371436c3666d65df516cc238f062c Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'test/com/google/android')
-rw-r--r--test/com/google/android/iwlan/ErrorPolicyManagerTest.java59
1 files changed, 59 insertions, 0 deletions
diff --git a/test/com/google/android/iwlan/ErrorPolicyManagerTest.java b/test/com/google/android/iwlan/ErrorPolicyManagerTest.java
index b829068..eae41bb 100644
--- a/test/com/google/android/iwlan/ErrorPolicyManagerTest.java
+++ b/test/com/google/android/iwlan/ErrorPolicyManagerTest.java
@@ -895,6 +895,65 @@ public class ErrorPolicyManagerTest {
}
@Test
+ public void testWifiApChangedUnthrottle() throws Exception {
+ String apn = "ims";
+ String config =
+ "[{"
+ + "\"ApnName\": \""
+ + apn
+ + "\","
+ + "\"ErrorTypes\": [{"
+ + ErrorPolicyString.builder()
+ .setErrorType("IKE_PROTOCOL_ERROR_TYPE")
+ .setErrorDetails(List.of("24", "34"))
+ .setRetryArray(List.of("6", "12", "24"))
+ .setUnthrottlingEvents(
+ List.of(
+ "WIFI_CALLING_DISABLE_EVENT",
+ "WIFI_DISABLE_EVENT",
+ "WIFI_AP_CHANGED_EVENT"))
+ .build()
+ .getErrorPolicyInString()
+ + "}, {"
+ + ErrorPolicyString.builder()
+ .setErrorType("GENERIC_ERROR_TYPE")
+ .setErrorDetails(List.of("SERVER_SELECTION_FAILED"))
+ .setRetryArray(List.of("0"))
+ .setUnthrottlingEvents(List.of("APM_ENABLE_EVENT"))
+ .build()
+ .getErrorPolicyInString()
+ + "}]"
+ + "}]";
+ PersistableBundle bundle = new PersistableBundle();
+ bundle.putString(ErrorPolicyManager.KEY_ERROR_POLICY_CONFIG_STRING, config);
+ setupMockForCarrierConfig(bundle);
+ mErrorPolicyManager
+ .mHandler
+ .obtainMessage(IwlanEventListener.CARRIER_CONFIG_CHANGED_EVENT)
+ .sendToTarget();
+ mTestLooper.dispatchAll();
+
+ // IKE_PROTOCOL_ERROR_TYPE(24) and retryArray = 6, 12, 24
+ IwlanError iwlanError = buildIwlanIkeAuthFailedError();
+ long time = mErrorPolicyManager.reportIwlanError(apn, iwlanError);
+ assertEquals(6, time);
+
+ mErrorPolicyManager
+ .mHandler
+ .obtainMessage(IwlanEventListener.WIFI_AP_CHANGED_EVENT)
+ .sendToTarget();
+ advanceClockByTimeMs(500);
+ verify(mMockDataServiceProvider, times(1)).notifyApnUnthrottled(eq(apn));
+
+ boolean bringUpTunnel = mErrorPolicyManager.canBringUpTunnel(apn);
+ assertTrue(bringUpTunnel);
+
+ iwlanError = buildIwlanIkeAuthFailedError();
+ time = mErrorPolicyManager.reportIwlanError(apn, iwlanError);
+ assertEquals(6, time);
+ }
+
+ @Test
public void testGetDataFailCauseRetryTime() throws Exception {
String apn1 = "ims";
String apn2 = "mms";