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

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

[sat] use emergency calls text when satellite icon should show

Before this change, DeviceBasedSatelliteViewModel.carrierText only
emitted valid strings when the satellite repository reported that it was
On or Connected. This means that there were cases where the icon would
show (thus indicating satellite was _maybe_ possible), and there would
be no associated carrier text.

This change attempts to be minimal, and assumes that setting the carrier
text (which is propagated through CarrierTextManager) in this case, it
will properly show up in QS and lock screen.

Bug: 342477289
Test: manually by modifying code to put the device into the correct
state
Test: DeviceBasedSatelliteViewModelTest
Flag: NONE bugfix

Change-Id: Ic03982921704cf8452b20162058d7c7a16423c7d
parent b7f10f98
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1869,6 +1869,8 @@

    <!-- Text displayed indicating that the user is connected to a satellite signal. -->
    <string name="satellite_connected_carrier_text">Satellite SOS</string>
    <!-- Text displayed indicating that the user might be able to use satellite SOS. -->
    <string name="satellite_emergency_only_carrier_text">Emergency calls or SOS</string>

    <!-- Accessibility label for managed profile icon (not shown on screen) [CHAR LIMIT=NONE] -->
    <string name="accessibility_managed_profile">Work profile</string>
+4 −2
Original line number Diff line number Diff line
@@ -166,7 +166,7 @@ constructor(
                        bool1 = shouldShow
                        str1 = connectionState.name
                    },
                    { "Updating carrier text. shouldActuallyShow=$bool1 connectionState=$str1" }
                    { "Updating carrier text. shouldShow=$bool1 connectionState=$str1" }
                )
                if (shouldShow) {
                    when (connectionState) {
@@ -175,7 +175,9 @@ constructor(
                            context.getString(R.string.satellite_connected_carrier_text)
                        SatelliteConnectionState.Off,
                        SatelliteConnectionState.Unknown -> {
                            null
                            // If we're showing the satellite icon opportunistically, use the
                            // emergency-only version of the carrier string
                            context.getString(R.string.satellite_emergency_only_carrier_text)
                        }
                    }
                } else {
+6 −4
Original line number Diff line number Diff line
@@ -589,7 +589,7 @@ class DeviceBasedSatelliteViewModelTest : SysuiTestCase() {
        }

    @Test
    fun carrierText_connectionStateUnknown_null() =
    fun carrierText_connectionStateUnknown_usesEmergencyOnlyText() =
        testScope.runTest {
            val latest by collectLastValue(underTest.carrierText)

@@ -605,11 +605,12 @@ class DeviceBasedSatelliteViewModelTest : SysuiTestCase() {
            // Wait for delay to be completed
            advanceTimeBy(10.seconds)

            assertThat(latest).isNull()
            assertThat(latest)
                .isEqualTo(context.getString(R.string.satellite_emergency_only_carrier_text))
        }

    @Test
    fun carrierText_connectionStateOff_null() =
    fun carrierText_connectionStateOff_usesEmergencyOnlyText() =
        testScope.runTest {
            val latest by collectLastValue(underTest.carrierText)

@@ -625,7 +626,8 @@ class DeviceBasedSatelliteViewModelTest : SysuiTestCase() {
            // Wait for delay to be completed
            advanceTimeBy(10.seconds)

            assertThat(latest).isNull()
            assertThat(latest)
                .isEqualTo(context.getString(R.string.satellite_emergency_only_carrier_text))
        }

    @Test