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

Commit 730bbf86 authored by Caitlin Shkuratov's avatar Caitlin Shkuratov
Browse files

[SB] Remove launched flag status_bar_inflate_carrier_merged.

Bug: 423686800
Fixes: 437155885
Flag: EXEMPT launched flag removal
Test: atest SystemUITests
Change-Id: I1a58b55b80d1e9ba547505938d5ec040ce6d57b6
parent 60b62275
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -457,16 +457,6 @@ flag {
    }
}

flag {
    name: "status_bar_inflate_carrier_merged"
    namespace: "systemui"
    description: "Allow the status bar to inflate the levels of the carrier merged connection"
    bug: "423686800"
    metadata {
      purpose: PURPOSE_BUGFIX
    }
}

flag {
    name: "status_bar_show_icons_in_secure_camera"
    namespace: "systemui"
+0 −38
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@

package com.android.systemui.statusbar.pipeline.mobile.data.repository.prod

import android.platform.test.annotations.DisableFlags
import android.platform.test.annotations.EnableFlags
import android.telephony.CarrierConfigManager.KEY_INFLATE_SIGNAL_STRENGTH_BOOL
import android.telephony.TelephonyManager
import androidx.test.ext.junit.runners.AndroidJUnit4
@@ -32,7 +30,6 @@ import com.android.systemui.kosmos.Kosmos
import com.android.systemui.kosmos.Kosmos.Fixture
import com.android.systemui.kosmos.useUnconfinedTestDispatcher
import com.android.systemui.log.table.logcatTableLogBuffer
import com.android.systemui.statusbar.pipeline.StatusBarInflateCarrierMerged
import com.android.systemui.statusbar.pipeline.mobile.data.model.DataConnectionState
import com.android.systemui.statusbar.pipeline.mobile.data.model.NetworkNameModel
import com.android.systemui.statusbar.pipeline.mobile.data.model.ResolvedNetworkType
@@ -197,7 +194,6 @@ class CarrierMergedConnectionRepositoryKairosTest : SysuiTestCase() {
    }

    @Test
    @EnableFlags(StatusBarInflateCarrierMerged.FLAG_NAME)
    fun numberOfLevels_comesFromCarrierMerged_andInflated() = runTest {
        val latest by underTest.numberOfLevels.collectLastValue()

@@ -216,40 +212,6 @@ class CarrierMergedConnectionRepositoryKairosTest : SysuiTestCase() {
    }

    @Test
    @DisableFlags(StatusBarInflateCarrierMerged.FLAG_NAME)
    fun numberOfLevels_flagDisabled_ignoresInflated() = runTest {
        val latest by underTest.numberOfLevels.collectLastValue()

        fakeWifiRepository.setWifiNetwork(
            WifiNetworkModel.CarrierMerged.of(
                subscriptionId = SUB_ID,
                level = 1,
                numberOfLevels = 6,
            )
        )
        systemUiCarrierConfig.processNewCarrierConfig(
            testCarrierConfigWithOverride(KEY_INFLATE_SIGNAL_STRENGTH_BOOL, true)
        )

        assertThat(latest).isEqualTo(6)
    }

    @Test
    @DisableFlags(StatusBarInflateCarrierMerged.FLAG_NAME)
    fun inflateSignalStrength_flagDisabled_alwaysFalse() = runTest {
        val latest by underTest.inflateSignalStrength.collectLastValue()

        assertThat(latest).isEqualTo(false)

        systemUiCarrierConfig.processNewCarrierConfig(
            testCarrierConfigWithOverride(KEY_INFLATE_SIGNAL_STRENGTH_BOOL, true)
        )

        assertThat(latest).isEqualTo(false)
    }

    @Test
    @EnableFlags(StatusBarInflateCarrierMerged.FLAG_NAME)
    fun inflateSignalStrength_usesCarrierConfig() = runTest {
        val latest by underTest.inflateSignalStrength.collectLastValue()

+0 −40
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@

package com.android.systemui.statusbar.pipeline.mobile.data.repository.prod

import android.platform.test.annotations.DisableFlags
import android.platform.test.annotations.EnableFlags
import android.telephony.CarrierConfigManager.KEY_INFLATE_SIGNAL_STRENGTH_BOOL
import android.telephony.TelephonyManager
import androidx.test.ext.junit.runners.AndroidJUnit4
@@ -30,7 +28,6 @@ import com.android.systemui.kosmos.runTest
import com.android.systemui.kosmos.testScope
import com.android.systemui.kosmos.useUnconfinedTestDispatcher
import com.android.systemui.log.table.logcatTableLogBuffer
import com.android.systemui.statusbar.pipeline.StatusBarInflateCarrierMerged
import com.android.systemui.statusbar.pipeline.mobile.data.model.DataConnectionState
import com.android.systemui.statusbar.pipeline.mobile.data.model.NetworkNameModel
import com.android.systemui.statusbar.pipeline.mobile.data.model.ResolvedNetworkType
@@ -208,7 +205,6 @@ abstract class CarrierMergedConnectionRepositoryTestBase : SysuiTestCase() {
        }

    @Test
    @EnableFlags(StatusBarInflateCarrierMerged.FLAG_NAME)
    fun numberOfLevels_comesFromCarrierMerged_andInflated() =
        kosmos.runTest {
            val latest by collectLastValue(underTest.numberOfLevels)
@@ -228,42 +224,6 @@ abstract class CarrierMergedConnectionRepositoryTestBase : SysuiTestCase() {
        }

    @Test
    @DisableFlags(StatusBarInflateCarrierMerged.FLAG_NAME)
    fun numberOfLevels_flagDisabled_ignoresInflated() =
        kosmos.runTest {
            val latest by collectLastValue(underTest.numberOfLevels)

            wifiRepository.fake.setWifiNetwork(
                WifiNetworkModel.CarrierMerged.of(
                    subscriptionId = SUB_ID,
                    level = 1,
                    numberOfLevels = 6,
                )
            )
            systemUiCarrierConfig.processNewCarrierConfig(
                testCarrierConfigWithOverride(KEY_INFLATE_SIGNAL_STRENGTH_BOOL, true)
            )

            assertThat(latest).isEqualTo(6)
        }

    @Test
    @DisableFlags(StatusBarInflateCarrierMerged.FLAG_NAME)
    fun inflateSignalStrength_flagDisabled_alwaysFalse() =
        kosmos.runTest {
            val latest by collectLastValue(underTest.inflateSignalStrength)

            assertThat(latest).isEqualTo(false)

            systemUiCarrierConfig.processNewCarrierConfig(
                testCarrierConfigWithOverride(KEY_INFLATE_SIGNAL_STRENGTH_BOOL, true)
            )

            assertThat(latest).isEqualTo(false)
        }

    @Test
    @EnableFlags(StatusBarInflateCarrierMerged.FLAG_NAME)
    fun inflateSignalStrength_usesCarrierConfig() =
        kosmos.runTest {
            val latest by collectLastValue(underTest.inflateSignalStrength)
+1 −3
Original line number Diff line number Diff line
@@ -91,7 +91,6 @@ import com.android.systemui.qs.flags.QsWifiConfig;
import com.android.systemui.res.R;
import com.android.systemui.shade.ShadeDisplayAware;
import com.android.systemui.statusbar.connectivity.AccessPointController;
import com.android.systemui.statusbar.pipeline.StatusBarInflateCarrierMerged;
import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.policy.LocationController;
import com.android.systemui.toast.SystemUIToast;
@@ -597,8 +596,7 @@ public class InternetDetailsContentController implements AccessPointController.A
        if (isCarrierNetworkActive) {
            level = getCarrierNetworkLevel();
            numLevels = WifiEntry.WIFI_LEVEL_MAX + 1;
            if (StatusBarInflateCarrierMerged.isEnabled()
                    && mCarrierConfigTracker.getInflateSignalStrengthBool(subId)) {
            if (mCarrierConfigTracker.getInflateSignalStrengthBool(subId)) {
                level += 1;
                numLevels += 1;
            }
+0 −67
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.statusbar.pipeline

import com.android.systemui.Flags
import com.android.systemui.flags.FlagToken
import com.android.systemui.flags.RefactorFlagUtils

/** Helper for reading or using the status bar inflate carrier merged flag state. */
@Suppress("NOTHING_TO_INLINE")
object StatusBarInflateCarrierMerged {
    /** The aconfig flag name */
    const val FLAG_NAME = Flags.FLAG_STATUS_BAR_INFLATE_CARRIER_MERGED

    /** A token used for dependency declaration */
    val token: FlagToken
        get() = FlagToken(FLAG_NAME, isEnabled)

    /** Is the refactor enabled */
    @JvmStatic
    inline val isEnabled
        get() = Flags.statusBarInflateCarrierMerged()

    /**
     * Called to ensure code is only run when the flag is enabled. This can be used to protect users
     * from the unintended behaviors caused by accidentally running new logic, while also crashing
     * on an eng build to ensure that the refactor author catches issues in testing.
     */
    @JvmStatic
    inline fun isUnexpectedlyInLegacyMode() =
        RefactorFlagUtils.isUnexpectedlyInLegacyMode(isEnabled, FLAG_NAME)

    /**
     * Called to ensure code is only run when the flag is enabled. This will call Log.wtf if the
     * flag is not enabled to ensure that the refactor author catches issues in testing.
     *
     * NOTE: This can be useful for simple methods, but does not return the flag state, so it cannot
     * be used to implement a safe exit, and as such it does not support code stripping. If the
     * calling code will do work that is unsafe when the flag is off, it is recommended to write an
     * early return with `if (isUnexpectedlyInLegacyMode()) return`.
     */
    @JvmStatic
    inline fun expectInNewMode() {
        RefactorFlagUtils.isUnexpectedlyInLegacyMode(isEnabled, FLAG_NAME)
    }

    /**
     * Called to ensure code is only run when the flag is disabled. This will throw an exception if
     * the flag is enabled to ensure that the refactor author catches issues in testing.
     */
    @JvmStatic
    inline fun assertInLegacyMode() = RefactorFlagUtils.assertInLegacyMode(isEnabled, FLAG_NAME)
}
Loading