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

Commit 0df4c032 authored by Evan Laird's avatar Evan Laird Committed by Android (Google) Code Review
Browse files

Merge changes I27cfcd4d,I81e00048 into main

* changes:
  [sat] add ktfmt formatting as its own CL
  [sat] add config for the opportunistic satellite icon
parents 8a7ac4eb 9ce7d36f
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(
+6 −1
Original line number Diff line number Diff line
@@ -58,7 +58,12 @@ 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