Hide the empty buckets when selected network is empty.
Sometimes the selected network (operator) has empty parentheses. For example,
it's the default value for automatically selected network. Hide the
empty parentheses by moving it from hardcoded string to the actual
string value.
Change-Id: I511b5eb84b5b6f142cc2406ab8eb884a5a29acb8
Test: Manual
Bug: 114066643
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 6b7a105..834f384 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1074,8 +1074,8 @@
<!-- Label for the "No service" notification item, when expanded. -->
<string name="notification_network_selection_title">No service</string>
<!-- Label for the expanded "No service" notification item, including the
- operator name set by user -->
- <string name="notification_network_selection_text">Selected network (<xliff:g id="operator_name">%s</xliff:g>) unavailable</string>
+ operator name set by user. No space after "network", appended in nonempty value. -->
+ <string name="notification_network_selection_text">Selected network<xliff:g id="operator_name">%s</xliff:g> unavailable</string>
<!-- In-call screen: call failure message displayed in an error dialog. [CHAR_LIMIT=NONE] -->
<string name="incall_error_power_off" product="watch">Turn on mobile network, turn off airplane mode or turn off battery saver mode to make a call.</string>
diff --git a/src/com/android/phone/NotificationMgr.java b/src/com/android/phone/NotificationMgr.java
index 1b2d49e..5aa87d0 100644
--- a/src/com/android/phone/NotificationMgr.java
+++ b/src/com/android/phone/NotificationMgr.java
@@ -569,6 +569,9 @@
private void showNetworkSelection(String operator, int subId) {
if (DBG) log("showNetworkSelection(" + operator + ")...");
+ if (!TextUtils.isEmpty(operator)) {
+ operator = String.format(" (%s)", operator);
+ }
Notification.Builder builder = new Notification.Builder(mContext)
.setSmallIcon(android.R.drawable.stat_sys_warning)
.setContentTitle(mContext.getString(R.string.notification_network_selection_title))