Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0349d538 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[Mobile] Add support for KEY_SHOW_5G_SLICE_ICON_BOOL carrier config" into main

parents 77e29125 690298c5
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.systemui.statusbar.pipeline.mobile.data.model

import android.os.PersistableBundle
import android.telephony.CarrierConfigManager.KEY_INFLATE_SIGNAL_STRENGTH_BOOL
import android.telephony.CarrierConfigManager.KEY_SHOW_5G_SLICE_ICON_BOOL
import android.telephony.CarrierConfigManager.KEY_SHOW_OPERATOR_NAME_IN_STATUSBAR_BOOL
import androidx.annotation.VisibleForTesting
import kotlinx.coroutines.flow.MutableStateFlow
@@ -66,10 +67,16 @@ internal constructor(
    /** Flow tracking the [KEY_SHOW_OPERATOR_NAME_IN_STATUSBAR_BOOL] config */
    val showOperatorNameInStatusBar: StateFlow<Boolean> = showOperatorName.config

    private val showNetworkSlice =
        BooleanCarrierConfig(KEY_SHOW_5G_SLICE_ICON_BOOL, defaultConfig)
    /** Flow tracking the [KEY_SHOW_5G_SLICE_ICON_BOOL] config */
    val allowNetworkSliceIndicator: StateFlow<Boolean> = showNetworkSlice.config

    private val trackedConfigs =
        listOf(
            inflateSignalStrength,
            showOperatorName,
            showNetworkSlice,
        )

    /** Ingest a new carrier config, and switch all of the tracked keys over to the new values */
+3 −0
Original line number Diff line number Diff line
@@ -48,6 +48,9 @@ interface MobileConnectionRepository {
    /** Reflects the value from the carrier config INFLATE_SIGNAL_STRENGTH for this connection */
    val inflateSignalStrength: StateFlow<Boolean>

    /** Carrier config KEY_SHOW_5G_SLICE_ICON_BOOL for this connection */
    val allowNetworkSliceIndicator: StateFlow<Boolean>

    /**
     * The table log buffer created for this connection. Will have the name "MobileConnectionLog
     * [subId]"
+3 −0
Original line number Diff line number Diff line
@@ -79,6 +79,9 @@ class DemoMobileConnectionRepository(
            )
            .stateIn(scope, SharingStarted.WhileSubscribed(), _inflateSignalStrength.value)

    // I don't see a reason why we would turn the config off for demo mode.
    override val allowNetworkSliceIndicator = MutableStateFlow(true)

    private val _isEmergencyOnly = MutableStateFlow(false)
    override val isEmergencyOnly =
        _isEmergencyOnly
+1 −0
Original line number Diff line number Diff line
@@ -166,6 +166,7 @@ class CarrierMergedConnectionRepository(
    override val isRoaming = MutableStateFlow(false).asStateFlow()
    override val carrierId = MutableStateFlow(INVALID_SUBSCRIPTION_ID).asStateFlow()
    override val inflateSignalStrength = MutableStateFlow(false).asStateFlow()
    override val allowNetworkSliceIndicator = MutableStateFlow(false).asStateFlow()
    override val isEmergencyOnly = MutableStateFlow(false).asStateFlow()
    override val operatorAlphaShort = MutableStateFlow(null).asStateFlow()
    override val isInService = MutableStateFlow(true).asStateFlow()
+15 −0
Original line number Diff line number Diff line
@@ -308,6 +308,21 @@ class FullMobileConnectionRepository(
                activeRepo.value.inflateSignalStrength.value
            )

    override val allowNetworkSliceIndicator =
        activeRepo
            .flatMapLatest { it.allowNetworkSliceIndicator }
            .logDiffsForTable(
                tableLogBuffer,
                columnPrefix = "",
                columnName = "allowSlice",
                initialValue = activeRepo.value.allowNetworkSliceIndicator.value,
            )
            .stateIn(
                scope,
                SharingStarted.WhileSubscribed(),
                activeRepo.value.allowNetworkSliceIndicator.value
            )

    override val numberOfLevels =
        activeRepo
            .flatMapLatest { it.numberOfLevels }
Loading