Loading packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconInteractor.kt +10 −6 Original line number Diff line number Diff line Loading @@ -325,7 +325,7 @@ class MobileIconInteractorImpl( } .stateIn(scope, SharingStarted.WhileSubscribed(), true) private val shownLevel: StateFlow<Int> = private val cellularShownLevel: StateFlow<Int> = combine( level, isInService, Loading @@ -337,15 +337,19 @@ class MobileIconInteractorImpl( } .stateIn(scope, SharingStarted.WhileSubscribed(), 0) // Satellite level is unaffected by the isInService or inflateSignalStrength properties // See b/346904529 for details private val satelliteShownLevel: StateFlow<Int> = level private val cellularIcon: Flow<SignalIconModel.Cellular> = combine( shownLevel, cellularShownLevel, numberOfLevels, showExclamationMark, carrierNetworkChangeActive, ) { shownLevel, numberOfLevels, showExclamationMark, carrierNetworkChange -> ) { cellularShownLevel, numberOfLevels, showExclamationMark, carrierNetworkChange -> SignalIconModel.Cellular( shownLevel, cellularShownLevel, numberOfLevels, showExclamationMark, carrierNetworkChange, Loading @@ -353,7 +357,7 @@ class MobileIconInteractorImpl( } private val satelliteIcon: Flow<SignalIconModel.Satellite> = shownLevel.map { satelliteShownLevel.map { SignalIconModel.Satellite( level = it, icon = Loading @@ -365,7 +369,7 @@ class MobileIconInteractorImpl( override val signalLevelIcon: StateFlow<SignalIconModel> = run { val initial = SignalIconModel.Cellular( shownLevel.value, cellularShownLevel.value, numberOfLevels.value, showExclamationMark.value, carrierNetworkChangeActive.value, Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconInteractorTest.kt +22 −0 Original line number Diff line number Diff line Loading @@ -738,6 +738,28 @@ class MobileIconInteractorTest : SysuiTestCase() { assertThat(latest).isInstanceOf(SignalIconModel.Satellite::class.java) } @EnableFlags(com.android.internal.telephony.flags.Flags.FLAG_CARRIER_ENABLED_SATELLITE_FLAG) @Test // See b/346904529 for more context fun satBasedIcon_doesNotInflateSignalStrength() = testScope.runTest { val latest by collectLastValue(underTest.signalLevelIcon) // GIVEN a satellite connection connectionRepository.isNonTerrestrial.value = true // GIVEN this carrier has set INFLATE_SIGNAL_STRENGTH connectionRepository.inflateSignalStrength.value = true connectionRepository.primaryLevel.value = 4 assertThat(latest!!.level).isEqualTo(4) connectionRepository.inflateSignalStrength.value = true connectionRepository.primaryLevel.value = 4 // Icon level is unaffected assertThat(latest!!.level).isEqualTo(4) } private fun createInteractor( overrides: MobileIconCarrierIdOverrides = MobileIconCarrierIdOverridesImpl() ) = Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/ui/viewmodel/MobileIconViewModelTest.kt +32 −0 Original line number Diff line number Diff line Loading @@ -862,6 +862,38 @@ class MobileIconViewModelTest : SysuiTestCase() { assertThat(latest!!.icon.res).isEqualTo(R.drawable.ic_satellite_connected_2) } @EnableFlags(com.android.internal.telephony.flags.Flags.FLAG_CARRIER_ENABLED_SATELLITE_FLAG) @Test fun satelliteIcon_ignoresInflateSignalStrength() = testScope.runTest { // Note that this is the exact same test as above, but with inflateSignalStrength set to // true we note that the level is unaffected by inflation repository.inflateSignalStrength.value = true repository.isNonTerrestrial.value = true repository.setAllLevels(0) val latest by collectLastValue(underTest.icon.filterIsInstance(SignalIconModel.Satellite::class)) // Level 0 -> no connection assertThat(latest).isNotNull() assertThat(latest!!.icon.res).isEqualTo(R.drawable.ic_satellite_connected_0) // 1-2 -> 1 bar repository.setAllLevels(1) assertThat(latest!!.icon.res).isEqualTo(R.drawable.ic_satellite_connected_1) repository.setAllLevels(2) assertThat(latest!!.icon.res).isEqualTo(R.drawable.ic_satellite_connected_1) // 3-4 -> 2 bars repository.setAllLevels(3) assertThat(latest!!.icon.res).isEqualTo(R.drawable.ic_satellite_connected_2) repository.setAllLevels(4) assertThat(latest!!.icon.res).isEqualTo(R.drawable.ic_satellite_connected_2) } private fun createAndSetViewModel() { underTest = MobileIconViewModel( Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconInteractor.kt +10 −6 Original line number Diff line number Diff line Loading @@ -325,7 +325,7 @@ class MobileIconInteractorImpl( } .stateIn(scope, SharingStarted.WhileSubscribed(), true) private val shownLevel: StateFlow<Int> = private val cellularShownLevel: StateFlow<Int> = combine( level, isInService, Loading @@ -337,15 +337,19 @@ class MobileIconInteractorImpl( } .stateIn(scope, SharingStarted.WhileSubscribed(), 0) // Satellite level is unaffected by the isInService or inflateSignalStrength properties // See b/346904529 for details private val satelliteShownLevel: StateFlow<Int> = level private val cellularIcon: Flow<SignalIconModel.Cellular> = combine( shownLevel, cellularShownLevel, numberOfLevels, showExclamationMark, carrierNetworkChangeActive, ) { shownLevel, numberOfLevels, showExclamationMark, carrierNetworkChange -> ) { cellularShownLevel, numberOfLevels, showExclamationMark, carrierNetworkChange -> SignalIconModel.Cellular( shownLevel, cellularShownLevel, numberOfLevels, showExclamationMark, carrierNetworkChange, Loading @@ -353,7 +357,7 @@ class MobileIconInteractorImpl( } private val satelliteIcon: Flow<SignalIconModel.Satellite> = shownLevel.map { satelliteShownLevel.map { SignalIconModel.Satellite( level = it, icon = Loading @@ -365,7 +369,7 @@ class MobileIconInteractorImpl( override val signalLevelIcon: StateFlow<SignalIconModel> = run { val initial = SignalIconModel.Cellular( shownLevel.value, cellularShownLevel.value, numberOfLevels.value, showExclamationMark.value, carrierNetworkChangeActive.value, Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconInteractorTest.kt +22 −0 Original line number Diff line number Diff line Loading @@ -738,6 +738,28 @@ class MobileIconInteractorTest : SysuiTestCase() { assertThat(latest).isInstanceOf(SignalIconModel.Satellite::class.java) } @EnableFlags(com.android.internal.telephony.flags.Flags.FLAG_CARRIER_ENABLED_SATELLITE_FLAG) @Test // See b/346904529 for more context fun satBasedIcon_doesNotInflateSignalStrength() = testScope.runTest { val latest by collectLastValue(underTest.signalLevelIcon) // GIVEN a satellite connection connectionRepository.isNonTerrestrial.value = true // GIVEN this carrier has set INFLATE_SIGNAL_STRENGTH connectionRepository.inflateSignalStrength.value = true connectionRepository.primaryLevel.value = 4 assertThat(latest!!.level).isEqualTo(4) connectionRepository.inflateSignalStrength.value = true connectionRepository.primaryLevel.value = 4 // Icon level is unaffected assertThat(latest!!.level).isEqualTo(4) } private fun createInteractor( overrides: MobileIconCarrierIdOverrides = MobileIconCarrierIdOverridesImpl() ) = Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/ui/viewmodel/MobileIconViewModelTest.kt +32 −0 Original line number Diff line number Diff line Loading @@ -862,6 +862,38 @@ class MobileIconViewModelTest : SysuiTestCase() { assertThat(latest!!.icon.res).isEqualTo(R.drawable.ic_satellite_connected_2) } @EnableFlags(com.android.internal.telephony.flags.Flags.FLAG_CARRIER_ENABLED_SATELLITE_FLAG) @Test fun satelliteIcon_ignoresInflateSignalStrength() = testScope.runTest { // Note that this is the exact same test as above, but with inflateSignalStrength set to // true we note that the level is unaffected by inflation repository.inflateSignalStrength.value = true repository.isNonTerrestrial.value = true repository.setAllLevels(0) val latest by collectLastValue(underTest.icon.filterIsInstance(SignalIconModel.Satellite::class)) // Level 0 -> no connection assertThat(latest).isNotNull() assertThat(latest!!.icon.res).isEqualTo(R.drawable.ic_satellite_connected_0) // 1-2 -> 1 bar repository.setAllLevels(1) assertThat(latest!!.icon.res).isEqualTo(R.drawable.ic_satellite_connected_1) repository.setAllLevels(2) assertThat(latest!!.icon.res).isEqualTo(R.drawable.ic_satellite_connected_1) // 3-4 -> 2 bars repository.setAllLevels(3) assertThat(latest!!.icon.res).isEqualTo(R.drawable.ic_satellite_connected_2) repository.setAllLevels(4) assertThat(latest!!.icon.res).isEqualTo(R.drawable.ic_satellite_connected_2) } private fun createAndSetViewModel() { underTest = MobileIconViewModel( Loading