Loading packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconInteractor.kt +5 −0 Original line number Diff line number Diff line Loading @@ -69,6 +69,9 @@ interface MobileIconInteractor { /** True if we consider this connection to be in service, i.e. can make calls */ val isInService: StateFlow<Boolean> /** True if this connection is emergency only */ val isEmergencyOnly: StateFlow<Boolean> /** Observable for the data enabled state of this connection */ val isDataEnabled: StateFlow<Boolean> Loading Loading @@ -306,6 +309,8 @@ class MobileIconInteractorImpl( override val isInService = connectionRepository.isInService override val isEmergencyOnly: StateFlow<Boolean> = connectionRepository.isEmergencyOnly override val isAllowedDuringAirplaneMode = connectionRepository.isAllowedDuringAirplaneMode /** Whether or not to show the error state of [SignalDrawable] */ Loading packages/SystemUI/src/com/android/systemui/statusbar/pipeline/satellite/domain/interactor/DeviceBasedSatelliteInteractor.kt +10 −3 Original line number Diff line number Diff line Loading @@ -72,9 +72,16 @@ constructor( /** When all connections are considered OOS, satellite connectivity is potentially valid */ val areAllConnectionsOutOfService = if (Flags.oemEnabledSatelliteFlag()) { iconsInteractor.icons.aggregateOver(selector = { intr -> intr.isInService }) { isInServiceList -> isInServiceList.all { !it } iconsInteractor.icons.aggregateOver( selector = { intr -> combine(intr.isInService, intr.isEmergencyOnly) { isInService, isEmergencyOnly -> !isInService && !isEmergencyOnly } } ) { isOosAndIsNotEmergencyOnly -> isOosAndIsNotEmergencyOnly.all { it } } } else { flowOf(false) Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/domain/interactor/DeviceBasedSatelliteInteractorTest.kt +3 −0 Original line number Diff line number Diff line Loading @@ -239,7 +239,9 @@ class DeviceBasedSatelliteInteractorTest : SysuiTestCase() { // WHEN all of the connections are OOS i1.isInService.value = false i1.isEmergencyOnly.value = false i2.isInService.value = false i2.isEmergencyOnly.value = false // THEN the value is propagated to this interactor assertThat(latest).isTrue() Loading @@ -256,6 +258,7 @@ class DeviceBasedSatelliteInteractorTest : SysuiTestCase() { // WHEN all of the connections are OOS i1.isInService.value = false i1.isEmergencyOnly.value = false // THEN the value is propagated to this interactor assertThat(latest).isTrue() Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/ui/viewmodel/DeviceBasedSatelliteViewModelTest.kt +34 −0 Original line number Diff line number Diff line Loading @@ -80,6 +80,7 @@ class DeviceBasedSatelliteViewModelTest : SysuiTestCase() { // GIVEN all icons are OOS val i1 = mobileIconsInteractor.getMobileConnectionInteractorForSubId(1) i1.isInService.value = false i1.isEmergencyOnly.value = false // GIVEN apm is disabled airplaneModeRepository.setIsAirplaneMode(false) Loading @@ -99,6 +100,7 @@ class DeviceBasedSatelliteViewModelTest : SysuiTestCase() { // GIVEN all icons are not OOS val i1 = mobileIconsInteractor.getMobileConnectionInteractorForSubId(1) i1.isInService.value = true i1.isEmergencyOnly.value = false // GIVEN apm is disabled airplaneModeRepository.setIsAirplaneMode(false) Loading @@ -107,6 +109,35 @@ class DeviceBasedSatelliteViewModelTest : SysuiTestCase() { assertThat(latest).isNull() } @Test fun icon_nullWhenShouldNotShow_isEmergencyOnly() = testScope.runTest { val latest by collectLastValue(underTest.icon) // GIVEN satellite is allowed repo.isSatelliteAllowedForCurrentLocation.value = true // GIVEN all icons are OOS val i1 = mobileIconsInteractor.getMobileConnectionInteractorForSubId(1) i1.isInService.value = false i1.isEmergencyOnly.value = false // GIVEN apm is disabled airplaneModeRepository.setIsAirplaneMode(false) // Wait for delay to be completed advanceTimeBy(10.seconds) // THEN icon is set because we don't have service assertThat(latest).isInstanceOf(Icon::class.java) // GIVEN the connection is emergency only i1.isEmergencyOnly.value = true // THEN icon is null because we have emergency connection assertThat(latest).isNull() } @Test fun icon_nullWhenShouldNotShow_apmIsEnabled() = testScope.runTest { Loading @@ -118,6 +149,7 @@ class DeviceBasedSatelliteViewModelTest : SysuiTestCase() { // GIVEN all icons are OOS val i1 = mobileIconsInteractor.getMobileConnectionInteractorForSubId(1) i1.isInService.value = false i1.isEmergencyOnly.value = false // GIVEN apm is enabled airplaneModeRepository.setIsAirplaneMode(true) Loading @@ -138,6 +170,7 @@ class DeviceBasedSatelliteViewModelTest : SysuiTestCase() { // GIVEN all icons are OOS val i1 = mobileIconsInteractor.getMobileConnectionInteractorForSubId(1) i1.isInService.value = false i1.isEmergencyOnly.value = false // GIVEN apm is disabled airplaneModeRepository.setIsAirplaneMode(false) Loading @@ -161,6 +194,7 @@ class DeviceBasedSatelliteViewModelTest : SysuiTestCase() { // GIVEN all icons are OOS val i1 = mobileIconsInteractor.getMobileConnectionInteractorForSubId(1) i1.isInService.value = false i1.isEmergencyOnly.value = false // GIVEN apm is disabled airplaneModeRepository.setIsAirplaneMode(false) Loading packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/FakeMobileIconInteractor.kt +2 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,8 @@ class FakeMobileIconInteractor( override val isInService = MutableStateFlow(true) override val isEmergencyOnly = MutableStateFlow(true) override val isNonTerrestrial = MutableStateFlow(false) private val _isDataEnabled = MutableStateFlow(true) Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconInteractor.kt +5 −0 Original line number Diff line number Diff line Loading @@ -69,6 +69,9 @@ interface MobileIconInteractor { /** True if we consider this connection to be in service, i.e. can make calls */ val isInService: StateFlow<Boolean> /** True if this connection is emergency only */ val isEmergencyOnly: StateFlow<Boolean> /** Observable for the data enabled state of this connection */ val isDataEnabled: StateFlow<Boolean> Loading Loading @@ -306,6 +309,8 @@ class MobileIconInteractorImpl( override val isInService = connectionRepository.isInService override val isEmergencyOnly: StateFlow<Boolean> = connectionRepository.isEmergencyOnly override val isAllowedDuringAirplaneMode = connectionRepository.isAllowedDuringAirplaneMode /** Whether or not to show the error state of [SignalDrawable] */ Loading
packages/SystemUI/src/com/android/systemui/statusbar/pipeline/satellite/domain/interactor/DeviceBasedSatelliteInteractor.kt +10 −3 Original line number Diff line number Diff line Loading @@ -72,9 +72,16 @@ constructor( /** When all connections are considered OOS, satellite connectivity is potentially valid */ val areAllConnectionsOutOfService = if (Flags.oemEnabledSatelliteFlag()) { iconsInteractor.icons.aggregateOver(selector = { intr -> intr.isInService }) { isInServiceList -> isInServiceList.all { !it } iconsInteractor.icons.aggregateOver( selector = { intr -> combine(intr.isInService, intr.isEmergencyOnly) { isInService, isEmergencyOnly -> !isInService && !isEmergencyOnly } } ) { isOosAndIsNotEmergencyOnly -> isOosAndIsNotEmergencyOnly.all { it } } } else { flowOf(false) Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/domain/interactor/DeviceBasedSatelliteInteractorTest.kt +3 −0 Original line number Diff line number Diff line Loading @@ -239,7 +239,9 @@ class DeviceBasedSatelliteInteractorTest : SysuiTestCase() { // WHEN all of the connections are OOS i1.isInService.value = false i1.isEmergencyOnly.value = false i2.isInService.value = false i2.isEmergencyOnly.value = false // THEN the value is propagated to this interactor assertThat(latest).isTrue() Loading @@ -256,6 +258,7 @@ class DeviceBasedSatelliteInteractorTest : SysuiTestCase() { // WHEN all of the connections are OOS i1.isInService.value = false i1.isEmergencyOnly.value = false // THEN the value is propagated to this interactor assertThat(latest).isTrue() Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/ui/viewmodel/DeviceBasedSatelliteViewModelTest.kt +34 −0 Original line number Diff line number Diff line Loading @@ -80,6 +80,7 @@ class DeviceBasedSatelliteViewModelTest : SysuiTestCase() { // GIVEN all icons are OOS val i1 = mobileIconsInteractor.getMobileConnectionInteractorForSubId(1) i1.isInService.value = false i1.isEmergencyOnly.value = false // GIVEN apm is disabled airplaneModeRepository.setIsAirplaneMode(false) Loading @@ -99,6 +100,7 @@ class DeviceBasedSatelliteViewModelTest : SysuiTestCase() { // GIVEN all icons are not OOS val i1 = mobileIconsInteractor.getMobileConnectionInteractorForSubId(1) i1.isInService.value = true i1.isEmergencyOnly.value = false // GIVEN apm is disabled airplaneModeRepository.setIsAirplaneMode(false) Loading @@ -107,6 +109,35 @@ class DeviceBasedSatelliteViewModelTest : SysuiTestCase() { assertThat(latest).isNull() } @Test fun icon_nullWhenShouldNotShow_isEmergencyOnly() = testScope.runTest { val latest by collectLastValue(underTest.icon) // GIVEN satellite is allowed repo.isSatelliteAllowedForCurrentLocation.value = true // GIVEN all icons are OOS val i1 = mobileIconsInteractor.getMobileConnectionInteractorForSubId(1) i1.isInService.value = false i1.isEmergencyOnly.value = false // GIVEN apm is disabled airplaneModeRepository.setIsAirplaneMode(false) // Wait for delay to be completed advanceTimeBy(10.seconds) // THEN icon is set because we don't have service assertThat(latest).isInstanceOf(Icon::class.java) // GIVEN the connection is emergency only i1.isEmergencyOnly.value = true // THEN icon is null because we have emergency connection assertThat(latest).isNull() } @Test fun icon_nullWhenShouldNotShow_apmIsEnabled() = testScope.runTest { Loading @@ -118,6 +149,7 @@ class DeviceBasedSatelliteViewModelTest : SysuiTestCase() { // GIVEN all icons are OOS val i1 = mobileIconsInteractor.getMobileConnectionInteractorForSubId(1) i1.isInService.value = false i1.isEmergencyOnly.value = false // GIVEN apm is enabled airplaneModeRepository.setIsAirplaneMode(true) Loading @@ -138,6 +170,7 @@ class DeviceBasedSatelliteViewModelTest : SysuiTestCase() { // GIVEN all icons are OOS val i1 = mobileIconsInteractor.getMobileConnectionInteractorForSubId(1) i1.isInService.value = false i1.isEmergencyOnly.value = false // GIVEN apm is disabled airplaneModeRepository.setIsAirplaneMode(false) Loading @@ -161,6 +194,7 @@ class DeviceBasedSatelliteViewModelTest : SysuiTestCase() { // GIVEN all icons are OOS val i1 = mobileIconsInteractor.getMobileConnectionInteractorForSubId(1) i1.isInService.value = false i1.isEmergencyOnly.value = false // GIVEN apm is disabled airplaneModeRepository.setIsAirplaneMode(false) Loading
packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/FakeMobileIconInteractor.kt +2 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,8 @@ class FakeMobileIconInteractor( override val isInService = MutableStateFlow(true) override val isEmergencyOnly = MutableStateFlow(true) override val isNonTerrestrial = MutableStateFlow(false) private val _isDataEnabled = MutableStateFlow(true) Loading