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

Commit 9581aab1 authored by Caitlin Shkuratov's avatar Caitlin Shkuratov Committed by Automerger Merge Worker
Browse files

Merge "[SB Refactor] Migrate alwaysShowDataRatIcon to the new pipeline." into...

Merge "[SB Refactor] Migrate alwaysShowDataRatIcon to the new pipeline." into tm-qpr-dev am: 104d83e4

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20728182



Change-Id: Icc5f8a2f9e74bd7a8dee8be94d449f248acfabb9
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents fbd96fab 104d83e4
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -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;
        }
    }
}
+15 −0
Original line number Diff line number Diff line
@@ -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
@@ -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>>

+10 −0
Original line number Diff line number Diff line
@@ -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
@@ -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 }

+2 −1
Original line number Diff line number Diff line
@@ -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)

+1 −12
Original line number Diff line number Diff line
@@ -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
@@ -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