Skip to content

Commit 185c0ef

Browse files
dsandlerAndroid (Google) Code Review
authored andcommitted
Merge "Stop showing "No internet connection" when there is one." into ics-mr1
2 parents 7eeaf3f + 2e481b9 commit 185c0ef

File tree

1 file changed

+47
-27
lines changed

1 file changed

+47
-27
lines changed

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

Lines changed: 47 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -890,34 +890,40 @@ void refreshViews() {
890890

891891
if (!mHasMobileDataFeature) {
892892
mDataSignalIconId = mPhoneSignalIconId = 0;
893-
} else if (mDataConnected) {
894-
mobileLabel = mNetworkName;
893+
mobileLabel = "";
894+
} 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);
895900
if (DEBUG) {
896901
mobileLabel += "yyyyYYYYyyyyYYYY";
897902
}
898-
combinedSignalIconId = mDataSignalIconId;
899-
switch (mDataActivity) {
900-
case TelephonyManager.DATA_ACTIVITY_IN:
901-
mMobileActivityIconId = R.drawable.stat_sys_signal_in;
902-
break;
903-
case TelephonyManager.DATA_ACTIVITY_OUT:
904-
mMobileActivityIconId = R.drawable.stat_sys_signal_out;
905-
break;
906-
case TelephonyManager.DATA_ACTIVITY_INOUT:
907-
mMobileActivityIconId = R.drawable.stat_sys_signal_inout;
908-
break;
909-
default:
910-
mMobileActivityIconId = 0;
911-
break;
912-
}
913903

914-
combinedLabel = mobileLabel;
915-
combinedActivityIconId = mMobileActivityIconId;
916-
combinedSignalIconId = mDataSignalIconId; // set by updateDataIcon()
917-
mContentDescriptionCombinedSignal = mContentDescriptionDataType;
918-
} else {
919-
mobileLabel = mHasMobileDataFeature ?
920-
context.getString(R.string.status_bar_settings_signal_meter_disconnected) : "";
904+
// Now for things that should only be shown when actually using mobile data.
905+
if (mDataConnected) {
906+
combinedSignalIconId = mDataSignalIconId;
907+
switch (mDataActivity) {
908+
case TelephonyManager.DATA_ACTIVITY_IN:
909+
mMobileActivityIconId = R.drawable.stat_sys_signal_in;
910+
break;
911+
case TelephonyManager.DATA_ACTIVITY_OUT:
912+
mMobileActivityIconId = R.drawable.stat_sys_signal_out;
913+
break;
914+
case TelephonyManager.DATA_ACTIVITY_INOUT:
915+
mMobileActivityIconId = R.drawable.stat_sys_signal_inout;
916+
break;
917+
default:
918+
mMobileActivityIconId = 0;
919+
break;
920+
}
921+
922+
combinedLabel = mobileLabel;
923+
combinedActivityIconId = mMobileActivityIconId;
924+
combinedSignalIconId = mDataSignalIconId; // set by updateDataIcon()
925+
mContentDescriptionCombinedSignal = mContentDescriptionDataType;
926+
}
921927
}
922928

923929
if (mWifiConnected) {
@@ -949,6 +955,12 @@ void refreshViews() {
949955
combinedLabel = wifiLabel;
950956
combinedSignalIconId = mWifiIconId; // set by updateWifiIcons()
951957
mContentDescriptionCombinedSignal = mContentDescriptionWifi;
958+
} else {
959+
if (mHasMobileDataFeature) {
960+
wifiLabel = "";
961+
} else {
962+
wifiLabel = context.getString(R.string.status_bar_settings_signal_meter_disconnected);
963+
}
952964
}
953965

954966
if (mBluetoothTethered) {
@@ -969,9 +981,17 @@ void refreshViews() {
969981
mDataTypeIconId = 0;
970982

971983
// combined values from connected wifi take precedence over airplane mode
972-
if (!mWifiConnected) {
973-
wifiLabel = context.getString(R.string.status_bar_settings_signal_meter_disconnected);
974-
combinedLabel = wifiLabel;
984+
if (mWifiConnected) {
985+
// Suppress "No internet connection." from mobile if wifi connected.
986+
mobileLabel = "";
987+
} else {
988+
if (mHasMobileDataFeature) {
989+
// let the mobile icon show "No internet connection."
990+
wifiLabel = "";
991+
} else {
992+
wifiLabel = context.getString(R.string.status_bar_settings_signal_meter_disconnected);
993+
combinedLabel = wifiLabel;
994+
}
975995
mContentDescriptionCombinedSignal = mContentDescriptionPhoneSignal;
976996
combinedSignalIconId = mDataSignalIconId;
977997
}

0 commit comments

Comments
 (0)