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

Commit d5fdf0e7 authored by Evan Laird's avatar Evan Laird Committed by Cherrypicker Worker
Browse files

[Sat] Consider any connection that reports NTN to be connected

For the sake of the device-based satellite icon interactor, this CL
changes the logic so that any mobile interactor that reports
`isNonTerrestrial` is considered to be "in service". This is because any
mobile connection that reports isNonTerrestrial will always show a
satellite icon for that connection (even if it's lost service), and we
don't want to show the Satellite SOS icon alongside it.

Test: DeviceBasedSatelliteInteractorTest
Test: manual via demo mode
Bug: 338122077
Flag: ACONFIG com.android.internal.telephony.flags.oem_enabled_satellite_flag NEXTFOOD
Flag: ACONFIG com.android.internal.telephony.flags.carrier_enabled_satellite_flag NEXTFOOD
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:c5dcb1f186d2f05d85a652f879307c127f02947e)
Merged-In: Ib7d4de27cbd899ede9d1105df7f366a7004f5fbd
Change-Id: Ib7d4de27cbd899ede9d1105df7f366a7004f5fbd
parent 12b35770
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -84,14 +84,15 @@ constructor(
        if (Flags.oemEnabledSatelliteFlag()) {
                iconsInteractor.icons.aggregateOver(
                    selector = { intr ->
                        combine(intr.isInService, intr.isEmergencyOnly) {
                        combine(intr.isInService, intr.isEmergencyOnly, intr.isNonTerrestrial) {
                            isInService,
                            isEmergencyOnly ->
                            !isInService && !isEmergencyOnly
                            isEmergencyOnly,
                            isNtn ->
                            !isInService && !(isEmergencyOnly || isNtn)
                        }
                    }
                ) { isOosAndIsNotEmergencyOnly ->
                    isOosAndIsNotEmergencyOnly.all { it }
                ) { isOosAndNotEmergencyOnlyOrSatellite ->
                    isOosAndNotEmergencyOnlyOrSatellite.all { it }
                }
            } else {
                flowOf(false)
+71 −6
Original line number Diff line number Diff line
@@ -250,7 +250,7 @@ class DeviceBasedSatelliteInteractorTest : SysuiTestCase() {

    @Test
    @EnableFlags(FLAG_OEM_ENABLED_SATELLITE_FLAG)
    fun areAllConnectionsOutOfService_twoConnectionsOos_yes() =
    fun areAllConnectionsOutOfService_twoConnectionsOos_nonNtn_yes() =
        testScope.runTest {
            val latest by collectLastValue(underTest.areAllConnectionsOutOfService)

@@ -258,11 +258,13 @@ class DeviceBasedSatelliteInteractorTest : SysuiTestCase() {
            val i1 = iconsInteractor.getMobileConnectionInteractorForSubId(1)
            val i2 = iconsInteractor.getMobileConnectionInteractorForSubId(2)

            // WHEN all of the connections are OOS
            // WHEN all of the connections are OOS and none are NTN
            i1.isInService.value = false
            i1.isEmergencyOnly.value = false
            i1.isNonTerrestrial.value = false
            i2.isInService.value = false
            i2.isEmergencyOnly.value = false
            i2.isNonTerrestrial.value = false

            // THEN the value is propagated to this interactor
            assertThat(latest).isTrue()
@@ -270,7 +272,31 @@ class DeviceBasedSatelliteInteractorTest : SysuiTestCase() {

    @Test
    @EnableFlags(FLAG_OEM_ENABLED_SATELLITE_FLAG)
    fun areAllConnectionsOutOfService_oneConnectionOos_yes() =
    fun areAllConnectionsOutOfService_twoConnectionsOos_oneNtn_no() =
        testScope.runTest {
            val latest by collectLastValue(underTest.areAllConnectionsOutOfService)

            // GIVEN, 2 connections
            val i1 = iconsInteractor.getMobileConnectionInteractorForSubId(1)
            val i2 = iconsInteractor.getMobileConnectionInteractorForSubId(2)

            // WHEN all of the connections are OOS and one is NTN
            i1.isInService.value = false
            i1.isEmergencyOnly.value = false
            i1.isNonTerrestrial.value = false
            i2.isInService.value = false
            i2.isEmergencyOnly.value = false

            // sub2 is non terrestrial, consider it connected for the sake of the iconography
            i2.isNonTerrestrial.value = true

            // THEN the value is propagated to this interactor
            assertThat(latest).isFalse()
        }

    @Test
    @EnableFlags(FLAG_OEM_ENABLED_SATELLITE_FLAG)
    fun areAllConnectionsOutOfService_oneConnectionOos_nonNtn_yes() =
        testScope.runTest {
            val latest by collectLastValue(underTest.areAllConnectionsOutOfService)

@@ -280,6 +306,7 @@ class DeviceBasedSatelliteInteractorTest : SysuiTestCase() {
            // WHEN all of the connections are OOS
            i1.isInService.value = false
            i1.isEmergencyOnly.value = false
            i1.isNonTerrestrial.value = false

            // THEN the value is propagated to this interactor
            assertThat(latest).isTrue()
@@ -287,7 +314,42 @@ class DeviceBasedSatelliteInteractorTest : SysuiTestCase() {

    @Test
    @EnableFlags(FLAG_OEM_ENABLED_SATELLITE_FLAG)
    fun areAllConnectionsOutOfService_oneConnectionInService_no() =
    fun areAllConnectionsOutOfService_oneConnectionOos_ntn_yes() =
        testScope.runTest {
            val latest by collectLastValue(underTest.areAllConnectionsOutOfService)

            // GIVEN, 1 connection
            val i1 = iconsInteractor.getMobileConnectionInteractorForSubId(1)

            // WHEN all of the connections are OOS
            i1.isInService.value = false
            i1.isEmergencyOnly.value = false
            i1.isNonTerrestrial.value = true

            // THEN the value is propagated to this interactor
            assertThat(latest).isFalse()
        }

    @Test
    @EnableFlags(FLAG_OEM_ENABLED_SATELLITE_FLAG)
    fun areAllConnectionsOutOfService_oneConnectionInService_nonNtn_no() =
        testScope.runTest {
            val latest by collectLastValue(underTest.areAllConnectionsOutOfService)

            // GIVEN, 1 connection
            val i1 = iconsInteractor.getMobileConnectionInteractorForSubId(1)

            // WHEN all of the connections are NOT OOS
            i1.isInService.value = true
            i1.isNonTerrestrial.value = false

            // THEN the value is propagated to this interactor
            assertThat(latest).isFalse()
        }

    @Test
    @EnableFlags(FLAG_OEM_ENABLED_SATELLITE_FLAG)
    fun areAllConnectionsOutOfService_oneConnectionInService_ntn_no() =
        testScope.runTest {
            val latest by collectLastValue(underTest.areAllConnectionsOutOfService)

@@ -296,6 +358,7 @@ class DeviceBasedSatelliteInteractorTest : SysuiTestCase() {

            // WHEN all of the connections are NOT OOS
            i1.isInService.value = true
            i1.isNonTerrestrial.value = true

            // THEN the value is propagated to this interactor
            assertThat(latest).isFalse()
@@ -303,7 +366,7 @@ class DeviceBasedSatelliteInteractorTest : SysuiTestCase() {

    @Test
    @EnableFlags(FLAG_OEM_ENABLED_SATELLITE_FLAG)
    fun areAllConnectionsOutOfService_twoConnectionsOneInService_no() =
    fun areAllConnectionsOutOfService_twoConnectionsOneInService_nonNtn_no() =
        testScope.runTest {
            val latest by collectLastValue(underTest.areAllConnectionsOutOfService)

@@ -313,7 +376,9 @@ class DeviceBasedSatelliteInteractorTest : SysuiTestCase() {

            // WHEN at least 1 connection is NOT OOS.
            i1.isInService.value = false
            i1.isNonTerrestrial.value = false
            i2.isInService.value = true
            i2.isNonTerrestrial.value = false

            // THEN the value is propagated to this interactor
            assertThat(latest).isFalse()
@@ -321,7 +386,7 @@ class DeviceBasedSatelliteInteractorTest : SysuiTestCase() {

    @Test
    @EnableFlags(FLAG_OEM_ENABLED_SATELLITE_FLAG)
    fun areAllConnectionsOutOfService_twoConnectionsInService_no() =
    fun areAllConnectionsOutOfService_twoConnectionsInService_nonNtn_no() =
        testScope.runTest {
            val latest by collectLastValue(underTest.areAllConnectionsOutOfService)