Assume wifi is connected if the icon is says so

We used only the SSID to determine if we are connected. It can be that
the ssid is null but we are connected (the icon is not NO_NETWORK). In
that case, assume we are connected and show the default label.

Test: manual
Bug: 182916016
Change-Id: I5952c47696da37453dc39c28effe5e38cae1820b
This commit is contained in:
Fabian Kozynski
2021-03-17 11:08:51 -04:00
parent e3e90bd0c4
commit f1c3d0993c

View File

@@ -177,8 +177,10 @@ public class WifiTile extends QSTileImpl<SignalState> {
}
}
boolean transientEnabling = arg == ARG_SHOW_TRANSIENT_ENABLING;
boolean wifiConnected = cb.enabled && (cb.wifiSignalIconId > 0) && (cb.ssid != null);
boolean wifiNotConnected = (cb.wifiSignalIconId > 0) && (cb.ssid == null);
boolean wifiConnected = cb.enabled && (cb.wifiSignalIconId > 0)
&& (cb.ssid != null || cb.wifiSignalIconId != WifiIcons.QS_WIFI_NO_NETWORK);
boolean wifiNotConnected = (cb.ssid == null)
&& (cb.wifiSignalIconId == WifiIcons.QS_WIFI_NO_NETWORK);
boolean enabledChanging = state.value != cb.enabled;
if (enabledChanging) {
mDetailAdapter.setItemsVisible(cb.enabled);
@@ -210,7 +212,7 @@ public class WifiTile extends QSTileImpl<SignalState> {
state.label = r.getString(R.string.quick_settings_wifi_label);
} else if (wifiConnected) {
state.icon = ResourceIcon.get(cb.wifiSignalIconId);
state.label = removeDoubleQuotes(cb.ssid);
state.label = cb.ssid != null ? removeDoubleQuotes(cb.ssid) : getTileLabel();
} else if (wifiNotConnected) {
state.icon = ResourceIcon.get(WifiIcons.QS_WIFI_NO_NETWORK);
state.label = r.getString(R.string.quick_settings_wifi_label);