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

Commit e5343009 authored by Evan Laird's avatar Evan Laird
Browse files

[sat] add config for the opportunistic satellite icon

This config allows for turning off the behavior of the opportunistic
satellite icon. That is, the icon that shows when all connections are
out of service and satellite is provisioned and allowed.

Test: DeviceBasedSatelliteViewModelTest
Test: all other mobile tests
Bug: 376310933
Flag: EXEMPT bugfix
Change-Id: I81e00048ab4a87c68f0ec9fb6f12115656e9ec77
parent 4b4e3d50
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ class DeviceBasedSatelliteRepositorySwitcherTest : SysuiTestCase() {
            logBuffer = FakeLogBuffer.Factory.create(),
            verboseLogBuffer = FakeLogBuffer.Factory.create(),
            systemClock,
            context.resources,
        )
    private val demoDataSource =
        mock<DemoDeviceBasedSatelliteDataSource>().also {
@@ -80,7 +81,11 @@ class DeviceBasedSatelliteRepositorySwitcherTest : SysuiTestCase() {
                )
        }
    private val demoImpl =
        DemoDeviceBasedSatelliteRepository(demoDataSource, testScope.backgroundScope)
        DemoDeviceBasedSatelliteRepository(
            demoDataSource,
            testScope.backgroundScope,
            context.resources,
            )

    private val underTest =
        DeviceBasedSatelliteRepositorySwitcher(
+5 −1
Original line number Diff line number Diff line
@@ -58,7 +58,11 @@ class DemoDeviceBasedSatelliteRepositoryTest : SysuiTestCase() {
                whenever(it.satelliteEvents).thenReturn(fakeSatelliteEvents)
            }

        underTest = DemoDeviceBasedSatelliteRepository(dataSource, testScope.backgroundScope)
        underTest = DemoDeviceBasedSatelliteRepository(
            dataSource,
            testScope.backgroundScope,
            context.resources,
            )
    }

    @Test
+2 −0
Original line number Diff line number Diff line
@@ -28,4 +28,6 @@ class FakeDeviceBasedSatelliteRepository() : DeviceBasedSatelliteRepository {
    override val signalStrength = MutableStateFlow(0)

    override val isSatelliteAllowedForCurrentLocation = MutableStateFlow(false)

    override var isOpportunisticSatelliteIconEnabled: Boolean = true
}
+20 −0
Original line number Diff line number Diff line
@@ -171,6 +171,26 @@ class DeviceBasedSatelliteViewModelTest : SysuiTestCase() {
            assertThat(latest).isNull()
        }

    @Test
    fun icon_null_allOosAndConfigIsFalse() =
        testScope.runTest {
            val latest by collectLastValue(underTest.icon)

            // GIVEN config for opportunistic icon is false
            repo.isOpportunisticSatelliteIconEnabled = false

            // 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)

            // THEN icon is null because it is not allowed
            assertThat(latest).isNull()
        }

    @Test
    fun icon_null_isEmergencyOnly() =
        testScope.runTest {
+4 −0
Original line number Diff line number Diff line
@@ -383,6 +383,10 @@
    <!-- Whether to show activity indicators in the status bar -->
    <bool name="config_showActivity">false</bool>

    <!-- Whether to show the opportunistic satellite icon. When true, an icon will show to indicate
         satellite capabilities when all other connections are out of service. -->
    <bool name="config_showOpportunisticSatelliteIcon">true</bool>

    <!-- Whether or not to show the notification shelf that houses the icons of notifications that
     have been scrolled off-screen. -->
    <bool name="config_showNotificationShelf">true</bool>
Loading