summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Zhibin Liu <zhibinliu@google.com> 2025-03-24 00:15:24 -0700
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2025-03-24 00:15:24 -0700
commitee18dbb30b7946ab8975dfbeea8489f97815f5d9 (patch)
tree3f231f089105f1008f10212432c7f6bb97d2f7b9
parentf6071154dbd909e9b322a82b6497486993b42d8b (diff)
parentc02098e241e2e932da776e535964f3a87e07bf95 (diff)
Merge "Add support to configure state of operator name in status bar [1/2]" into main
-rw-r--r--core/res/res/values/config.xml5
-rw-r--r--core/res/res/values/symbols.xml3
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/OperatorNameViewControllerTest.kt10
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/OperatorNameViewController.java8
4 files changed, 25 insertions, 1 deletions
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 8c590ac2ab5b..37ad78a2b83c 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -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>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 24a36a910e7d..fb0bad0a72c7 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -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" />
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/OperatorNameViewControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/OperatorNameViewControllerTest.kt
index 72a2ce50ed9c..c59f4abdf90b 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/OperatorNameViewControllerTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/OperatorNameViewControllerTest.kt
@@ -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,
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/OperatorNameViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/OperatorNameViewController.java
index f5d443443838..60a62d480633 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/OperatorNameViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/OperatorNameViewController.java
@@ -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(),