diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/model/MobileSubscriptionModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/model/MobileConnectionModel.kt similarity index 98% rename from packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/model/MobileSubscriptionModel.kt rename to packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/model/MobileConnectionModel.kt index 797a7285f877d..1d00c330c420f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/model/MobileSubscriptionModel.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/model/MobileConnectionModel.kt @@ -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, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/MobileConnectionRepository.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/MobileConnectionRepository.kt index 90e531ce49dac..2621f997d4865 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/MobileConnectionRepository.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/MobileConnectionRepository.kt @@ -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 + val connectionInfo: Flow /** Observable tracking [TelephonyManager.isDataConnectionAllowed] */ val dataEnabled: StateFlow /** diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/demo/DemoMobileConnectionsRepository.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/demo/DemoMobileConnectionsRepository.kt index 45b2c36021212..f1f42b8e33484 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/demo/DemoMobileConnectionsRepository.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/demo/DemoMobileConnectionsRepository.kt @@ -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) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionRepositoryImpl.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionRepositoryImpl.kt index f6be228e0ea66..15505fd3d9e52 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionRepositoryImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionRepositoryImpl.kt @@ -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(extraBufferCapacity = 1) - override val subscriptionModelFlow: StateFlow = run { - var state = MobileSubscriptionModel() + override val connectionInfo: StateFlow = run { + var state = MobileConnectionModel() conflatedCallbackFlow { // TODO (b/240569788): log all of these into the connectivity logger val callback = diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconInteractor.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconInteractor.kt index 96c5597762578..8e1197ca7c5c5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconInteractor.kt @@ -69,7 +69,7 @@ class MobileIconInteractorImpl( override val isDefaultConnectionFailed: StateFlow, connectionRepository: MobileConnectionRepository, ) : MobileIconInteractor { - private val mobileStatusInfo = connectionRepository.subscriptionModelFlow + private val connectionInfo = connectionRepository.connectionInfo override val isDataEnabled: StateFlow = connectionRepository.dataEnabled @@ -78,7 +78,7 @@ class MobileIconInteractorImpl( /** Observable for the current RAT indicator icon ([MobileIconGroup]) */ override val networkTypeIconGroup: StateFlow = combine( - mobileStatusInfo, + connectionInfo, defaultMobileIconMapping, defaultMobileIconGroup, ) { info, mapping, defaultGroup -> @@ -87,18 +87,18 @@ class MobileIconInteractorImpl( .stateIn(scope, SharingStarted.WhileSubscribed(), defaultMobileIconGroup.value) override val isEmergencyOnly: StateFlow = - mobileStatusInfo + connectionInfo .mapLatest { it.isEmergencyOnly } .stateIn(scope, SharingStarted.WhileSubscribed(), false) override val level: StateFlow = - 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 = MutableStateFlow(4) override val isDataConnected: StateFlow = - mobileStatusInfo - .mapLatest { subscriptionModel -> subscriptionModel.dataConnectionState == Connected } + connectionInfo + .mapLatest { connection -> connection.dataConnectionState == Connected } .stateIn(scope, SharingStarted.WhileSubscribed(), false) } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/FakeMobileConnectionRepository.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/FakeMobileConnectionRepository.kt index fcd0f2b126ae1..5265ec66bc246 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/FakeMobileConnectionRepository.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/FakeMobileConnectionRepository.kt @@ -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) { diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/demo/DemoMobileConnectionParameterizedTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/demo/DemoMobileConnectionParameterizedTest.kt index bf5ecd895c409..e943de25c15fd 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/demo/DemoMobileConnectionParameterizedTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/demo/DemoMobileConnectionParameterizedTest.kt @@ -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 diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/demo/DemoMobileConnectionsRepositoryTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/demo/DemoMobileConnectionsRepositoryTest.kt index a8f6993373d25..0eb28c1adf8ac 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/demo/DemoMobileConnectionsRepositoryTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/demo/DemoMobileConnectionsRepositoryTest.kt @@ -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 -> {} diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionRepositoryTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionRepositoryTest.kt index 099cb660f6595..1fc9c60cd9ced 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionRepositoryTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionRepositoryTest.kt @@ -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() 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() 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() @@ -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() @@ -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() @@ -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() @@ -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() @@ -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() 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() 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() 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() val type = OVERRIDE_NETWORK_TYPE_LTE_CA diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconInteractorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconInteractorTest.kt index b20f8fb4c5022..fd41b5bebd390 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconInteractorTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconInteractorTest.kt @@ -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()