diff options
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 { |