summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/ui/viewmodel/MobileIconViewModelTest.kt15
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/ui/viewmodel/MobileIconViewModel.kt15
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)