Loading packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionsRepositoryImpl.kt +1 −0 Original line number Diff line number Diff line Loading @@ -233,6 +233,7 @@ constructor( override val defaultDataSubRatConfig: StateFlow<Config> = merge(defaultDataSubIdChangeEvent, carrierConfigChangedEvent) .onStart { emit(Unit) } .mapLatest { Config.readConfig(context) } .distinctUntilChanged() .onEach { logger.logDefaultDataSubRatConfig(it) } Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionsRepositoryTest.kt +27 −0 Original line number Diff line number Diff line Loading @@ -1111,6 +1111,33 @@ class MobileConnectionsRepositoryTest : SysuiTestCase() { assertThat(latest!!.showAtLeast3G).isTrue() } @Test fun carrierConfig_initialValueIsFetched() = testScope.runTest { // Value starts out false assertThat(underTest.defaultDataSubRatConfig.value.showAtLeast3G).isFalse() overrideResource(R.bool.config_showMin3G, true) val configFromContext = MobileMappings.Config.readConfig(context) assertThat(configFromContext.showAtLeast3G).isTrue() // WHEN the change event is fired fakeBroadcastDispatcher.registeredReceivers.forEach { receiver -> receiver.onReceive( context, Intent(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED) ) } // WHEN collection starts AFTER the broadcast is sent out val latest by collectLastValue(underTest.defaultDataSubRatConfig) // THEN the config has the updated value assertThat(latest!!.areEqual(configFromContext)).isTrue() assertThat(latest!!.showAtLeast3G).isTrue() } @Test fun activeDataChange_inSameGroup_emitsUnit() = testScope.runTest { Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionsRepositoryImpl.kt +1 −0 Original line number Diff line number Diff line Loading @@ -233,6 +233,7 @@ constructor( override val defaultDataSubRatConfig: StateFlow<Config> = merge(defaultDataSubIdChangeEvent, carrierConfigChangedEvent) .onStart { emit(Unit) } .mapLatest { Config.readConfig(context) } .distinctUntilChanged() .onEach { logger.logDefaultDataSubRatConfig(it) } Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionsRepositoryTest.kt +27 −0 Original line number Diff line number Diff line Loading @@ -1111,6 +1111,33 @@ class MobileConnectionsRepositoryTest : SysuiTestCase() { assertThat(latest!!.showAtLeast3G).isTrue() } @Test fun carrierConfig_initialValueIsFetched() = testScope.runTest { // Value starts out false assertThat(underTest.defaultDataSubRatConfig.value.showAtLeast3G).isFalse() overrideResource(R.bool.config_showMin3G, true) val configFromContext = MobileMappings.Config.readConfig(context) assertThat(configFromContext.showAtLeast3G).isTrue() // WHEN the change event is fired fakeBroadcastDispatcher.registeredReceivers.forEach { receiver -> receiver.onReceive( context, Intent(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED) ) } // WHEN collection starts AFTER the broadcast is sent out val latest by collectLastValue(underTest.defaultDataSubRatConfig) // THEN the config has the updated value assertThat(latest!!.areEqual(configFromContext)).isTrue() assertThat(latest!!.showAtLeast3G).isTrue() } @Test fun activeDataChange_inSameGroup_emitsUnit() = testScope.runTest { Loading