Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 40b100e3 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[sat] don't show NTN carrier-based satellite icon if in airplane mode" into main

parents b71d9180 4044cea2
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -251,6 +251,21 @@ class MobileIconViewModelTest : SysuiTestCase() {
            job.cancel()
        }

    @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 {
+13 −2
Original line number Diff line number Diff line
@@ -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)