Rename MobileSubscriptionModel to MobileConnectionModel

Also rename `subscriptionModelFlow` to `connectionInfo`, which is more
clear given that `MobileConnectionRepository` is the provider of that
information.

This paves the way to remove `SubscriptionInfo` from our internal
representation in lieu of a `SubscriptionModel` based off of it

Test: tests in tests/src/com/android/systemui/statusbar/pipeline/mobile/*
Bug: 261029387
Change-Id: If4bd3e31d2f8a7400e31e4acd8776750eee22ad6
This commit is contained in:
Evan Laird
2022-12-03 00:57:31 -05:00
parent f58969d7c1
commit 9014672cd8
10 changed files with 97 additions and 97 deletions

View File

@@ -38,7 +38,7 @@ import com.android.systemui.statusbar.pipeline.mobile.data.model.DataConnectionS
* any new field that needs to be tracked should be copied into this data class rather than
* threading complex system objects through the pipeline.
*/
data class MobileSubscriptionModel(
data class MobileConnectionModel(
/** From [ServiceStateListener.onServiceStateChanged] */
val isEmergencyOnly: Boolean = false,

View File

@@ -20,7 +20,7 @@ import android.telephony.SubscriptionInfo
import android.telephony.SubscriptionManager
import android.telephony.TelephonyCallback
import android.telephony.TelephonyManager
import com.android.systemui.statusbar.pipeline.mobile.data.model.MobileSubscriptionModel
import com.android.systemui.statusbar.pipeline.mobile.data.model.MobileConnectionModel
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.StateFlow
@@ -42,7 +42,7 @@ interface MobileConnectionRepository {
* A flow that aggregates all necessary callbacks from [TelephonyCallback] into a single
* listener + model.
*/
val subscriptionModelFlow: Flow<MobileSubscriptionModel>
val connectionInfo: Flow<MobileConnectionModel>
/** Observable tracking [TelephonyManager.isDataConnectionAllowed] */
val dataEnabled: StateFlow<Boolean>
/**

View File

@@ -25,8 +25,8 @@ import com.android.settingslib.mobile.MobileMappings
import com.android.settingslib.mobile.TelephonyIcons
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.statusbar.pipeline.mobile.data.model.DataConnectionState
import com.android.systemui.statusbar.pipeline.mobile.data.model.MobileConnectionModel
import com.android.systemui.statusbar.pipeline.mobile.data.model.MobileConnectivityModel
import com.android.systemui.statusbar.pipeline.mobile.data.model.MobileSubscriptionModel
import com.android.systemui.statusbar.pipeline.mobile.data.model.ResolvedNetworkType
import com.android.systemui.statusbar.pipeline.mobile.data.model.ResolvedNetworkType.DefaultNetworkType
import com.android.systemui.statusbar.pipeline.mobile.data.repository.MobileConnectionRepository
@@ -206,7 +206,7 @@ constructor(
connection.dataEnabled.value = true
connection.isDefaultDataSubscription.value = state.dataType != null
connection.subscriptionModelFlow.value = state.toMobileSubscriptionModel()
connection.connectionInfo.value = state.toMobileConnectionModel()
}
private fun processDisabledMobileState(state: MobileDisabled) {
@@ -246,8 +246,8 @@ constructor(
private fun subIdsString(): String =
_subscriptions.value.joinToString(",") { it.subscriptionId.toString() }
private fun Mobile.toMobileSubscriptionModel(): MobileSubscriptionModel {
return MobileSubscriptionModel(
private fun Mobile.toMobileConnectionModel(): MobileConnectionModel {
return MobileConnectionModel(
isEmergencyOnly = false, // TODO(b/261029387): not yet supported
isGsm = false, // TODO(b/261029387): not yet supported
cdmaLevel = level ?: 0,
@@ -275,7 +275,7 @@ constructor(
}
class DemoMobileConnectionRepository(override val subId: Int) : MobileConnectionRepository {
override val subscriptionModelFlow = MutableStateFlow(MobileSubscriptionModel())
override val connectionInfo = MutableStateFlow(MobileConnectionModel())
override val dataEnabled = MutableStateFlow(true)

View File

@@ -31,7 +31,7 @@ import android.telephony.TelephonyManager.NETWORK_TYPE_UNKNOWN
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.MobileSubscriptionModel
import com.android.systemui.statusbar.pipeline.mobile.data.model.MobileConnectionModel
import com.android.systemui.statusbar.pipeline.mobile.data.model.ResolvedNetworkType.DefaultNetworkType
import com.android.systemui.statusbar.pipeline.mobile.data.model.ResolvedNetworkType.OverrideNetworkType
import com.android.systemui.statusbar.pipeline.mobile.data.model.ResolvedNetworkType.UnknownNetworkType
@@ -81,8 +81,8 @@ class MobileConnectionRepositoryImpl(
private val telephonyCallbackEvent = MutableSharedFlow<Unit>(extraBufferCapacity = 1)
override val subscriptionModelFlow: StateFlow<MobileSubscriptionModel> = run {
var state = MobileSubscriptionModel()
override val connectionInfo: StateFlow<MobileConnectionModel> = run {
var state = MobileConnectionModel()
conflatedCallbackFlow {
// TODO (b/240569788): log all of these into the connectivity logger
val callback =

View File

@@ -69,7 +69,7 @@ class MobileIconInteractorImpl(
override val isDefaultConnectionFailed: StateFlow<Boolean>,
connectionRepository: MobileConnectionRepository,
) : MobileIconInteractor {
private val mobileStatusInfo = connectionRepository.subscriptionModelFlow
private val connectionInfo = connectionRepository.connectionInfo
override val isDataEnabled: StateFlow<Boolean> = connectionRepository.dataEnabled
@@ -78,7 +78,7 @@ class MobileIconInteractorImpl(
/** Observable for the current RAT indicator icon ([MobileIconGroup]) */
override val networkTypeIconGroup: StateFlow<MobileIconGroup> =
combine(
mobileStatusInfo,
connectionInfo,
defaultMobileIconMapping,
defaultMobileIconGroup,
) { info, mapping, defaultGroup ->
@@ -87,18 +87,18 @@ class MobileIconInteractorImpl(
.stateIn(scope, SharingStarted.WhileSubscribed(), defaultMobileIconGroup.value)
override val isEmergencyOnly: StateFlow<Boolean> =
mobileStatusInfo
connectionInfo
.mapLatest { it.isEmergencyOnly }
.stateIn(scope, SharingStarted.WhileSubscribed(), false)
override val level: StateFlow<Int> =
mobileStatusInfo
.mapLatest { mobileModel ->
connectionInfo
.mapLatest { connection ->
// TODO: incorporate [MobileMappings.Config.alwaysShowCdmaRssi]
if (mobileModel.isGsm) {
mobileModel.primaryLevel
if (connection.isGsm) {
connection.primaryLevel
} else {
mobileModel.cdmaLevel
connection.cdmaLevel
}
}
.stateIn(scope, SharingStarted.WhileSubscribed(), 0)
@@ -110,7 +110,7 @@ class MobileIconInteractorImpl(
override val numberOfLevels: StateFlow<Int> = MutableStateFlow(4)
override val isDataConnected: StateFlow<Boolean> =
mobileStatusInfo
.mapLatest { subscriptionModel -> subscriptionModel.dataConnectionState == Connected }
connectionInfo
.mapLatest { connection -> connection.dataConnectionState == Connected }
.stateIn(scope, SharingStarted.WhileSubscribed(), false)
}

View File

@@ -16,13 +16,13 @@
package com.android.systemui.statusbar.pipeline.mobile.data.repository
import com.android.systemui.statusbar.pipeline.mobile.data.model.MobileSubscriptionModel
import com.android.systemui.statusbar.pipeline.mobile.data.model.MobileConnectionModel
import kotlinx.coroutines.flow.MutableStateFlow
// TODO(b/261632894): remove this in favor of the real impl or DemoMobileConnectionRepository
class FakeMobileConnectionRepository(override val subId: Int) : MobileConnectionRepository {
private val _subscriptionsModelFlow = MutableStateFlow(MobileSubscriptionModel())
override val subscriptionModelFlow = _subscriptionsModelFlow
private val _connectionInfo = MutableStateFlow(MobileConnectionModel())
override val connectionInfo = _connectionInfo
private val _dataEnabled = MutableStateFlow(true)
override val dataEnabled = _dataEnabled
@@ -30,8 +30,8 @@ class FakeMobileConnectionRepository(override val subId: Int) : MobileConnection
private val _isDefaultDataSubscription = MutableStateFlow(true)
override val isDefaultDataSubscription = _isDefaultDataSubscription
fun setMobileSubscriptionModel(model: MobileSubscriptionModel) {
_subscriptionsModelFlow.value = model
fun setConnectionInfo(model: MobileConnectionModel) {
_connectionInfo.value = model
}
fun setDataEnabled(enabled: Boolean) {

View File

@@ -23,7 +23,7 @@ import com.android.settingslib.SignalIcon
import com.android.settingslib.mobile.TelephonyIcons
import com.android.systemui.SysuiTestCase
import com.android.systemui.statusbar.pipeline.mobile.data.model.DataConnectionState
import com.android.systemui.statusbar.pipeline.mobile.data.model.MobileSubscriptionModel
import com.android.systemui.statusbar.pipeline.mobile.data.model.MobileConnectionModel
import com.android.systemui.statusbar.pipeline.mobile.data.repository.demo.model.FakeNetworkEventModel
import com.android.systemui.util.mockito.mock
import com.android.systemui.util.mockito.whenever
@@ -109,18 +109,18 @@ internal class DemoMobileConnectionParameterizedTest(private val testCase: TestC
) {
when (model) {
is FakeNetworkEventModel.Mobile -> {
val subscriptionModel: MobileSubscriptionModel = conn.subscriptionModelFlow.value
val connectionInfo: MobileConnectionModel = conn.connectionInfo.value
assertThat(conn.subId).isEqualTo(model.subId)
assertThat(subscriptionModel.cdmaLevel).isEqualTo(model.level)
assertThat(subscriptionModel.primaryLevel).isEqualTo(model.level)
assertThat(subscriptionModel.dataActivityDirection).isEqualTo(model.activity)
assertThat(subscriptionModel.carrierNetworkChangeActive)
assertThat(connectionInfo.cdmaLevel).isEqualTo(model.level)
assertThat(connectionInfo.primaryLevel).isEqualTo(model.level)
assertThat(connectionInfo.dataActivityDirection).isEqualTo(model.activity)
assertThat(connectionInfo.carrierNetworkChangeActive)
.isEqualTo(model.carrierNetworkChange)
// TODO(b/261029387): check these once we start handling them
assertThat(subscriptionModel.isEmergencyOnly).isFalse()
assertThat(subscriptionModel.isGsm).isFalse()
assertThat(subscriptionModel.dataConnectionState)
assertThat(connectionInfo.isEmergencyOnly).isFalse()
assertThat(connectionInfo.isGsm).isFalse()
assertThat(connectionInfo.dataConnectionState)
.isEqualTo(DataConnectionState.Connected)
}
// MobileDisabled isn't combinatorial in nature, and is tested in

View File

@@ -24,7 +24,7 @@ import com.android.settingslib.SignalIcon
import com.android.settingslib.mobile.TelephonyIcons.THREE_G
import com.android.systemui.SysuiTestCase
import com.android.systemui.statusbar.pipeline.mobile.data.model.DataConnectionState
import com.android.systemui.statusbar.pipeline.mobile.data.model.MobileSubscriptionModel
import com.android.systemui.statusbar.pipeline.mobile.data.model.MobileConnectionModel
import com.android.systemui.statusbar.pipeline.mobile.data.repository.demo.model.FakeNetworkEventModel
import com.android.systemui.statusbar.pipeline.mobile.data.repository.demo.model.FakeNetworkEventModel.MobileDisabled
import com.android.systemui.util.mockito.mock
@@ -266,18 +266,18 @@ class DemoMobileConnectionsRepositoryTest : SysuiTestCase() {
) {
when (model) {
is FakeNetworkEventModel.Mobile -> {
val subscriptionModel: MobileSubscriptionModel = conn.subscriptionModelFlow.value
val connectionInfo: MobileConnectionModel = conn.connectionInfo.value
assertThat(conn.subId).isEqualTo(model.subId)
assertThat(subscriptionModel.cdmaLevel).isEqualTo(model.level)
assertThat(subscriptionModel.primaryLevel).isEqualTo(model.level)
assertThat(subscriptionModel.dataActivityDirection).isEqualTo(model.activity)
assertThat(subscriptionModel.carrierNetworkChangeActive)
assertThat(connectionInfo.cdmaLevel).isEqualTo(model.level)
assertThat(connectionInfo.primaryLevel).isEqualTo(model.level)
assertThat(connectionInfo.dataActivityDirection).isEqualTo(model.activity)
assertThat(connectionInfo.carrierNetworkChangeActive)
.isEqualTo(model.carrierNetworkChange)
// TODO(b/261029387) check these once we start handling them
assertThat(subscriptionModel.isEmergencyOnly).isFalse()
assertThat(subscriptionModel.isGsm).isFalse()
assertThat(subscriptionModel.dataConnectionState)
assertThat(connectionInfo.isEmergencyOnly).isFalse()
assertThat(connectionInfo.isGsm).isFalse()
assertThat(connectionInfo.dataConnectionState)
.isEqualTo(DataConnectionState.Connected)
}
else -> {}

View File

@@ -37,7 +37,7 @@ import android.telephony.TelephonyManager.NETWORK_TYPE_UNKNOWN
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
import com.android.systemui.statusbar.pipeline.mobile.data.model.DataConnectionState
import com.android.systemui.statusbar.pipeline.mobile.data.model.MobileSubscriptionModel
import com.android.systemui.statusbar.pipeline.mobile.data.model.MobileConnectionModel
import com.android.systemui.statusbar.pipeline.mobile.data.model.ResolvedNetworkType.DefaultNetworkType
import com.android.systemui.statusbar.pipeline.mobile.data.model.ResolvedNetworkType.OverrideNetworkType
import com.android.systemui.statusbar.pipeline.mobile.data.model.ResolvedNetworkType.UnknownNetworkType
@@ -107,10 +107,10 @@ class MobileConnectionRepositoryTest : SysuiTestCase() {
@Test
fun testFlowForSubId_default() =
runBlocking(IMMEDIATE) {
var latest: MobileSubscriptionModel? = null
val job = underTest.subscriptionModelFlow.onEach { latest = it }.launchIn(this)
var latest: MobileConnectionModel? = null
val job = underTest.connectionInfo.onEach { latest = it }.launchIn(this)
assertThat(latest).isEqualTo(MobileSubscriptionModel())
assertThat(latest).isEqualTo(MobileConnectionModel())
job.cancel()
}
@@ -118,8 +118,8 @@ class MobileConnectionRepositoryTest : SysuiTestCase() {
@Test
fun testFlowForSubId_emergencyOnly() =
runBlocking(IMMEDIATE) {
var latest: MobileSubscriptionModel? = null
val job = underTest.subscriptionModelFlow.onEach { latest = it }.launchIn(this)
var latest: MobileConnectionModel? = null
val job = underTest.connectionInfo.onEach { latest = it }.launchIn(this)
val serviceState = ServiceState()
serviceState.isEmergencyOnly = true
@@ -134,8 +134,8 @@ class MobileConnectionRepositoryTest : SysuiTestCase() {
@Test
fun testFlowForSubId_emergencyOnly_toggles() =
runBlocking(IMMEDIATE) {
var latest: MobileSubscriptionModel? = null
val job = underTest.subscriptionModelFlow.onEach { latest = it }.launchIn(this)
var latest: MobileConnectionModel? = null
val job = underTest.connectionInfo.onEach { latest = it }.launchIn(this)
val callback = getTelephonyCallbackForType<ServiceStateListener>()
val serviceState = ServiceState()
@@ -152,8 +152,8 @@ class MobileConnectionRepositoryTest : SysuiTestCase() {
@Test
fun testFlowForSubId_signalStrengths_levelsUpdate() =
runBlocking(IMMEDIATE) {
var latest: MobileSubscriptionModel? = null
val job = underTest.subscriptionModelFlow.onEach { latest = it }.launchIn(this)
var latest: MobileConnectionModel? = null
val job = underTest.connectionInfo.onEach { latest = it }.launchIn(this)
val callback = getTelephonyCallbackForType<TelephonyCallback.SignalStrengthsListener>()
val strength = signalStrength(gsmLevel = 1, cdmaLevel = 2, isGsm = true)
@@ -169,8 +169,8 @@ class MobileConnectionRepositoryTest : SysuiTestCase() {
@Test
fun testFlowForSubId_dataConnectionState_connected() =
runBlocking(IMMEDIATE) {
var latest: MobileSubscriptionModel? = null
val job = underTest.subscriptionModelFlow.onEach { latest = it }.launchIn(this)
var latest: MobileConnectionModel? = null
val job = underTest.connectionInfo.onEach { latest = it }.launchIn(this)
val callback =
getTelephonyCallbackForType<TelephonyCallback.DataConnectionStateListener>()
@@ -184,8 +184,8 @@ class MobileConnectionRepositoryTest : SysuiTestCase() {
@Test
fun testFlowForSubId_dataConnectionState_connecting() =
runBlocking(IMMEDIATE) {
var latest: MobileSubscriptionModel? = null
val job = underTest.subscriptionModelFlow.onEach { latest = it }.launchIn(this)
var latest: MobileConnectionModel? = null
val job = underTest.connectionInfo.onEach { latest = it }.launchIn(this)
val callback =
getTelephonyCallbackForType<TelephonyCallback.DataConnectionStateListener>()
@@ -199,8 +199,8 @@ class MobileConnectionRepositoryTest : SysuiTestCase() {
@Test
fun testFlowForSubId_dataConnectionState_disconnected() =
runBlocking(IMMEDIATE) {
var latest: MobileSubscriptionModel? = null
val job = underTest.subscriptionModelFlow.onEach { latest = it }.launchIn(this)
var latest: MobileConnectionModel? = null
val job = underTest.connectionInfo.onEach { latest = it }.launchIn(this)
val callback =
getTelephonyCallbackForType<TelephonyCallback.DataConnectionStateListener>()
@@ -214,8 +214,8 @@ class MobileConnectionRepositoryTest : SysuiTestCase() {
@Test
fun testFlowForSubId_dataConnectionState_disconnecting() =
runBlocking(IMMEDIATE) {
var latest: MobileSubscriptionModel? = null
val job = underTest.subscriptionModelFlow.onEach { latest = it }.launchIn(this)
var latest: MobileConnectionModel? = null
val job = underTest.connectionInfo.onEach { latest = it }.launchIn(this)
val callback =
getTelephonyCallbackForType<TelephonyCallback.DataConnectionStateListener>()
@@ -229,8 +229,8 @@ class MobileConnectionRepositoryTest : SysuiTestCase() {
@Test
fun testFlowForSubId_dataConnectionState_unknown() =
runBlocking(IMMEDIATE) {
var latest: MobileSubscriptionModel? = null
val job = underTest.subscriptionModelFlow.onEach { latest = it }.launchIn(this)
var latest: MobileConnectionModel? = null
val job = underTest.connectionInfo.onEach { latest = it }.launchIn(this)
val callback =
getTelephonyCallbackForType<TelephonyCallback.DataConnectionStateListener>()
@@ -244,8 +244,8 @@ class MobileConnectionRepositoryTest : SysuiTestCase() {
@Test
fun testFlowForSubId_dataActivity() =
runBlocking(IMMEDIATE) {
var latest: MobileSubscriptionModel? = null
val job = underTest.subscriptionModelFlow.onEach { latest = it }.launchIn(this)
var latest: MobileConnectionModel? = null
val job = underTest.connectionInfo.onEach { latest = it }.launchIn(this)
val callback = getTelephonyCallbackForType<TelephonyCallback.DataActivityListener>()
callback.onDataActivity(3)
@@ -258,8 +258,8 @@ class MobileConnectionRepositoryTest : SysuiTestCase() {
@Test
fun testFlowForSubId_carrierNetworkChange() =
runBlocking(IMMEDIATE) {
var latest: MobileSubscriptionModel? = null
val job = underTest.subscriptionModelFlow.onEach { latest = it }.launchIn(this)
var latest: MobileConnectionModel? = null
val job = underTest.connectionInfo.onEach { latest = it }.launchIn(this)
val callback = getTelephonyCallbackForType<TelephonyCallback.CarrierNetworkListener>()
callback.onCarrierNetworkChange(true)
@@ -272,8 +272,8 @@ class MobileConnectionRepositoryTest : SysuiTestCase() {
@Test
fun subscriptionFlow_networkType_default() =
runBlocking(IMMEDIATE) {
var latest: MobileSubscriptionModel? = null
val job = underTest.subscriptionModelFlow.onEach { latest = it }.launchIn(this)
var latest: MobileConnectionModel? = null
val job = underTest.connectionInfo.onEach { latest = it }.launchIn(this)
val type = NETWORK_TYPE_UNKNOWN
val expected = UnknownNetworkType
@@ -286,8 +286,8 @@ class MobileConnectionRepositoryTest : SysuiTestCase() {
@Test
fun subscriptionFlow_networkType_updatesUsingDefault() =
runBlocking(IMMEDIATE) {
var latest: MobileSubscriptionModel? = null
val job = underTest.subscriptionModelFlow.onEach { latest = it }.launchIn(this)
var latest: MobileConnectionModel? = null
val job = underTest.connectionInfo.onEach { latest = it }.launchIn(this)
val callback = getTelephonyCallbackForType<TelephonyCallback.DisplayInfoListener>()
val type = NETWORK_TYPE_LTE
@@ -303,8 +303,8 @@ class MobileConnectionRepositoryTest : SysuiTestCase() {
@Test
fun subscriptionFlow_networkType_updatesUsingOverride() =
runBlocking(IMMEDIATE) {
var latest: MobileSubscriptionModel? = null
val job = underTest.subscriptionModelFlow.onEach { latest = it }.launchIn(this)
var latest: MobileConnectionModel? = null
val job = underTest.connectionInfo.onEach { latest = it }.launchIn(this)
val callback = getTelephonyCallbackForType<TelephonyCallback.DisplayInfoListener>()
val type = OVERRIDE_NETWORK_TYPE_LTE_CA

View File

@@ -24,7 +24,7 @@ import com.android.settingslib.SignalIcon.MobileIconGroup
import com.android.settingslib.mobile.TelephonyIcons
import com.android.systemui.SysuiTestCase
import com.android.systemui.statusbar.pipeline.mobile.data.model.DataConnectionState
import com.android.systemui.statusbar.pipeline.mobile.data.model.MobileSubscriptionModel
import com.android.systemui.statusbar.pipeline.mobile.data.model.MobileConnectionModel
import com.android.systemui.statusbar.pipeline.mobile.data.model.ResolvedNetworkType.DefaultNetworkType
import com.android.systemui.statusbar.pipeline.mobile.data.model.ResolvedNetworkType.OverrideNetworkType
import com.android.systemui.statusbar.pipeline.mobile.data.repository.FakeMobileConnectionRepository
@@ -69,8 +69,8 @@ class MobileIconInteractorTest : SysuiTestCase() {
@Test
fun gsm_level_default_unknown() =
runBlocking(IMMEDIATE) {
connectionRepository.setMobileSubscriptionModel(
MobileSubscriptionModel(isGsm = true),
connectionRepository.setConnectionInfo(
MobileConnectionModel(isGsm = true),
)
var latest: Int? = null
@@ -84,8 +84,8 @@ class MobileIconInteractorTest : SysuiTestCase() {
@Test
fun gsm_usesGsmLevel() =
runBlocking(IMMEDIATE) {
connectionRepository.setMobileSubscriptionModel(
MobileSubscriptionModel(
connectionRepository.setConnectionInfo(
MobileConnectionModel(
isGsm = true,
primaryLevel = GSM_LEVEL,
cdmaLevel = CDMA_LEVEL
@@ -103,8 +103,8 @@ class MobileIconInteractorTest : SysuiTestCase() {
@Test
fun cdma_level_default_unknown() =
runBlocking(IMMEDIATE) {
connectionRepository.setMobileSubscriptionModel(
MobileSubscriptionModel(isGsm = false),
connectionRepository.setConnectionInfo(
MobileConnectionModel(isGsm = false),
)
var latest: Int? = null
@@ -117,8 +117,8 @@ class MobileIconInteractorTest : SysuiTestCase() {
@Test
fun cdma_usesCdmaLevel() =
runBlocking(IMMEDIATE) {
connectionRepository.setMobileSubscriptionModel(
MobileSubscriptionModel(
connectionRepository.setConnectionInfo(
MobileConnectionModel(
isGsm = false,
primaryLevel = GSM_LEVEL,
cdmaLevel = CDMA_LEVEL
@@ -136,8 +136,8 @@ class MobileIconInteractorTest : SysuiTestCase() {
@Test
fun iconGroup_three_g() =
runBlocking(IMMEDIATE) {
connectionRepository.setMobileSubscriptionModel(
MobileSubscriptionModel(
connectionRepository.setConnectionInfo(
MobileConnectionModel(
resolvedNetworkType =
DefaultNetworkType(THREE_G, mobileMappingsProxy.toIconKey(THREE_G))
),
@@ -154,8 +154,8 @@ class MobileIconInteractorTest : SysuiTestCase() {
@Test
fun iconGroup_updates_on_change() =
runBlocking(IMMEDIATE) {
connectionRepository.setMobileSubscriptionModel(
MobileSubscriptionModel(
connectionRepository.setConnectionInfo(
MobileConnectionModel(
resolvedNetworkType =
DefaultNetworkType(THREE_G, mobileMappingsProxy.toIconKey(THREE_G))
),
@@ -164,8 +164,8 @@ class MobileIconInteractorTest : SysuiTestCase() {
var latest: MobileIconGroup? = null
val job = underTest.networkTypeIconGroup.onEach { latest = it }.launchIn(this)
connectionRepository.setMobileSubscriptionModel(
MobileSubscriptionModel(
connectionRepository.setConnectionInfo(
MobileConnectionModel(
resolvedNetworkType =
DefaultNetworkType(
FOUR_G,
@@ -183,8 +183,8 @@ class MobileIconInteractorTest : SysuiTestCase() {
@Test
fun iconGroup_5g_override_type() =
runBlocking(IMMEDIATE) {
connectionRepository.setMobileSubscriptionModel(
MobileSubscriptionModel(
connectionRepository.setConnectionInfo(
MobileConnectionModel(
resolvedNetworkType =
OverrideNetworkType(
FIVE_G_OVERRIDE,
@@ -204,8 +204,8 @@ class MobileIconInteractorTest : SysuiTestCase() {
@Test
fun iconGroup_default_if_no_lookup() =
runBlocking(IMMEDIATE) {
connectionRepository.setMobileSubscriptionModel(
MobileSubscriptionModel(
connectionRepository.setConnectionInfo(
MobileConnectionModel(
resolvedNetworkType =
DefaultNetworkType(
NETWORK_TYPE_UNKNOWN,
@@ -257,8 +257,8 @@ class MobileIconInteractorTest : SysuiTestCase() {
var latest: Boolean? = null
val job = underTest.isDataConnected.onEach { latest = it }.launchIn(this)
connectionRepository.setMobileSubscriptionModel(
MobileSubscriptionModel(dataConnectionState = DataConnectionState.Connected)
connectionRepository.setConnectionInfo(
MobileConnectionModel(dataConnectionState = DataConnectionState.Connected)
)
yield()
@@ -273,8 +273,8 @@ class MobileIconInteractorTest : SysuiTestCase() {
var latest: Boolean? = null
val job = underTest.isDataConnected.onEach { latest = it }.launchIn(this)
connectionRepository.setMobileSubscriptionModel(
MobileSubscriptionModel(dataConnectionState = DataConnectionState.Disconnected)
connectionRepository.setConnectionInfo(
MobileConnectionModel(dataConnectionState = DataConnectionState.Disconnected)
)
assertThat(latest).isFalse()