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

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

Merge "Use filteredSubscriptions in isSingleCarrier" into main

parents 89dc9802 0f5d54ed
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -710,6 +710,25 @@ abstract class MobileIconsInteractorTestBase : SysuiTestCase() {
            assertThat(latest).isFalse()
        }

    @Test
    fun isSingleCarrier_twoOpportunisticSubscriptions_true() =
        kosmos.runTest {
            val latest by collectLastValue(underTest.isSingleCarrier)

            val (sub3, sub4) =
                createSubscriptionPair(
                    subscriptionIds = Pair(SUB_3_ID, SUB_4_ID),
                    opportunistic = Pair(true, true),
                    grouped = true,
                )
            connectionsRepository.setSubscriptions(listOf(sub3, sub4))
            connectionsRepository.setActiveMobileDataSubscriptionId(SUB_3_ID)
            whenever(carrierConfigTracker.alwaysShowPrimarySignalBarInOpportunisticNetworkDefault)
                .thenReturn(false)

            assertThat(latest).isEqualTo(true)
        }

    @Test
    fun isSingleCarrier_updates() =
        kosmos.runTest {
+1 −1
Original line number Diff line number Diff line
@@ -376,7 +376,7 @@ constructor(
            .stateIn(scope, SharingStarted.WhileSubscribed(), false)

    override val isSingleCarrier: StateFlow<Boolean> =
        mobileConnectionsRepo.subscriptions
        filteredSubscriptions
            .map { it.size == 1 }
            .logDiffsForTable(
                tableLogger,
+1 −1
Original line number Diff line number Diff line
@@ -373,7 +373,7 @@ constructor(
        mobileConnectionsRepo.defaultDataSubRatConfig.map { it.alwaysShowCdmaRssi }

    override val isSingleCarrier: State<Boolean> =
        mobileConnectionsRepo.subscriptions
        filteredSubscriptions
            .map { it.size == 1 }
            .also {
                onActivated {