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

Commit e6fd4958 authored by Evan Laird's avatar Evan Laird
Browse files

[Sb refactor] Move subIdFlow into its own repository

This CL keeps the pattern of "MobileIcons/MobileIcon" to distinguish 2
layers of MobileConnection repositories here:
`MobileConnectionsRepository` and `MobileConnectionRepository`. This
allows us to use ad-hoc repository classes to track state from
`TelephonyManager` objects created using
`TelephonyManager#createForSubscriptionId`.

The intention now is that the top-level repository will track and cache
the child repos as needed, and remove its cache when the subscription
list changes such that they no longer track valid subIds. Downstream
observers will still have to be cleaned up via the UiAdapter, which will
close the observed data streams.

Test: atest MobileConnectionRepositoryTest
Bug: 240492102
Change-Id: Id53733ac8a84869a57133b2e0055105a716a219d
parent 4c52a3c3
Loading
Loading
Loading
Loading
+5 −5
Original line number Original line Diff line number Diff line
@@ -18,8 +18,8 @@ package com.android.systemui.statusbar.pipeline.dagger


import com.android.systemui.statusbar.pipeline.airplane.data.repository.AirplaneModeRepository
import com.android.systemui.statusbar.pipeline.airplane.data.repository.AirplaneModeRepository
import com.android.systemui.statusbar.pipeline.airplane.data.repository.AirplaneModeRepositoryImpl
import com.android.systemui.statusbar.pipeline.airplane.data.repository.AirplaneModeRepositoryImpl
import com.android.systemui.statusbar.pipeline.mobile.data.repository.MobileSubscriptionRepository
import com.android.systemui.statusbar.pipeline.mobile.data.repository.MobileConnectionsRepository
import com.android.systemui.statusbar.pipeline.mobile.data.repository.MobileSubscriptionRepositoryImpl
import com.android.systemui.statusbar.pipeline.mobile.data.repository.MobileConnectionsRepositoryImpl
import com.android.systemui.statusbar.pipeline.mobile.data.repository.UserSetupRepository
import com.android.systemui.statusbar.pipeline.mobile.data.repository.UserSetupRepository
import com.android.systemui.statusbar.pipeline.mobile.data.repository.UserSetupRepositoryImpl
import com.android.systemui.statusbar.pipeline.mobile.data.repository.UserSetupRepositoryImpl
import com.android.systemui.statusbar.pipeline.mobile.domain.interactor.MobileIconsInteractor
import com.android.systemui.statusbar.pipeline.mobile.domain.interactor.MobileIconsInteractor
@@ -45,9 +45,9 @@ abstract class StatusBarPipelineModule {
    abstract fun wifiRepository(impl: WifiRepositoryImpl): WifiRepository
    abstract fun wifiRepository(impl: WifiRepositoryImpl): WifiRepository


    @Binds
    @Binds
    abstract fun mobileSubscriptionRepository(
    abstract fun mobileConnectionsRepository(
        impl: MobileSubscriptionRepositoryImpl
        impl: MobileConnectionsRepositoryImpl
    ): MobileSubscriptionRepository
    ): MobileConnectionsRepository


    @Binds
    @Binds
    abstract fun userSetupRepository(impl: UserSetupRepositoryImpl): UserSetupRepository
    abstract fun userSetupRepository(impl: UserSetupRepositoryImpl): UserSetupRepository
+185 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.statusbar.pipeline.mobile.data.repository

import android.telephony.CellSignalStrength
import android.telephony.CellSignalStrengthCdma
import android.telephony.ServiceState
import android.telephony.SignalStrength
import android.telephony.SubscriptionInfo
import android.telephony.TelephonyCallback
import android.telephony.TelephonyDisplayInfo
import android.telephony.TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE
import android.telephony.TelephonyManager
import com.android.systemui.common.coroutine.ConflatedCallbackFlow.conflatedCallbackFlow
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.dagger.qualifiers.Background
import com.android.systemui.statusbar.pipeline.mobile.data.model.DefaultNetworkType
import com.android.systemui.statusbar.pipeline.mobile.data.model.MobileSubscriptionModel
import com.android.systemui.statusbar.pipeline.mobile.data.model.OverrideNetworkType
import com.android.systemui.statusbar.pipeline.shared.ConnectivityPipelineLogger
import java.lang.IllegalStateException
import javax.inject.Inject
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.asExecutor
import kotlinx.coroutines.channels.awaitClose
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.stateIn

/**
 * Every mobile line of service can be identified via a [SubscriptionInfo] object. We set up a
 * repository for each individual, tracked subscription via [MobileConnectionsRepository], and this
 * repository is responsible for setting up a [TelephonyManager] object tied to its subscriptionId
 *
 * There should only ever be one [MobileConnectionRepository] per subscription, since
 * [TelephonyManager] limits the number of callbacks that can be registered per process.
 *
 * This repository should have all of the relevant information for a single line of service, which
 * eventually becomes a single icon in the status bar.
 */
interface MobileConnectionRepository {
    /**
     * A flow that aggregates all necessary callbacks from [TelephonyCallback] into a single
     * listener + model.
     */
    val subscriptionModelFlow: Flow<MobileSubscriptionModel>
}

@Suppress("EXPERIMENTAL_IS_NOT_ENABLED")
@OptIn(ExperimentalCoroutinesApi::class)
class MobileConnectionRepositoryImpl(
    private val subId: Int,
    telephonyManager: TelephonyManager,
    bgDispatcher: CoroutineDispatcher,
    logger: ConnectivityPipelineLogger,
    scope: CoroutineScope,
) : MobileConnectionRepository {
    init {
        if (telephonyManager.subscriptionId != subId) {
            throw IllegalStateException(
                "TelephonyManager should be created with subId($subId). " +
                    "Found ${telephonyManager.subscriptionId} instead."
            )
        }
    }

    override val subscriptionModelFlow: StateFlow<MobileSubscriptionModel> = run {
        var state = MobileSubscriptionModel()
        conflatedCallbackFlow {
                // TODO (b/240569788): log all of these into the connectivity logger
                val callback =
                    object :
                        TelephonyCallback(),
                        TelephonyCallback.ServiceStateListener,
                        TelephonyCallback.SignalStrengthsListener,
                        TelephonyCallback.DataConnectionStateListener,
                        TelephonyCallback.DataActivityListener,
                        TelephonyCallback.CarrierNetworkListener,
                        TelephonyCallback.DisplayInfoListener {
                        override fun onServiceStateChanged(serviceState: ServiceState) {
                            state = state.copy(isEmergencyOnly = serviceState.isEmergencyOnly)
                            trySend(state)
                        }

                        override fun onSignalStrengthsChanged(signalStrength: SignalStrength) {
                            val cdmaLevel =
                                signalStrength
                                    .getCellSignalStrengths(CellSignalStrengthCdma::class.java)
                                    .let { strengths ->
                                        if (!strengths.isEmpty()) {
                                            strengths[0].level
                                        } else {
                                            CellSignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN
                                        }
                                    }

                            val primaryLevel = signalStrength.level

                            state =
                                state.copy(
                                    cdmaLevel = cdmaLevel,
                                    primaryLevel = primaryLevel,
                                    isGsm = signalStrength.isGsm,
                                )
                            trySend(state)
                        }

                        override fun onDataConnectionStateChanged(
                            dataState: Int,
                            networkType: Int
                        ) {
                            state = state.copy(dataConnectionState = dataState)
                            trySend(state)
                        }

                        override fun onDataActivity(direction: Int) {
                            state = state.copy(dataActivityDirection = direction)
                            trySend(state)
                        }

                        override fun onCarrierNetworkChange(active: Boolean) {
                            state = state.copy(carrierNetworkChangeActive = active)
                            trySend(state)
                        }

                        override fun onDisplayInfoChanged(
                            telephonyDisplayInfo: TelephonyDisplayInfo
                        ) {
                            val networkType =
                                if (
                                    telephonyDisplayInfo.overrideNetworkType ==
                                        OVERRIDE_NETWORK_TYPE_NONE
                                ) {
                                    DefaultNetworkType(telephonyDisplayInfo.networkType)
                                } else {
                                    OverrideNetworkType(telephonyDisplayInfo.overrideNetworkType)
                                }
                            state = state.copy(resolvedNetworkType = networkType)
                            trySend(state)
                        }
                    }
                telephonyManager.registerTelephonyCallback(bgDispatcher.asExecutor(), callback)
                awaitClose { telephonyManager.unregisterTelephonyCallback(callback) }
            }
            .onEach { logger.logOutputChange("mobileSubscriptionModel", it.toString()) }
            .stateIn(scope, SharingStarted.WhileSubscribed(), state)
    }

    class Factory
    @Inject
    constructor(
        private val telephonyManager: TelephonyManager,
        private val logger: ConnectivityPipelineLogger,
        @Background private val bgDispatcher: CoroutineDispatcher,
        @Application private val scope: CoroutineScope,
    ) {
        fun build(subId: Int): MobileConnectionRepository {
            return MobileConnectionRepositoryImpl(
                subId,
                telephonyManager.createForSubscriptionId(subId),
                bgDispatcher,
                logger,
                scope,
            )
        }
    }
}
+37 −112
Original line number Original line Diff line number Diff line
@@ -19,22 +19,10 @@ package com.android.systemui.statusbar.pipeline.mobile.data.repository
import android.content.Context
import android.content.Context
import android.content.IntentFilter
import android.content.IntentFilter
import android.telephony.CarrierConfigManager
import android.telephony.CarrierConfigManager
import android.telephony.CellSignalStrength
import android.telephony.CellSignalStrengthCdma
import android.telephony.ServiceState
import android.telephony.SignalStrength
import android.telephony.SubscriptionInfo
import android.telephony.SubscriptionInfo
import android.telephony.SubscriptionManager
import android.telephony.SubscriptionManager
import android.telephony.TelephonyCallback
import android.telephony.TelephonyCallback
import android.telephony.TelephonyCallback.ActiveDataSubscriptionIdListener
import android.telephony.TelephonyCallback.ActiveDataSubscriptionIdListener
import android.telephony.TelephonyCallback.CarrierNetworkListener
import android.telephony.TelephonyCallback.DataActivityListener
import android.telephony.TelephonyCallback.DataConnectionStateListener
import android.telephony.TelephonyCallback.DisplayInfoListener
import android.telephony.TelephonyCallback.ServiceStateListener
import android.telephony.TelephonyCallback.SignalStrengthsListener
import android.telephony.TelephonyDisplayInfo
import android.telephony.TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE
import android.telephony.TelephonyManager
import android.telephony.TelephonyManager
import androidx.annotation.VisibleForTesting
import androidx.annotation.VisibleForTesting
import com.android.settingslib.mobile.MobileMappings
import com.android.settingslib.mobile.MobileMappings
@@ -44,10 +32,6 @@ import com.android.systemui.common.coroutine.ConflatedCallbackFlow.conflatedCall
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.dagger.qualifiers.Background
import com.android.systemui.dagger.qualifiers.Background
import com.android.systemui.statusbar.pipeline.mobile.data.model.DefaultNetworkType
import com.android.systemui.statusbar.pipeline.mobile.data.model.MobileSubscriptionModel
import com.android.systemui.statusbar.pipeline.mobile.data.model.OverrideNetworkType
import com.android.systemui.statusbar.pipeline.mobile.util.MobileMappingsProxy
import com.android.systemui.statusbar.pipeline.shared.ConnectivityPipelineLogger
import com.android.systemui.statusbar.pipeline.shared.ConnectivityPipelineLogger
import javax.inject.Inject
import javax.inject.Inject
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.CoroutineDispatcher
@@ -68,7 +52,7 @@ import kotlinx.coroutines.withContext
 * Repo for monitoring the complete active subscription info list, to be consumed and filtered based
 * Repo for monitoring the complete active subscription info list, to be consumed and filtered based
 * on various policy
 * on various policy
 */
 */
interface MobileSubscriptionRepository {
interface MobileConnectionsRepository {
    /** Observable list of current mobile subscriptions */
    /** Observable list of current mobile subscriptions */
    val subscriptionsFlow: Flow<List<SubscriptionInfo>>
    val subscriptionsFlow: Flow<List<SubscriptionInfo>>


@@ -78,14 +62,14 @@ interface MobileSubscriptionRepository {
    /** Observable for [MobileMappings.Config] tracking the defaults */
    /** Observable for [MobileMappings.Config] tracking the defaults */
    val defaultDataSubRatConfig: StateFlow<Config>
    val defaultDataSubRatConfig: StateFlow<Config>


    /** Get or create an observable for the given subscription ID */
    /** Get or create a repository for the line of service for the given subscription ID */
    fun getFlowForSubId(subId: Int): Flow<MobileSubscriptionModel>
    fun getRepoForSubId(subId: Int): MobileConnectionRepository
}
}


@Suppress("EXPERIMENTAL_IS_NOT_ENABLED")
@Suppress("EXPERIMENTAL_IS_NOT_ENABLED")
@OptIn(ExperimentalCoroutinesApi::class)
@OptIn(ExperimentalCoroutinesApi::class)
@SysUISingleton
@SysUISingleton
class MobileSubscriptionRepositoryImpl
class MobileConnectionsRepositoryImpl
@Inject
@Inject
constructor(
constructor(
    private val subscriptionManager: SubscriptionManager,
    private val subscriptionManager: SubscriptionManager,
@@ -93,11 +77,11 @@ constructor(
    private val logger: ConnectivityPipelineLogger,
    private val logger: ConnectivityPipelineLogger,
    broadcastDispatcher: BroadcastDispatcher,
    broadcastDispatcher: BroadcastDispatcher,
    private val context: Context,
    private val context: Context,
    private val mobileMappings: MobileMappingsProxy,
    @Background private val bgDispatcher: CoroutineDispatcher,
    @Background private val bgDispatcher: CoroutineDispatcher,
    @Application private val scope: CoroutineScope,
    @Application private val scope: CoroutineScope,
) : MobileSubscriptionRepository {
    private val mobileConnectionRepositoryFactory: MobileConnectionRepositoryImpl.Factory
    private val subIdFlowCache: MutableMap<Int, StateFlow<MobileSubscriptionModel>> = mutableMapOf()
) : MobileConnectionsRepository {
    private val subIdRepositoryCache: MutableMap<Int, MobileConnectionRepository> = mutableMapOf()


    /**
    /**
     * State flow that emits the set of mobile data subscriptions, each represented by its own
     * State flow that emits the set of mobile data subscriptions, each represented by its own
@@ -121,6 +105,7 @@ constructor(
                awaitClose { subscriptionManager.removeOnSubscriptionsChangedListener(callback) }
                awaitClose { subscriptionManager.removeOnSubscriptionsChangedListener(callback) }
            }
            }
            .mapLatest { fetchSubscriptionsList() }
            .mapLatest { fetchSubscriptionsList() }
            .onEach { infos -> dropUnusedReposFromCache(infos) }
            .stateIn(scope, started = SharingStarted.WhileSubscribed(), listOf())
            .stateIn(scope, started = SharingStarted.WhileSubscribed(), listOf())


    /** StateFlow that keeps track of the current active mobile data subscription */
    /** StateFlow that keeps track of the current active mobile data subscription */
@@ -172,103 +157,43 @@ constructor(
                initialValue = Config.readConfig(context)
                initialValue = Config.readConfig(context)
            )
            )


    /**
    override fun getRepoForSubId(subId: Int): MobileConnectionRepository {
     * Each mobile subscription needs its own flow, which comes from registering listeners on the
        if (!isValidSubId(subId)) {
     * system. Use this method to create those flows and cache them for reuse
            throw IllegalArgumentException(
     */
                "subscriptionId $subId is not in the list of valid subscriptions"
    override fun getFlowForSubId(subId: Int): StateFlow<MobileSubscriptionModel> {
            )
        return subIdFlowCache[subId]
            ?: createFlowForSubId(subId).also { subIdFlowCache[subId] = it }
        }
        }


    @VisibleForTesting fun getSubIdFlowCache() = subIdFlowCache
        return subIdRepositoryCache[subId]

            ?: createRepositoryForSubId(subId).also { subIdRepositoryCache[subId] = it }
    private fun createFlowForSubId(subId: Int): StateFlow<MobileSubscriptionModel> = run {
        var state = MobileSubscriptionModel()
        conflatedCallbackFlow {
                val phony = telephonyManager.createForSubscriptionId(subId)
                // TODO (b/240569788): log all of these into the connectivity logger
                val callback =
                    object :
                        TelephonyCallback(),
                        ServiceStateListener,
                        SignalStrengthsListener,
                        DataConnectionStateListener,
                        DataActivityListener,
                        CarrierNetworkListener,
                        DisplayInfoListener {
                        override fun onServiceStateChanged(serviceState: ServiceState) {
                            state = state.copy(isEmergencyOnly = serviceState.isEmergencyOnly)
                            trySend(state)
    }
    }


                        override fun onSignalStrengthsChanged(signalStrength: SignalStrength) {
    private fun isValidSubId(subId: Int): Boolean {
                            val cdmaLevel =
        subscriptionsFlow.value.forEach {
                                signalStrength
            if (it.subscriptionId == subId) {
                                    .getCellSignalStrengths(CellSignalStrengthCdma::class.java)
                return true
                                    .let { strengths ->
                                        if (!strengths.isEmpty()) {
                                            strengths[0].level
                                        } else {
                                            CellSignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN
                                        }
            }
            }

                            val primaryLevel = signalStrength.level

                            state =
                                state.copy(
                                    cdmaLevel = cdmaLevel,
                                    primaryLevel = primaryLevel,
                                    isGsm = signalStrength.isGsm,
                                )
                            trySend(state)
        }
        }


                        override fun onDataConnectionStateChanged(
        return false
                            dataState: Int,
                            networkType: Int
                        ) {
                            state = state.copy(dataConnectionState = dataState)
                            trySend(state)
    }
    }


                        override fun onDataActivity(direction: Int) {
    @VisibleForTesting fun getSubIdRepoCache() = subIdRepositoryCache
                            state = state.copy(dataActivityDirection = direction)
                            trySend(state)
                        }


                        override fun onCarrierNetworkChange(active: Boolean) {
    private fun createRepositoryForSubId(subId: Int): MobileConnectionRepository {
                            state = state.copy(carrierNetworkChangeActive = active)
        return mobileConnectionRepositoryFactory.build(subId)
                            trySend(state)
    }
    }


                        override fun onDisplayInfoChanged(
    private fun dropUnusedReposFromCache(newInfos: List<SubscriptionInfo>) {
                            telephonyDisplayInfo: TelephonyDisplayInfo
        // Remove any connection repository from the cache that isn't in the new set of IDs. They
                        ) {
        // will get garbage collected once their subscribers go away
                            val networkType =
        val currentValidSubscriptionIds = newInfos.map { it.subscriptionId }
                                if (
                                    telephonyDisplayInfo.overrideNetworkType ==
                                        OVERRIDE_NETWORK_TYPE_NONE
                                ) {
                                    DefaultNetworkType(telephonyDisplayInfo.networkType)
                                } else {
                                    OverrideNetworkType(telephonyDisplayInfo.overrideNetworkType)
                                }


                            state = state.copy(resolvedNetworkType = networkType)
        subIdRepositoryCache.keys.forEach {
                            trySend(state)
            if (!currentValidSubscriptionIds.contains(it)) {
                        }
                subIdRepositoryCache.remove(it)
                    }
                phony.registerTelephonyCallback(bgDispatcher.asExecutor(), callback)
                awaitClose {
                    phony.unregisterTelephonyCallback(callback)
                    // Release the cached flow
                    subIdFlowCache.remove(subId)
            }
            }
        }
        }
            .onEach { logger.logOutputChange("mobileSubscriptionModel", it.toString()) }
            .stateIn(scope, SharingStarted.WhileSubscribed(), state)
    }
    }


    private suspend fun fetchSubscriptionsList(): List<SubscriptionInfo> =
    private suspend fun fetchSubscriptionsList(): List<SubscriptionInfo> =
+4 −2
Original line number Original line Diff line number Diff line
@@ -19,8 +19,8 @@ package com.android.systemui.statusbar.pipeline.mobile.domain.interactor
import android.telephony.CarrierConfigManager
import android.telephony.CarrierConfigManager
import com.android.settingslib.SignalIcon.MobileIconGroup
import com.android.settingslib.SignalIcon.MobileIconGroup
import com.android.systemui.statusbar.pipeline.mobile.data.model.DefaultNetworkType
import com.android.systemui.statusbar.pipeline.mobile.data.model.DefaultNetworkType
import com.android.systemui.statusbar.pipeline.mobile.data.model.MobileSubscriptionModel
import com.android.systemui.statusbar.pipeline.mobile.data.model.OverrideNetworkType
import com.android.systemui.statusbar.pipeline.mobile.data.model.OverrideNetworkType
import com.android.systemui.statusbar.pipeline.mobile.data.repository.MobileConnectionRepository
import com.android.systemui.statusbar.pipeline.mobile.util.MobileMappingsProxy
import com.android.systemui.statusbar.pipeline.mobile.util.MobileMappingsProxy
import com.android.systemui.util.CarrierConfigTracker
import com.android.systemui.util.CarrierConfigTracker
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.Flow
@@ -50,8 +50,10 @@ class MobileIconInteractorImpl(
    defaultMobileIconMapping: Flow<Map<String, MobileIconGroup>>,
    defaultMobileIconMapping: Flow<Map<String, MobileIconGroup>>,
    defaultMobileIconGroup: Flow<MobileIconGroup>,
    defaultMobileIconGroup: Flow<MobileIconGroup>,
    mobileMappingsProxy: MobileMappingsProxy,
    mobileMappingsProxy: MobileMappingsProxy,
    mobileStatusInfo: Flow<MobileSubscriptionModel>,
    connectionRepository: MobileConnectionRepository,
) : MobileIconInteractor {
) : MobileIconInteractor {
    private val mobileStatusInfo = connectionRepository.subscriptionModelFlow

    /** Observable for the current RAT indicator icon ([MobileIconGroup]) */
    /** Observable for the current RAT indicator icon ([MobileIconGroup]) */
    override val networkTypeIconGroup: Flow<MobileIconGroup> =
    override val networkTypeIconGroup: Flow<MobileIconGroup> =
        combine(
        combine(
+3 −10
Original line number Original line Diff line number Diff line
@@ -23,8 +23,7 @@ import com.android.settingslib.SignalIcon.MobileIconGroup
import com.android.settingslib.mobile.TelephonyIcons
import com.android.settingslib.mobile.TelephonyIcons
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.statusbar.pipeline.mobile.data.model.MobileSubscriptionModel
import com.android.systemui.statusbar.pipeline.mobile.data.repository.MobileConnectionsRepository
import com.android.systemui.statusbar.pipeline.mobile.data.repository.MobileSubscriptionRepository
import com.android.systemui.statusbar.pipeline.mobile.data.repository.UserSetupRepository
import com.android.systemui.statusbar.pipeline.mobile.data.repository.UserSetupRepository
import com.android.systemui.statusbar.pipeline.mobile.util.MobileMappingsProxy
import com.android.systemui.statusbar.pipeline.mobile.util.MobileMappingsProxy
import com.android.systemui.util.CarrierConfigTracker
import com.android.systemui.util.CarrierConfigTracker
@@ -59,7 +58,7 @@ interface MobileIconsInteractor {
class MobileIconsInteractorImpl
class MobileIconsInteractorImpl
@Inject
@Inject
constructor(
constructor(
    private val mobileSubscriptionRepo: MobileSubscriptionRepository,
    private val mobileSubscriptionRepo: MobileConnectionsRepository,
    private val carrierConfigTracker: CarrierConfigTracker,
    private val carrierConfigTracker: CarrierConfigTracker,
    private val mobileMappingsProxy: MobileMappingsProxy,
    private val mobileMappingsProxy: MobileMappingsProxy,
    userSetupRepo: UserSetupRepository,
    userSetupRepo: UserSetupRepository,
@@ -138,12 +137,6 @@ constructor(
            defaultMobileIconMapping,
            defaultMobileIconMapping,
            defaultMobileIconGroup,
            defaultMobileIconGroup,
            mobileMappingsProxy,
            mobileMappingsProxy,
            mobileSubscriptionFlowForSubId(subId),
            mobileSubscriptionRepo.getRepoForSubId(subId),
        )
        )

    /**
     * Create a new flow for a given subscription ID, which usually maps 1:1 with mobile connections
     */
    private fun mobileSubscriptionFlowForSubId(subId: Int): Flow<MobileSubscriptionModel> =
        mobileSubscriptionRepo.getFlowForSubId(subId)
}
}
Loading