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

Commit 62a1eb89 authored by Daniel Sandler's avatar Daniel Sandler
Browse files

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
parent 9ac4dd82
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:layout_gravity="center_vertical"
                android:paddingRight="6dp"
                >

                <ImageView
@@ -87,7 +88,6 @@
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:paddingRight="12dp"
                android:paddingLeft="6dp"
                android:singleLine="true"
                android:ellipsize="end"
                android:text="@string/status_bar_settings_settings_button"
@@ -99,6 +99,7 @@
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:layout_gravity="center_vertical"
                android:paddingRight="6dp"
                >

                <ImageView
@@ -122,7 +123,6 @@
                android:layout_gravity="left|center_vertical"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:paddingLeft="6dp"
                android:paddingRight="12dp"
                android:singleLine="true"
                android:ellipsize="end"
+18 −7
Original line number Diff line number Diff line
@@ -892,13 +892,24 @@ public class NetworkController extends BroadcastReceiver {
            mDataSignalIconId = mPhoneSignalIconId = 0;
            mobileLabel = "";
        } else {
            // We want to show the carrier name even if data is not being routed over that link, so
            // we look only at the service state here.
            mobileLabel = hasService() 
                ? mNetworkName
                : context.getString(R.string.status_bar_settings_signal_meter_disconnected);
            if (DEBUG) {
                mobileLabel += "yyyyYYYYyyyyYYYY";
            // We want to show the carrier name if in service and either:
            //   - We are connected to mobile data, or
            //   - We are not connected to mobile data, as long as the *reason* packets are not
            //     being routed over that link is that we have better connectivity via wifi.
            // If data is disconnected for some other reason but wifi is connected, we show nothing.
            // Otherwise (nothing connected) we show "No internet connection".

            if (mDataConnected) {
                mobileLabel = mNetworkName;
            } else if (mWifiConnected) {
                if (hasService()) {
                    mobileLabel = mNetworkName;
                } else {
                    mobileLabel = "";
                }
            } else {
                mobileLabel 
                    = context.getString(R.string.status_bar_settings_signal_meter_disconnected);
            }

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