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

Commit 04b9d33d authored by Olivier St-Onge's avatar Olivier St-Onge
Browse files

Check if the subscriptions list is empty before checking if they are stackable

Flag: EXEMPT bugfix
Fixes: 431929674
Test: MobileIconsInteractorTest.kt
Change-Id: Icb23028e8f4fa409720f412fd653c57fdb9ae7c1
parent 41995c9d
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -938,6 +938,20 @@ abstract class MobileIconsInteractorTestBase : SysuiTestCase() {
            assertThat(latest).isFalse()
        }

    /** Regression test for b/431929674 */
    @Test
    @EnableFlags(NewStatusBarIcons.FLAG_NAME, StatusBarRootModernization.FLAG_NAME)
    fun isStackable_removeAllSubscriptions() =
        kosmos.runTest {
            val latest by collectLastValue(underTest.isStackable)

            connectionsRepository.setSubscriptions(listOf(SUB_1, SUB_2))
            assertThat(latest).isTrue()

            connectionsRepository.setSubscriptions(emptyList())
            assertThat(latest).isFalse()
        }

    @Test
    @EnableFlags(NewStatusBarIcons.FLAG_NAME, StatusBarRootModernization.FLAG_NAME)
    fun isStackable_checksForTerrestrialConnections() =
+11 −7
Original line number Diff line number Diff line
@@ -310,6 +310,9 @@ constructor(
    override val isStackable =
        if (NewStatusBarIcons.isEnabled && StatusBarRootModernization.isEnabled) {
            icons.flatMapLatest { icons ->
                if (icons.isEmpty()) {
                    flowOf(false)
                } else {
                    combine(icons.map { it.signalLevelIcon }) { signalLevelIcons ->
                        // These are only stackable if:
                        // - They are cellular
@@ -320,6 +323,7 @@ constructor(
                        }
                    }
                }
            }
        } else {
            flowOf(false)
        }