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

Commit 1a10e2da authored by Evan Laird's avatar Evan Laird
Browse files

[sb] expose `defaultDataSubId` from MobileIconsInteractor

It will be needed in future CLs

Test: MobileIconsInteractorTest
Bug: 364360986
Flag: com.android.systemui.status_bar_root_modernization
Change-Id: I91a51b7861d9bffb8d960cdd96f550c8087a0d65
parent 950a47ab
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -885,6 +885,20 @@ class MobileIconsInteractorTest : SysuiTestCase() {
            assertThat(latest).isFalse()
        }

    @Test
    fun defaultDataSubId_tracksRepo() =
        kosmos.runTest {
            val latest by collectLastValue(underTest.defaultDataSubId)

            connectionsRepository.defaultDataSubId.value = 1

            assertThat(latest).isEqualTo(1)

            connectionsRepository.defaultDataSubId.value = 2

            assertThat(latest).isEqualTo(2)
        }

    /**
     * Convenience method for creating a pair of subscriptions to test the filteredSubscriptions
     * flow.
+8 −3
Original line number Diff line number Diff line
@@ -71,6 +71,9 @@ interface MobileIconsInteractor {
    /** List of subscriptions, potentially filtered for CBRS */
    val filteredSubscriptions: Flow<List<SubscriptionModel>>

    /** Subscription ID of the current default data subscription */
    val defaultDataSubId: Flow<Int>

    /**
     * The current list of [MobileIconInteractor]s associated with the current list of
     * [filteredSubscriptions]
@@ -82,7 +85,7 @@ interface MobileIconsInteractor {

    /**
     * Flow providing a reference to the Interactor for the active data subId. This represents the
     * [MobileConnectionInteractor] responsible for the active data connection, if any.
     * [MobileIconInteractor] responsible for the active data connection, if any.
     */
    val activeDataIconInteractor: StateFlow<MobileIconInteractor?>

@@ -280,6 +283,8 @@ constructor(
        }
    }

    override val defaultDataSubId = mobileConnectionsRepo.defaultDataSubId

    override val icons =
        filteredSubscriptions
            .mapLatest { subs ->
@@ -321,7 +326,7 @@ constructor(
        mobileConnectionsRepo.defaultMobileIconMapping.stateIn(
            scope,
            SharingStarted.WhileSubscribed(),
            initialValue = mapOf()
            initialValue = mapOf(),
        )

    override val alwaysShowDataRatIcon: StateFlow<Boolean> =
@@ -350,7 +355,7 @@ constructor(
        mobileConnectionsRepo.defaultMobileIconGroup.stateIn(
            scope,
            SharingStarted.WhileSubscribed(),
            initialValue = TelephonyIcons.G
            initialValue = TelephonyIcons.G,
        )

    /**
+2 −0
Original line number Diff line number Diff line
@@ -55,6 +55,8 @@ class FakeMobileIconsInteractor(

    override val filteredSubscriptions = MutableStateFlow<List<SubscriptionModel>>(listOf())

    override val defaultDataSubId = MutableStateFlow(DEFAULT_DATA_SUB_ID)

    private val _activeDataConnectionHasDataEnabled = MutableStateFlow(false)
    override val activeDataConnectionHasDataEnabled = _activeDataConnectionHasDataEnabled