Loading packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/MobileConnectionsRepository.kt +7 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,13 @@ interface MobileConnectionsRepository { */ val mobileIsDefault: StateFlow<Boolean> /** * True if the device currently has a carrier merged connection. * * See [CarrierMergedConnectionRepository] for more info. */ val hasCarrierMergedConnection: Flow<Boolean> /** True if the default network connection is validated and false otherwise. */ val defaultConnectionIsValidated: StateFlow<Boolean> Loading packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/MobileRepositorySwitcher.kt +9 −0 Original line number Diff line number Diff line Loading @@ -159,6 +159,15 @@ constructor( .flatMapLatest { it.mobileIsDefault } .stateIn(scope, SharingStarted.WhileSubscribed(), realRepository.mobileIsDefault.value) override val hasCarrierMergedConnection: StateFlow<Boolean> = activeRepo .flatMapLatest { it.hasCarrierMergedConnection } .stateIn( scope, SharingStarted.WhileSubscribed(), realRepository.hasCarrierMergedConnection.value, ) override val defaultConnectionIsValidated: StateFlow<Boolean> = activeRepo .flatMapLatest { it.defaultConnectionIsValidated } Loading packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/demo/DemoMobileConnectionsRepository.kt +3 −0 Original line number Diff line number Diff line Loading @@ -159,6 +159,9 @@ constructor( // TODO(b/261029387): not yet supported override val mobileIsDefault: StateFlow<Boolean> = MutableStateFlow(true) // TODO(b/261029387): not yet supported override val hasCarrierMergedConnection = MutableStateFlow(false) // TODO(b/261029387): not yet supported override val defaultConnectionIsValidated: StateFlow<Boolean> = MutableStateFlow(true) Loading packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionsRepositoryImpl.kt +19 −4 Original line number Diff line number Diff line Loading @@ -59,6 +59,7 @@ import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.flowOn import kotlinx.coroutines.flow.map Loading Loading @@ -257,18 +258,32 @@ constructor( override val mobileIsDefault: StateFlow<Boolean> = connectivityRepository.defaultConnections // Because carrier merged networks are displayed as mobile networks, they're // part of the `isDefault` calculation. See b/272586234. .map { it.mobile.isDefault || it.carrierMerged.isDefault } .map { it.mobile.isDefault } .distinctUntilChanged() .logDiffsForTable( tableLogger, columnPrefix = "", columnPrefix = LOGGING_PREFIX, columnName = "mobileIsDefault", initialValue = false, ) .stateIn(scope, SharingStarted.WhileSubscribed(), false) override val hasCarrierMergedConnection: StateFlow<Boolean> = combine( connectivityRepository.defaultConnections, carrierMergedSubId, ) { defaultConnections, carrierMergedSubId -> defaultConnections.carrierMerged.isDefault || carrierMergedSubId != null } .distinctUntilChanged() .logDiffsForTable( tableLogger, columnPrefix = LOGGING_PREFIX, columnName = "hasCarrierMergedConnection", initialValue = false, ) .stateIn(scope, SharingStarted.WhileSubscribed(), false) override val defaultConnectionIsValidated: StateFlow<Boolean> = connectivityRepository.defaultConnections .map { it.isValidated } Loading packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconsInteractor.kt +16 −1 Original line number Diff line number Diff line Loading @@ -113,7 +113,22 @@ constructor( private val context: Context, ) : MobileIconsInteractor { override val mobileIsDefault = mobileConnectionsRepo.mobileIsDefault override val mobileIsDefault = combine( mobileConnectionsRepo.mobileIsDefault, mobileConnectionsRepo.hasCarrierMergedConnection, ) { mobileIsDefault, hasCarrierMergedConnection -> // Because carrier merged networks are displayed as mobile networks, they're part of // the `isDefault` calculation. See b/272586234. mobileIsDefault || hasCarrierMergedConnection } .logDiffsForTable( tableLogger, LOGGING_PREFIX, columnName = "mobileIsDefault", initialValue = false, ) .stateIn(scope, SharingStarted.WhileSubscribed(), false) override val activeDataConnectionHasDataEnabled: StateFlow<Boolean> = mobileConnectionsRepo.activeMobileDataRepository Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/MobileConnectionsRepository.kt +7 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,13 @@ interface MobileConnectionsRepository { */ val mobileIsDefault: StateFlow<Boolean> /** * True if the device currently has a carrier merged connection. * * See [CarrierMergedConnectionRepository] for more info. */ val hasCarrierMergedConnection: Flow<Boolean> /** True if the default network connection is validated and false otherwise. */ val defaultConnectionIsValidated: StateFlow<Boolean> Loading
packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/MobileRepositorySwitcher.kt +9 −0 Original line number Diff line number Diff line Loading @@ -159,6 +159,15 @@ constructor( .flatMapLatest { it.mobileIsDefault } .stateIn(scope, SharingStarted.WhileSubscribed(), realRepository.mobileIsDefault.value) override val hasCarrierMergedConnection: StateFlow<Boolean> = activeRepo .flatMapLatest { it.hasCarrierMergedConnection } .stateIn( scope, SharingStarted.WhileSubscribed(), realRepository.hasCarrierMergedConnection.value, ) override val defaultConnectionIsValidated: StateFlow<Boolean> = activeRepo .flatMapLatest { it.defaultConnectionIsValidated } Loading
packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/demo/DemoMobileConnectionsRepository.kt +3 −0 Original line number Diff line number Diff line Loading @@ -159,6 +159,9 @@ constructor( // TODO(b/261029387): not yet supported override val mobileIsDefault: StateFlow<Boolean> = MutableStateFlow(true) // TODO(b/261029387): not yet supported override val hasCarrierMergedConnection = MutableStateFlow(false) // TODO(b/261029387): not yet supported override val defaultConnectionIsValidated: StateFlow<Boolean> = MutableStateFlow(true) Loading
packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionsRepositoryImpl.kt +19 −4 Original line number Diff line number Diff line Loading @@ -59,6 +59,7 @@ import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.flowOn import kotlinx.coroutines.flow.map Loading Loading @@ -257,18 +258,32 @@ constructor( override val mobileIsDefault: StateFlow<Boolean> = connectivityRepository.defaultConnections // Because carrier merged networks are displayed as mobile networks, they're // part of the `isDefault` calculation. See b/272586234. .map { it.mobile.isDefault || it.carrierMerged.isDefault } .map { it.mobile.isDefault } .distinctUntilChanged() .logDiffsForTable( tableLogger, columnPrefix = "", columnPrefix = LOGGING_PREFIX, columnName = "mobileIsDefault", initialValue = false, ) .stateIn(scope, SharingStarted.WhileSubscribed(), false) override val hasCarrierMergedConnection: StateFlow<Boolean> = combine( connectivityRepository.defaultConnections, carrierMergedSubId, ) { defaultConnections, carrierMergedSubId -> defaultConnections.carrierMerged.isDefault || carrierMergedSubId != null } .distinctUntilChanged() .logDiffsForTable( tableLogger, columnPrefix = LOGGING_PREFIX, columnName = "hasCarrierMergedConnection", initialValue = false, ) .stateIn(scope, SharingStarted.WhileSubscribed(), false) override val defaultConnectionIsValidated: StateFlow<Boolean> = connectivityRepository.defaultConnections .map { it.isValidated } Loading
packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconsInteractor.kt +16 −1 Original line number Diff line number Diff line Loading @@ -113,7 +113,22 @@ constructor( private val context: Context, ) : MobileIconsInteractor { override val mobileIsDefault = mobileConnectionsRepo.mobileIsDefault override val mobileIsDefault = combine( mobileConnectionsRepo.mobileIsDefault, mobileConnectionsRepo.hasCarrierMergedConnection, ) { mobileIsDefault, hasCarrierMergedConnection -> // Because carrier merged networks are displayed as mobile networks, they're part of // the `isDefault` calculation. See b/272586234. mobileIsDefault || hasCarrierMergedConnection } .logDiffsForTable( tableLogger, LOGGING_PREFIX, columnName = "mobileIsDefault", initialValue = false, ) .stateIn(scope, SharingStarted.WhileSubscribed(), false) override val activeDataConnectionHasDataEnabled: StateFlow<Boolean> = mobileConnectionsRepo.activeMobileDataRepository Loading