diff options
| author | 2024-08-22 16:11:35 -0400 | |
|---|---|---|
| committer | 2024-08-23 16:50:46 -0400 | |
| commit | b752573f538efb0892d5c5ea90d65e7b89dc319b (patch) | |
| tree | d194a7821f6b8296082717dce1cf4ed25fdc7ed8 | |
| parent | b7f10f98aa7ad7faf354eb84ffb10d1b7811bfb3 (diff) | |
[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
3 files changed, 12 insertions, 6 deletions
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index 18b70731700a..fd943d0a5414 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -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> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/satellite/ui/viewmodel/DeviceBasedSatelliteViewModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/satellite/ui/viewmodel/DeviceBasedSatelliteViewModel.kt index 6ae7c0f179a2..37f2f195ebf6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/satellite/ui/viewmodel/DeviceBasedSatelliteViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/satellite/ui/viewmodel/DeviceBasedSatelliteViewModel.kt @@ -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 { diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/ui/viewmodel/DeviceBasedSatelliteViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/ui/viewmodel/DeviceBasedSatelliteViewModelTest.kt index 35fe9a47b2e0..bf31f1e6d569 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/ui/viewmodel/DeviceBasedSatelliteViewModelTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/ui/viewmodel/DeviceBasedSatelliteViewModelTest.kt @@ -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 |