Skip to content

Commit 62a1eb8

Browse files
committed
Suppress mobile-out-of-service label if wifi connected.
Carrier name is shown if - in service and connected to mobile data - in service and connected to wifi Carrier name is blanked if out of service and connected to wifi. "No internet connection" is shown if out of service without any other route. Bug: 5903914 Change-Id: I59d4d0c90e4153d73c38f7f0e150becf7e021a5b
1 parent 9ac4dd8 commit 62a1eb8

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

packages/SystemUI/res/layout-sw600dp/status_bar_notification_panel_title.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
android:layout_height="wrap_content"
6464
android:layout_width="wrap_content"
6565
android:layout_gravity="center_vertical"
66+
android:paddingRight="6dp"
6667
>
6768

6869
<ImageView
@@ -87,7 +88,6 @@
8788
android:layout_width="wrap_content"
8889
android:layout_height="wrap_content"
8990
android:paddingRight="12dp"
90-
android:paddingLeft="6dp"
9191
android:singleLine="true"
9292
android:ellipsize="end"
9393
android:text="@string/status_bar_settings_settings_button"
@@ -99,6 +99,7 @@
9999
android:layout_height="wrap_content"
100100
android:layout_width="wrap_content"
101101
android:layout_gravity="center_vertical"
102+
android:paddingRight="6dp"
102103
>
103104

104105
<ImageView
@@ -122,7 +123,6 @@
122123
android:layout_gravity="left|center_vertical"
123124
android:layout_width="wrap_content"
124125
android:layout_height="wrap_content"
125-
android:paddingLeft="6dp"
126126
android:paddingRight="12dp"
127127
android:singleLine="true"
128128
android:ellipsize="end"

packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -892,13 +892,24 @@ void refreshViews() {
892892
mDataSignalIconId = mPhoneSignalIconId = 0;
893893
mobileLabel = "";
894894
} else {
895-
// We want to show the carrier name even if data is not being routed over that link, so
896-
// we look only at the service state here.
897-
mobileLabel = hasService()
898-
? mNetworkName
899-
: context.getString(R.string.status_bar_settings_signal_meter_disconnected);
900-
if (DEBUG) {
901-
mobileLabel += "yyyyYYYYyyyyYYYY";
895+
// We want to show the carrier name if in service and either:
896+
// - We are connected to mobile data, or
897+
// - We are not connected to mobile data, as long as the *reason* packets are not
898+
// being routed over that link is that we have better connectivity via wifi.
899+
// If data is disconnected for some other reason but wifi is connected, we show nothing.
900+
// Otherwise (nothing connected) we show "No internet connection".
901+
902+
if (mDataConnected) {
903+
mobileLabel = mNetworkName;
904+
} else if (mWifiConnected) {
905+
if (hasService()) {
906+
mobileLabel = mNetworkName;
907+
} else {
908+
mobileLabel = "";
909+
}
910+
} else {
911+
mobileLabel
912+
= context.getString(R.string.status_bar_settings_signal_meter_disconnected);
902913
}
903914

904915
// Now for things that should only be shown when actually using mobile data.

0 commit comments

Comments
 (0)