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

Commit c02098e2 authored by Bharath's avatar Bharath
Browse files

Add support to configure state of operator name in status bar [1/2]

Add an override that can be used to configure the default state
of operator name in status bar while carrier config is enabled.

Bug: 399826221
Test: atest OperatorNameViewControllerTest
Change-Id: I79c2ac7f49950b3d9ca576d4e6ba64cfb56937ca
parent 5dcfeb3f
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -3977,6 +3977,11 @@
        <item>-44</item>
    </integer-array>

    <!-- Provides default value for operator name in status bar option in  setting:
         0 - Hide operator name in status bar
         1 - Show operator name in status bar (default) -->
    <integer name="config_showOperatorNameDefault">1</integer>

    <!-- Enabled built-in zen mode condition providers -->
    <string-array translatable="false" name="config_system_condition_providers">
        <item>countdown</item>
+3 −0
Original line number Diff line number Diff line
@@ -2691,6 +2691,9 @@
  <java-symbol type="string" name="muted_by" />
  <java-symbol type="string" name="zen_mode_alarm" />

  <!-- For default state of operator name in status bar -->
  <java-symbol type="integer" name="config_showOperatorNameDefault"/>

  <java-symbol type="string" name="select_day" />
  <java-symbol type="string" name="select_year" />

+10 −0
Original line number Diff line number Diff line
@@ -16,10 +16,12 @@

package com.android.systemui.statusbar

import android.content.res.Resources
import android.telephony.ServiceState
import android.telephony.SubscriptionInfo
import android.telephony.TelephonyManager
import android.telephony.telephonyManager
import android.testing.TestableResources
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.keyguard.keyguardUpdateMonitor
@@ -72,10 +74,18 @@ class OperatorNameViewControllerTest : SysuiTestCase() {
    private val airplaneModeRepository = FakeAirplaneModeRepository()
    private val connectivityRepository = FakeConnectivityRepository()

    @Mock private lateinit var resources: Resources
    private lateinit var testableResources: TestableResources

    @Before
    fun setup() {
        MockitoAnnotations.initMocks(this)

        testableResources = mContext.getOrCreateTestableResources()
        testableResources.addOverride(
            com.android.internal.R.integer.config_showOperatorNameDefault,
                1)

        airplaneModeInteractor =
            AirplaneModeInteractor(
                airplaneModeRepository,
+7 −1
Original line number Diff line number Diff line
@@ -97,7 +97,13 @@ public class OperatorNameViewController extends ViewController<OperatorNameView>
        boolean showOperatorName =
                mCarrierConfigTracker
                        .getShowOperatorNameInStatusBarConfig(defaultSubInfo.getSubId())
                        && (mTunerService.getValue(KEY_SHOW_OPERATOR_NAME, 1) != 0);
                        && (mTunerService.getValue(
                                KEY_SHOW_OPERATOR_NAME,
                                mView.getResources()
                                        .getInteger(
                                                com.android.internal.R.integer
                                                        .config_showOperatorNameDefault))
                                != 0);
        mView.update(
                showOperatorName,
                mTelephonyManager.isDataCapable(),