diff options
| author | 2025-02-20 17:42:27 -0500 | |
|---|---|---|
| committer | 2025-02-20 17:42:27 -0500 | |
| commit | 4044cea206554e413f48a3a53e0c04af857d783d (patch) | |
| tree | 99384fda7ee37d0ea02d512b5f60983e5fe9a11f | |
| parent | 2006374fa451de5bd3b195859994a80841c21a4e (diff) | |
[sat] don't show NTN carrier-based satellite icon if in airplane mode
Test: MobileIconViewModelTest
Fixes: 374126789
Flag: EXEMPT bugfix
Change-Id: I5c4358f22897cd6eefe61964f48d14361f5fbec8
2 files changed, 28 insertions, 2 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/ui/viewmodel/MobileIconViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/ui/viewmodel/MobileIconViewModelTest.kt index 8ea888e47ffc..1c530f1eab7e 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/ui/viewmodel/MobileIconViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/ui/viewmodel/MobileIconViewModelTest.kt @@ -252,6 +252,21 @@ class MobileIconViewModelTest : SysuiTestCase() { } @Test + fun isVisible_satellite_respectsAirplaneMode() = + testScope.runTest { + val latest by collectLastValue(underTest.isVisible) + + repository.isNonTerrestrial.value = true + airplaneModeInteractor.setIsAirplaneMode(false) + + assertThat(latest).isTrue() + + airplaneModeInteractor.setIsAirplaneMode(true) + + assertThat(latest).isFalse() + } + + @Test fun contentDescription_notInService_usesNoPhone() = testScope.runTest { val latest by collectLastValue(underTest.contentDescription) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/ui/viewmodel/MobileIconViewModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/ui/viewmodel/MobileIconViewModel.kt index e37c3f10cfcb..ac301b035398 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/ui/viewmodel/MobileIconViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/ui/viewmodel/MobileIconViewModel.kt @@ -94,7 +94,12 @@ class MobileIconViewModel( } private val satelliteProvider by lazy { - CarrierBasedSatelliteViewModelImpl(subscriptionId, iconInteractor) + CarrierBasedSatelliteViewModelImpl( + subscriptionId, + airplaneModeInteractor, + iconInteractor, + scope, + ) } /** @@ -145,9 +150,15 @@ class MobileIconViewModel( /** Representation of this network when it is non-terrestrial (e.g., satellite) */ private class CarrierBasedSatelliteViewModelImpl( override val subscriptionId: Int, + airplaneModeInteractor: AirplaneModeInteractor, interactor: MobileIconInteractor, + scope: CoroutineScope, ) : MobileIconViewModelCommon { - override val isVisible: StateFlow<Boolean> = MutableStateFlow(true) + override val isVisible: StateFlow<Boolean> = + airplaneModeInteractor.isAirplaneMode + .map { !it } + .stateIn(scope, SharingStarted.WhileSubscribed(), false) + override val icon: Flow<SignalIconModel> = interactor.signalLevelIcon override val contentDescription: Flow<MobileContentDescription?> = MutableStateFlow(null) |