Merge changes Ib9dde023,I917506fc,I8576cc36 into udc-dev
* changes: [SB Refactor] Only use carrier merged sub ID if wifi or CM are default. [SB Refactor] Use a real WifiRepo in MobileConnectionsRepositoryTest. [SB Refactor] Convert MobileConnectionsRepositoryTest to testScope etc.
This commit is contained in:
committed by
Android (Google) Code Review
commit
ab3637736a
@@ -160,7 +160,7 @@ abstract class StatusBarPipelineModule {
|
|||||||
@SysUISingleton
|
@SysUISingleton
|
||||||
@SharedConnectivityInputLog
|
@SharedConnectivityInputLog
|
||||||
fun provideSharedConnectivityTableLogBuffer(factory: LogBufferFactory): LogBuffer {
|
fun provideSharedConnectivityTableLogBuffer(factory: LogBufferFactory): LogBuffer {
|
||||||
return factory.create("SharedConnectivityInputLog", 30)
|
return factory.create("SharedConnectivityInputLog", 60)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ 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.log.table.TableLogBuffer
|
import com.android.systemui.log.table.TableLogBuffer
|
||||||
import com.android.systemui.log.table.logDiffsForTable
|
import com.android.systemui.log.table.logDiffsForTable
|
||||||
|
import com.android.systemui.statusbar.pipeline.airplane.data.repository.AirplaneModeRepository
|
||||||
import com.android.systemui.statusbar.pipeline.dagger.MobileSummaryLog
|
import com.android.systemui.statusbar.pipeline.dagger.MobileSummaryLog
|
||||||
import com.android.systemui.statusbar.pipeline.mobile.data.MobileInputLogger
|
import com.android.systemui.statusbar.pipeline.mobile.data.MobileInputLogger
|
||||||
import com.android.systemui.statusbar.pipeline.mobile.data.model.NetworkNameModel
|
import com.android.systemui.statusbar.pipeline.mobile.data.model.NetworkNameModel
|
||||||
@@ -88,6 +89,7 @@ constructor(
|
|||||||
private val context: Context,
|
private val context: Context,
|
||||||
@Background private val bgDispatcher: CoroutineDispatcher,
|
@Background private val bgDispatcher: CoroutineDispatcher,
|
||||||
@Application private val scope: CoroutineScope,
|
@Application private val scope: CoroutineScope,
|
||||||
|
airplaneModeRepository: AirplaneModeRepository,
|
||||||
// Some "wifi networks" should be rendered as a mobile connection, which is why the wifi
|
// Some "wifi networks" should be rendered as a mobile connection, which is why the wifi
|
||||||
// repository is an input to the mobile repository.
|
// repository is an input to the mobile repository.
|
||||||
// See [CarrierMergedConnectionRepository] for details.
|
// See [CarrierMergedConnectionRepository] for details.
|
||||||
@@ -106,10 +108,20 @@ constructor(
|
|||||||
context.getString(R.string.status_bar_network_name_separator)
|
context.getString(R.string.status_bar_network_name_separator)
|
||||||
|
|
||||||
private val carrierMergedSubId: StateFlow<Int?> =
|
private val carrierMergedSubId: StateFlow<Int?> =
|
||||||
wifiRepository.wifiNetwork
|
combine(
|
||||||
.mapLatest {
|
wifiRepository.wifiNetwork,
|
||||||
if (it is WifiNetworkModel.CarrierMerged) {
|
connectivityRepository.defaultConnections,
|
||||||
it.subscriptionId
|
airplaneModeRepository.isAirplaneMode,
|
||||||
|
) { wifiNetwork, defaultConnections, isAirplaneMode ->
|
||||||
|
// The carrier merged connection should only be used if it's also the default
|
||||||
|
// connection or mobile connections aren't available because of airplane mode.
|
||||||
|
val defaultConnectionIsNonMobile =
|
||||||
|
defaultConnections.carrierMerged.isDefault ||
|
||||||
|
defaultConnections.wifi.isDefault ||
|
||||||
|
isAirplaneMode
|
||||||
|
|
||||||
|
if (wifiNetwork is WifiNetworkModel.CarrierMerged && defaultConnectionIsNonMobile) {
|
||||||
|
wifiNetwork.subscriptionId
|
||||||
} else {
|
} else {
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
@@ -269,12 +281,8 @@ constructor(
|
|||||||
.stateIn(scope, SharingStarted.WhileSubscribed(), false)
|
.stateIn(scope, SharingStarted.WhileSubscribed(), false)
|
||||||
|
|
||||||
override val hasCarrierMergedConnection: StateFlow<Boolean> =
|
override val hasCarrierMergedConnection: StateFlow<Boolean> =
|
||||||
combine(
|
carrierMergedSubId
|
||||||
connectivityRepository.defaultConnections,
|
.map { it != null }
|
||||||
carrierMergedSubId,
|
|
||||||
) { defaultConnections, carrierMergedSubId ->
|
|
||||||
defaultConnections.carrierMerged.isDefault || carrierMergedSubId != null
|
|
||||||
}
|
|
||||||
.distinctUntilChanged()
|
.distinctUntilChanged()
|
||||||
.logDiffsForTable(
|
.logDiffsForTable(
|
||||||
tableLogger,
|
tableLogger,
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import com.android.systemui.demomode.DemoModeController
|
|||||||
import com.android.systemui.dump.DumpManager
|
import com.android.systemui.dump.DumpManager
|
||||||
import com.android.systemui.log.table.TableLogBuffer
|
import com.android.systemui.log.table.TableLogBuffer
|
||||||
import com.android.systemui.log.table.TableLogBufferFactory
|
import com.android.systemui.log.table.TableLogBufferFactory
|
||||||
|
import com.android.systemui.statusbar.pipeline.airplane.data.repository.FakeAirplaneModeRepository
|
||||||
import com.android.systemui.statusbar.pipeline.mobile.data.MobileInputLogger
|
import com.android.systemui.statusbar.pipeline.mobile.data.MobileInputLogger
|
||||||
import com.android.systemui.statusbar.pipeline.mobile.data.model.SubscriptionModel
|
import com.android.systemui.statusbar.pipeline.mobile.data.model.SubscriptionModel
|
||||||
import com.android.systemui.statusbar.pipeline.mobile.data.repository.demo.DemoMobileConnectionsRepository
|
import com.android.systemui.statusbar.pipeline.mobile.data.repository.demo.DemoMobileConnectionsRepository
|
||||||
@@ -131,6 +132,7 @@ class MobileRepositorySwitcherTest : SysuiTestCase() {
|
|||||||
context,
|
context,
|
||||||
IMMEDIATE,
|
IMMEDIATE,
|
||||||
scope,
|
scope,
|
||||||
|
FakeAirplaneModeRepository(),
|
||||||
wifiRepository,
|
wifiRepository,
|
||||||
mock(),
|
mock(),
|
||||||
)
|
)
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user