diff options
| author | 2023-03-24 17:46:27 +0000 | |
|---|---|---|
| committer | 2023-03-24 17:48:47 +0000 | |
| commit | 6ea1cc21f8f51dd2d7d775d6dde4df4da4114dc4 (patch) | |
| tree | 7d694bafafb71322311b9e801ddc835065100640 | |
| parent | 655a58a6e3c69a2e12675520668dd982b6c50c17 (diff) | |
[SB Refactor] Keep connection failed as false when forcing validation.
Fixes: 275076959
Test: atest MobileIconsInteractorTest (verified new test fails without
the fix, passes with the fix)
Change-Id: I5572175f054efc00804f64015cdb84335175306c
Change-Id: If608a313ae6b65f8747de52ee37707eb12f413f0
2 files changed, 32 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconsInteractor.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconsInteractor.kt index 142c372d4c07..f4b6e55ebbba 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconsInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconsInteractor.kt @@ -271,7 +271,7 @@ constructor( * other transport type is active, because then we expect there not to be validation. */ override val isDefaultConnectionFailed: StateFlow<Boolean> = - mobileConnectionsRepo.defaultMobileNetworkConnectivity + defaultMobileNetworkConnectivity .mapLatest { connectivityModel -> if (!connectivityModel.isConnected) { false diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconsInteractorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconsInteractorTest.kt index c51dbf11e751..77e7cf202567 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconsInteractorTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconsInteractorTest.kt @@ -347,6 +347,37 @@ class MobileIconsInteractorTest : SysuiTestCase() { job.cancel() } + /** Regression test for b/275076959. */ + @Test + fun failedConnection_dataSwitchInSameGroup_notFailed() = + testScope.runTest { + var latest: Boolean? = null + val job = + underTest.isDefaultConnectionFailed.onEach { latest = it }.launchIn(this) + + connectionsRepository.setMobileConnectivity( + MobileConnectivityModel( + isConnected = true, + isValidated = true, + ) + ) + + // WHEN there's a data change in the same subscription group + connectionsRepository.activeSubChangedInGroupEvent.emit(Unit) + connectionsRepository.setMobileConnectivity( + MobileConnectivityModel( + // Keep the connection as connected, just not validated + isConnected = true, + isValidated = false, + ) + ) + + // THEN the default connection is *not* marked as failed because of forced validation + assertThat(latest).isFalse() + + job.cancel() + } + @Test fun alwaysShowDataRatIcon_configHasTrue() = testScope.runTest { |