Loading packages/SettingsLib/src/com/android/settingslib/mobile/MobileMappings.java +17 −0 Original line number Diff line number Diff line Loading @@ -251,5 +251,22 @@ public class MobileMappings { } return config; } /** * Returns true if this config and the other config are semantically equal. * * Does not override isEquals because existing clients may be relying on the currently * defined equals behavior. */ public boolean areEqual(Config other) { return showAtLeast3G == other.showAtLeast3G && show4gFor3g == other.show4gFor3g && alwaysShowCdmaRssi == other.alwaysShowCdmaRssi && show4gForLte == other.show4gForLte && show4glteForLte == other.show4glteForLte && hideLtePlus == other.hideLtePlus && hspaDataDistinguishable == other.hspaDataDistinguishable && alwaysShowDataRatIcon == other.alwaysShowDataRatIcon; } } } packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/MobileConnectionsRepository.kt +15 −0 Original line number Diff line number Diff line Loading @@ -17,8 +17,11 @@ package com.android.systemui.statusbar.pipeline.mobile.data.repository import android.provider.Settings import android.telephony.CarrierConfigManager import android.telephony.SubscriptionManager import com.android.settingslib.SignalIcon.MobileIconGroup import com.android.settingslib.mobile.MobileMappings import com.android.settingslib.mobile.MobileMappings.Config import com.android.systemui.statusbar.pipeline.mobile.data.model.MobileConnectivityModel import com.android.systemui.statusbar.pipeline.mobile.data.model.SubscriptionModel import kotlinx.coroutines.flow.Flow Loading Loading @@ -47,6 +50,18 @@ interface MobileConnectionsRepository { /** Observe changes to the [Settings.Global.MOBILE_DATA] setting */ val globalMobileDataSettingChangedEvent: Flow<Unit> /** * [Config] is an object that tracks relevant configuration flags for a given subscription ID. * In the case of [MobileMappings], it's hard-coded to check the default data subscription's * config, so this will apply to every icon that we care about. * * Relevant bits in the config are things like * [CarrierConfigManager.KEY_SHOW_4G_FOR_LTE_DATA_ICON_BOOL] * * This flow will produce whenever the default data subscription or the carrier config changes. */ val defaultDataSubRatConfig: StateFlow<Config> /** The icon mapping from network type to [MobileIconGroup] for the default subscription */ val defaultMobileIconMapping: Flow<Map<String, MobileIconGroup>> Loading packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/MobileRepositorySwitcher.kt +10 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.systemui.statusbar.pipeline.mobile.data.repository import android.os.Bundle import androidx.annotation.VisibleForTesting import com.android.settingslib.SignalIcon import com.android.settingslib.mobile.MobileMappings import com.android.systemui.common.coroutine.ConflatedCallbackFlow.conflatedCallbackFlow import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.demomode.DemoMode Loading Loading @@ -123,6 +124,15 @@ constructor( realRepository.activeMobileDataSubscriptionId.value ) override val defaultDataSubRatConfig: StateFlow<MobileMappings.Config> = activeRepo .flatMapLatest { it.defaultDataSubRatConfig } .stateIn( scope, SharingStarted.WhileSubscribed(), realRepository.defaultDataSubRatConfig.value ) override val defaultMobileIconMapping: Flow<Map<String, SignalIcon.MobileIconGroup>> = activeRepo.flatMapLatest { it.defaultMobileIconMapping } Loading packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/demo/DemoMobileConnectionsRepository.kt +2 −1 Original line number Diff line number Diff line Loading @@ -106,7 +106,8 @@ constructor( ) /** Demo mode doesn't currently support modifications to the mobile mappings */ val defaultDataSubRatConfig = MutableStateFlow(MobileMappings.Config.readConfig(context)) override val defaultDataSubRatConfig = MutableStateFlow(MobileMappings.Config.readConfig(context)) override val defaultMobileIconGroup = flowOf(TelephonyIcons.THREE_G) Loading packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionsRepositoryImpl.kt +1 −12 Original line number Diff line number Diff line Loading @@ -37,7 +37,6 @@ import android.telephony.TelephonyManager import androidx.annotation.VisibleForTesting import com.android.internal.telephony.PhoneConstants import com.android.settingslib.SignalIcon.MobileIconGroup import com.android.settingslib.mobile.MobileMappings import com.android.settingslib.mobile.MobileMappings.Config import com.android.systemui.broadcast.BroadcastDispatcher import com.android.systemui.common.coroutine.ConflatedCallbackFlow.conflatedCallbackFlow Loading Loading @@ -152,17 +151,7 @@ constructor( IntentFilter(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED) ) /** * [Config] is an object that tracks relevant configuration flags for a given subscription ID. * In the case of [MobileMappings], it's hard-coded to check the default data subscription's * config, so this will apply to every icon that we care about. * * Relevant bits in the config are things like * [CarrierConfigManager.KEY_SHOW_4G_FOR_LTE_DATA_ICON_BOOL] * * This flow will produce whenever the default data subscription or the carrier config changes. */ private val defaultDataSubRatConfig: StateFlow<Config> = override val defaultDataSubRatConfig: StateFlow<Config> = merge(defaultDataSubIdChangeEvent, carrierConfigChangedEvent) .mapLatest { Config.readConfig(context) } .stateIn( Loading Loading
packages/SettingsLib/src/com/android/settingslib/mobile/MobileMappings.java +17 −0 Original line number Diff line number Diff line Loading @@ -251,5 +251,22 @@ public class MobileMappings { } return config; } /** * Returns true if this config and the other config are semantically equal. * * Does not override isEquals because existing clients may be relying on the currently * defined equals behavior. */ public boolean areEqual(Config other) { return showAtLeast3G == other.showAtLeast3G && show4gFor3g == other.show4gFor3g && alwaysShowCdmaRssi == other.alwaysShowCdmaRssi && show4gForLte == other.show4gForLte && show4glteForLte == other.show4glteForLte && hideLtePlus == other.hideLtePlus && hspaDataDistinguishable == other.hspaDataDistinguishable && alwaysShowDataRatIcon == other.alwaysShowDataRatIcon; } } }
packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/MobileConnectionsRepository.kt +15 −0 Original line number Diff line number Diff line Loading @@ -17,8 +17,11 @@ package com.android.systemui.statusbar.pipeline.mobile.data.repository import android.provider.Settings import android.telephony.CarrierConfigManager import android.telephony.SubscriptionManager import com.android.settingslib.SignalIcon.MobileIconGroup import com.android.settingslib.mobile.MobileMappings import com.android.settingslib.mobile.MobileMappings.Config import com.android.systemui.statusbar.pipeline.mobile.data.model.MobileConnectivityModel import com.android.systemui.statusbar.pipeline.mobile.data.model.SubscriptionModel import kotlinx.coroutines.flow.Flow Loading Loading @@ -47,6 +50,18 @@ interface MobileConnectionsRepository { /** Observe changes to the [Settings.Global.MOBILE_DATA] setting */ val globalMobileDataSettingChangedEvent: Flow<Unit> /** * [Config] is an object that tracks relevant configuration flags for a given subscription ID. * In the case of [MobileMappings], it's hard-coded to check the default data subscription's * config, so this will apply to every icon that we care about. * * Relevant bits in the config are things like * [CarrierConfigManager.KEY_SHOW_4G_FOR_LTE_DATA_ICON_BOOL] * * This flow will produce whenever the default data subscription or the carrier config changes. */ val defaultDataSubRatConfig: StateFlow<Config> /** The icon mapping from network type to [MobileIconGroup] for the default subscription */ val defaultMobileIconMapping: Flow<Map<String, MobileIconGroup>> Loading
packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/MobileRepositorySwitcher.kt +10 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.systemui.statusbar.pipeline.mobile.data.repository import android.os.Bundle import androidx.annotation.VisibleForTesting import com.android.settingslib.SignalIcon import com.android.settingslib.mobile.MobileMappings import com.android.systemui.common.coroutine.ConflatedCallbackFlow.conflatedCallbackFlow import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.demomode.DemoMode Loading Loading @@ -123,6 +124,15 @@ constructor( realRepository.activeMobileDataSubscriptionId.value ) override val defaultDataSubRatConfig: StateFlow<MobileMappings.Config> = activeRepo .flatMapLatest { it.defaultDataSubRatConfig } .stateIn( scope, SharingStarted.WhileSubscribed(), realRepository.defaultDataSubRatConfig.value ) override val defaultMobileIconMapping: Flow<Map<String, SignalIcon.MobileIconGroup>> = activeRepo.flatMapLatest { it.defaultMobileIconMapping } Loading
packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/demo/DemoMobileConnectionsRepository.kt +2 −1 Original line number Diff line number Diff line Loading @@ -106,7 +106,8 @@ constructor( ) /** Demo mode doesn't currently support modifications to the mobile mappings */ val defaultDataSubRatConfig = MutableStateFlow(MobileMappings.Config.readConfig(context)) override val defaultDataSubRatConfig = MutableStateFlow(MobileMappings.Config.readConfig(context)) override val defaultMobileIconGroup = flowOf(TelephonyIcons.THREE_G) Loading
packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionsRepositoryImpl.kt +1 −12 Original line number Diff line number Diff line Loading @@ -37,7 +37,6 @@ import android.telephony.TelephonyManager import androidx.annotation.VisibleForTesting import com.android.internal.telephony.PhoneConstants import com.android.settingslib.SignalIcon.MobileIconGroup import com.android.settingslib.mobile.MobileMappings import com.android.settingslib.mobile.MobileMappings.Config import com.android.systemui.broadcast.BroadcastDispatcher import com.android.systemui.common.coroutine.ConflatedCallbackFlow.conflatedCallbackFlow Loading Loading @@ -152,17 +151,7 @@ constructor( IntentFilter(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED) ) /** * [Config] is an object that tracks relevant configuration flags for a given subscription ID. * In the case of [MobileMappings], it's hard-coded to check the default data subscription's * config, so this will apply to every icon that we care about. * * Relevant bits in the config are things like * [CarrierConfigManager.KEY_SHOW_4G_FOR_LTE_DATA_ICON_BOOL] * * This flow will produce whenever the default data subscription or the carrier config changes. */ private val defaultDataSubRatConfig: StateFlow<Config> = override val defaultDataSubRatConfig: StateFlow<Config> = merge(defaultDataSubIdChangeEvent, carrierConfigChangedEvent) .mapLatest { Config.readConfig(context) } .stateIn( Loading