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

Commit 20acaee2 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Check if the subscriptions list is empty before checking if they are stackable" into main

parents 83b7c110 04b9d33d
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)
        }