diff options
| author | 2025-02-21 13:09:51 -0800 | |
|---|---|---|
| committer | 2025-02-21 13:09:51 -0800 | |
| commit | 40b100e3c3ceac4622af53ec5217cd56bd6e849f (patch) | |
| tree | cbdbd8cfd1f3457a68a2a709b74eb6ab1972be32 | |
| parent | b71d91805f238fb8543be287008de1c90058d1df (diff) | |
| parent | 4044cea206554e413f48a3a53e0c04af857d783d (diff) | |
Merge "[sat] don't show NTN carrier-based satellite icon if in airplane mode" into main
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) |