Loading packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconInteractor.kt +6 −0 Original line number Diff line number Diff line Loading @@ -110,6 +110,9 @@ interface MobileIconInteractor { /** See [MobileIconsInteractor.isForceHidden]. */ val isForceHidden: Flow<Boolean> /** True when in carrier network change mode */ val carrierNetworkChangeActive: StateFlow<Boolean> } /** Interactor for a single mobile connection. This connection _should_ have one subscription ID */ Loading @@ -135,6 +138,9 @@ class MobileIconInteractorImpl( override val isDataEnabled: StateFlow<Boolean> = connectionRepository.dataEnabled override val carrierNetworkChangeActive: StateFlow<Boolean> = connectionRepository.carrierNetworkChangeActive // True if there exists _any_ icon override for this carrierId. Note that overrides can include // any or none of the icon groups defined in MobileMappings, so we still need to check on a // per-network-type basis whether or not the given icon group is overridden Loading packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/ui/binder/MobileIconBinder.kt +1 −6 Original line number Diff line number Diff line Loading @@ -109,12 +109,7 @@ object MobileIconBinder { viewModel.subscriptionId, icon, ) mobileDrawable.level = SignalDrawable.getState( icon.level, icon.numberOfLevels, icon.showExclamationMark, ) mobileDrawable.level = icon.toSignalDrawableState() } } Loading packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/ui/model/SignalIconModel.kt +15 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.systemui.statusbar.pipeline.mobile.ui.model import com.android.settingslib.graph.SignalDrawable import com.android.systemui.log.table.Diffable import com.android.systemui.log.table.TableRowLogger Loading @@ -24,6 +25,7 @@ data class SignalIconModel( val level: Int, val numberOfLevels: Int, val showExclamationMark: Boolean, val carrierNetworkChange: Boolean, ) : Diffable<SignalIconModel> { // TODO(b/267767715): Can we implement [logDiffs] and [logFull] generically for data classes? override fun logDiffs(prevVal: SignalIconModel, row: TableRowLogger) { Loading @@ -36,17 +38,30 @@ data class SignalIconModel( if (prevVal.showExclamationMark != showExclamationMark) { row.logChange(COL_SHOW_EXCLAMATION, showExclamationMark) } if (prevVal.carrierNetworkChange != carrierNetworkChange) { row.logChange(COL_CARRIER_NETWORK_CHANGE, carrierNetworkChange) } } override fun logFull(row: TableRowLogger) { row.logChange(COL_LEVEL, level) row.logChange(COL_NUM_LEVELS, numberOfLevels) row.logChange(COL_SHOW_EXCLAMATION, showExclamationMark) row.logChange(COL_CARRIER_NETWORK_CHANGE, carrierNetworkChange) } /** Convert this model to an [Int] consumable by [SignalDrawable]. */ fun toSignalDrawableState(): Int = if (carrierNetworkChange) { SignalDrawable.getCarrierChangeState(numberOfLevels) } else { SignalDrawable.getState(level, numberOfLevels, showExclamationMark) } companion object { private const val COL_LEVEL = "level" private const val COL_NUM_LEVELS = "numLevels" private const val COL_SHOW_EXCLAMATION = "showExclamation" private const val COL_CARRIER_NETWORK_CHANGE = "carrierNetworkChange" } } packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/ui/viewmodel/MobileIconViewModel.kt +13 −4 Original line number Diff line number Diff line Loading @@ -122,13 +122,20 @@ constructor( level = shownLevel.value, numberOfLevels = iconInteractor.numberOfLevels.value, showExclamationMark = showExclamationMark.value, carrierNetworkChange = iconInteractor.carrierNetworkChangeActive.value, ) combine( shownLevel, iconInteractor.numberOfLevels, showExclamationMark, ) { shownLevel, numberOfLevels, showExclamationMark -> SignalIconModel(shownLevel, numberOfLevels, showExclamationMark) iconInteractor.carrierNetworkChangeActive, ) { shownLevel, numberOfLevels, showExclamationMark, carrierNetworkChange -> SignalIconModel( shownLevel, numberOfLevels, showExclamationMark, carrierNetworkChange, ) } .distinctUntilChanged() .logDiffsForTable( Loading @@ -152,8 +159,10 @@ constructor( iconInteractor.isDataEnabled, iconInteractor.alwaysShowDataRatIcon, iconInteractor.mobileIsDefault, ) { dataConnected, dataEnabled, alwaysShow, mobileIsDefault -> alwaysShow || (dataEnabled && dataConnected && mobileIsDefault) iconInteractor.carrierNetworkChangeActive, ) { dataConnected, dataEnabled, alwaysShow, mobileIsDefault, carrierNetworkChange -> alwaysShow || (!carrierNetworkChange && (dataEnabled && dataConnected && mobileIsDefault)) } .distinctUntilChanged() .logDiffsForTable( Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/FakeMobileIconInteractor.kt +2 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,8 @@ class FakeMobileIconInteractor( ) ) override val carrierNetworkChangeActive = MutableStateFlow(false) override val mobileIsDefault = MutableStateFlow(true) override val networkTypeIconGroup = Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconInteractor.kt +6 −0 Original line number Diff line number Diff line Loading @@ -110,6 +110,9 @@ interface MobileIconInteractor { /** See [MobileIconsInteractor.isForceHidden]. */ val isForceHidden: Flow<Boolean> /** True when in carrier network change mode */ val carrierNetworkChangeActive: StateFlow<Boolean> } /** Interactor for a single mobile connection. This connection _should_ have one subscription ID */ Loading @@ -135,6 +138,9 @@ class MobileIconInteractorImpl( override val isDataEnabled: StateFlow<Boolean> = connectionRepository.dataEnabled override val carrierNetworkChangeActive: StateFlow<Boolean> = connectionRepository.carrierNetworkChangeActive // True if there exists _any_ icon override for this carrierId. Note that overrides can include // any or none of the icon groups defined in MobileMappings, so we still need to check on a // per-network-type basis whether or not the given icon group is overridden Loading
packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/ui/binder/MobileIconBinder.kt +1 −6 Original line number Diff line number Diff line Loading @@ -109,12 +109,7 @@ object MobileIconBinder { viewModel.subscriptionId, icon, ) mobileDrawable.level = SignalDrawable.getState( icon.level, icon.numberOfLevels, icon.showExclamationMark, ) mobileDrawable.level = icon.toSignalDrawableState() } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/ui/model/SignalIconModel.kt +15 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.systemui.statusbar.pipeline.mobile.ui.model import com.android.settingslib.graph.SignalDrawable import com.android.systemui.log.table.Diffable import com.android.systemui.log.table.TableRowLogger Loading @@ -24,6 +25,7 @@ data class SignalIconModel( val level: Int, val numberOfLevels: Int, val showExclamationMark: Boolean, val carrierNetworkChange: Boolean, ) : Diffable<SignalIconModel> { // TODO(b/267767715): Can we implement [logDiffs] and [logFull] generically for data classes? override fun logDiffs(prevVal: SignalIconModel, row: TableRowLogger) { Loading @@ -36,17 +38,30 @@ data class SignalIconModel( if (prevVal.showExclamationMark != showExclamationMark) { row.logChange(COL_SHOW_EXCLAMATION, showExclamationMark) } if (prevVal.carrierNetworkChange != carrierNetworkChange) { row.logChange(COL_CARRIER_NETWORK_CHANGE, carrierNetworkChange) } } override fun logFull(row: TableRowLogger) { row.logChange(COL_LEVEL, level) row.logChange(COL_NUM_LEVELS, numberOfLevels) row.logChange(COL_SHOW_EXCLAMATION, showExclamationMark) row.logChange(COL_CARRIER_NETWORK_CHANGE, carrierNetworkChange) } /** Convert this model to an [Int] consumable by [SignalDrawable]. */ fun toSignalDrawableState(): Int = if (carrierNetworkChange) { SignalDrawable.getCarrierChangeState(numberOfLevels) } else { SignalDrawable.getState(level, numberOfLevels, showExclamationMark) } companion object { private const val COL_LEVEL = "level" private const val COL_NUM_LEVELS = "numLevels" private const val COL_SHOW_EXCLAMATION = "showExclamation" private const val COL_CARRIER_NETWORK_CHANGE = "carrierNetworkChange" } }
packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/ui/viewmodel/MobileIconViewModel.kt +13 −4 Original line number Diff line number Diff line Loading @@ -122,13 +122,20 @@ constructor( level = shownLevel.value, numberOfLevels = iconInteractor.numberOfLevels.value, showExclamationMark = showExclamationMark.value, carrierNetworkChange = iconInteractor.carrierNetworkChangeActive.value, ) combine( shownLevel, iconInteractor.numberOfLevels, showExclamationMark, ) { shownLevel, numberOfLevels, showExclamationMark -> SignalIconModel(shownLevel, numberOfLevels, showExclamationMark) iconInteractor.carrierNetworkChangeActive, ) { shownLevel, numberOfLevels, showExclamationMark, carrierNetworkChange -> SignalIconModel( shownLevel, numberOfLevels, showExclamationMark, carrierNetworkChange, ) } .distinctUntilChanged() .logDiffsForTable( Loading @@ -152,8 +159,10 @@ constructor( iconInteractor.isDataEnabled, iconInteractor.alwaysShowDataRatIcon, iconInteractor.mobileIsDefault, ) { dataConnected, dataEnabled, alwaysShow, mobileIsDefault -> alwaysShow || (dataEnabled && dataConnected && mobileIsDefault) iconInteractor.carrierNetworkChangeActive, ) { dataConnected, dataEnabled, alwaysShow, mobileIsDefault, carrierNetworkChange -> alwaysShow || (!carrierNetworkChange && (dataEnabled && dataConnected && mobileIsDefault)) } .distinctUntilChanged() .logDiffsForTable( Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/FakeMobileIconInteractor.kt +2 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,8 @@ class FakeMobileIconInteractor( ) ) override val carrierNetworkChangeActive = MutableStateFlow(false) override val mobileIsDefault = MutableStateFlow(true) override val networkTypeIconGroup = Loading