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

Commit 3747a472 authored by Caitlin Shkuratov's avatar Caitlin Shkuratov
Browse files

[SB Refactor] Remove unused `isDefaultDataSubscription` flow.

Bug: 238425913
Test: verify mobile icon still works
Test: verify mobile demo mode still works
Test: all tests in statusbar.pipeline.mobile. Specifically,
`MobileConnectionsRepositoryTest#config_subIdChangeEvent_updated`
Change-Id: Ia61ebeb0d30fc6616eb917dfaf982ef9d4bd7d57

Change-Id: I01b33b246086583bf071b0c7f1aad47c32dfd8ee
parent 7a6bbb6f
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package com.android.systemui.statusbar.pipeline.mobile.data.repository

import android.telephony.SubscriptionInfo
import android.telephony.SubscriptionManager
import android.telephony.TelephonyCallback
import android.telephony.TelephonyManager
import com.android.systemui.log.table.TableLogBuffer
@@ -54,11 +53,6 @@ interface MobileConnectionRepository {
    val connectionInfo: Flow<MobileConnectionModel>
    /** Observable tracking [TelephonyManager.isDataConnectionAllowed] */
    val dataEnabled: StateFlow<Boolean>
    /**
     * True if this connection represents the default subscription per
     * [SubscriptionManager.getDefaultDataSubscriptionId]
     */
    val isDefaultDataSubscription: StateFlow<Boolean>

    /**
     * See [TelephonyManager.getCdmaEnhancedRoamingIndicatorDisplayNumber]. This bit only matters if
+0 −4
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ package com.android.systemui.statusbar.pipeline.mobile.data.repository

import android.provider.Settings
import android.telephony.CarrierConfigManager
import android.telephony.SubscriptionManager
import com.android.settingslib.SignalIcon.MobileIconGroup
import com.android.settingslib.mobile.MobileMappings
import com.android.settingslib.mobile.MobileMappings.Config
@@ -38,9 +37,6 @@ interface MobileConnectionsRepository {
    /** Observable for the subscriptionId of the current mobile data connection */
    val activeMobileDataSubscriptionId: StateFlow<Int>

    /** Tracks [SubscriptionManager.getDefaultDataSubscriptionId] */
    val defaultDataSubId: StateFlow<Int>

    /** The current connectivity status for the default mobile network connection */
    val defaultMobileNetworkConnectivity: StateFlow<MobileConnectivityModel>

+0 −5
Original line number Diff line number Diff line
@@ -139,11 +139,6 @@ constructor(
    override val defaultMobileIconGroup: Flow<SignalIcon.MobileIconGroup> =
        activeRepo.flatMapLatest { it.defaultMobileIconGroup }

    override val defaultDataSubId: StateFlow<Int> =
        activeRepo
            .flatMapLatest { it.defaultDataSubId }
            .stateIn(scope, SharingStarted.WhileSubscribed(), realRepository.defaultDataSubId.value)

    override val defaultMobileNetworkConnectivity: StateFlow<MobileConnectivityModel> =
        activeRepo
            .flatMapLatest { it.defaultMobileNetworkConnectivity }
+0 −11
Original line number Diff line number Diff line
@@ -139,14 +139,6 @@ constructor(

    private fun <K, V> Map<K, V>.reverse() = entries.associateBy({ it.value }) { it.key }

    // TODO(b/261029387): add a command for this value
    override val defaultDataSubId =
        activeMobileDataSubscriptionId.stateIn(
            scope,
            SharingStarted.WhileSubscribed(),
            INVALID_SUBSCRIPTION_ID
        )

    // TODO(b/261029387): not yet supported
    override val defaultMobileNetworkConnectivity = MutableStateFlow(MobileConnectivityModel())

@@ -199,7 +191,6 @@ constructor(
        val connection = getRepoForSubId(subId)
        // This is always true here, because we split out disabled states at the data-source level
        connection.dataEnabled.value = true
        connection.isDefaultDataSubscription.value = state.dataType != null
        connection.networkName.value = NetworkNameModel.Derived(state.name)

        connection.cdmaRoaming.value = state.roaming
@@ -281,8 +272,6 @@ class DemoMobileConnectionRepository(

    override val dataEnabled = MutableStateFlow(true)

    override val isDefaultDataSubscription = MutableStateFlow(true)

    override val cdmaRoaming = MutableStateFlow(false)

    override val networkName = MutableStateFlow(NetworkNameModel.Derived("demo network"))
+0 −17
Original line number Diff line number Diff line
@@ -78,7 +78,6 @@ class MobileConnectionRepositoryImpl(
    private val telephonyManager: TelephonyManager,
    private val globalSettings: GlobalSettings,
    broadcastDispatcher: BroadcastDispatcher,
    defaultDataSubId: StateFlow<Int>,
    globalMobileDataSettingChangedEvent: Flow<Unit>,
    mobileMappingsProxy: MobileMappingsProxy,
    bgDispatcher: CoroutineDispatcher,
@@ -284,20 +283,6 @@ class MobileConnectionRepositoryImpl(

    private fun dataConnectionAllowed(): Boolean = telephonyManager.isDataConnectionAllowed

    override val isDefaultDataSubscription: StateFlow<Boolean> = run {
        val initialValue = defaultDataSubId.value == subId
        defaultDataSubId
            .mapLatest { it == subId }
            .distinctUntilChanged()
            .logDiffsForTable(
                mobileLogger,
                columnPrefix = "",
                columnName = "isDefaultDataSub",
                initialValue = initialValue,
            )
            .stateIn(scope, SharingStarted.WhileSubscribed(), initialValue)
    }

    class Factory
    @Inject
    constructor(
@@ -315,7 +300,6 @@ class MobileConnectionRepositoryImpl(
            subId: Int,
            defaultNetworkName: NetworkNameModel,
            networkNameSeparator: String,
            defaultDataSubId: StateFlow<Int>,
            globalMobileDataSettingChangedEvent: Flow<Unit>,
        ): MobileConnectionRepository {
            val mobileLogger = logFactory.create(tableBufferLogName(subId), 100)
@@ -328,7 +312,6 @@ class MobileConnectionRepositoryImpl(
                telephonyManager.createForSubscriptionId(subId),
                globalSettings,
                broadcastDispatcher,
                defaultDataSubId,
                globalMobileDataSettingChangedEvent,
                mobileMappingsProxy,
                bgDispatcher,
Loading