Merge "[WIFI][SysUI] Update QS iconography for Wi-Fi" into rvc-dev

This commit is contained in:
Etan Cohen
2020-02-25 23:58:41 +00:00
committed by Android (Google) Code Review
4 changed files with 9 additions and 5 deletions

View File

@@ -68,6 +68,7 @@ public class WifiStatusTracker extends ConnectivityManager.NetworkCallback {
private WifiInfo mWifiInfo;
public boolean enabled;
public boolean isCaptivePortal;
public int state;
public boolean connected;
public String ssid;
@@ -155,9 +156,11 @@ public class WifiStatusTracker extends ConnectivityManager.NetworkCallback {
private void updateStatusLabel() {
final NetworkCapabilities networkCapabilities
= mConnectivityManager.getNetworkCapabilities(mWifiManager.getCurrentNetwork());
isCaptivePortal = false;
if (networkCapabilities != null) {
if (networkCapabilities.hasCapability(NET_CAPABILITY_CAPTIVE_PORTAL)) {
statusLabel = mContext.getString(R.string.wifi_status_sign_in_required);
isCaptivePortal = true;
return;
} else if (networkCapabilities.hasCapability(NET_CAPABILITY_PARTIAL_CONNECTIVITY)) {
statusLabel = mContext.getString(R.string.wifi_limited_connection);

View File

@@ -206,7 +206,7 @@ public class WifiTile extends QSTileImpl<SignalState> {
state.icon = ResourceIcon.get(cb.wifiSignalIconId);
state.label = removeDoubleQuotes(cb.ssid);
} else if (wifiNotConnected) {
state.icon = ResourceIcon.get(R.drawable.ic_qs_wifi_disconnected);
state.icon = ResourceIcon.get(WifiIcons.QS_WIFI_NO_NETWORK);
state.label = r.getString(R.string.quick_settings_wifi_label);
} else {
state.icon = ResourceIcon.get(WifiIcons.QS_WIFI_NO_NETWORK);

View File

@@ -88,15 +88,16 @@ public class WifiSignalController extends
boolean wifiVisible = mCurrentState.enabled
&& ((mCurrentState.connected && mCurrentState.inetCondition == 1)
|| !mHasMobileData || visibleWhenEnabled);
String wifiDesc = wifiVisible ? mCurrentState.ssid : null;
String wifiDesc = mCurrentState.connected ? mCurrentState.ssid : null;
boolean ssidPresent = wifiVisible && mCurrentState.ssid != null;
String contentDescription = getTextIfExists(getContentDescription()).toString();
if (mCurrentState.inetCondition == 0) {
contentDescription += ("," + mContext.getString(R.string.data_connection_no_internet));
}
IconState statusIcon = new IconState(wifiVisible, getCurrentIconId(), contentDescription);
IconState qsIcon = new IconState(mCurrentState.connected, getQsCurrentIconId(),
contentDescription);
IconState qsIcon = new IconState(mCurrentState.connected,
mWifiTracker.isCaptivePortal ? R.drawable.ic_qs_wifi_disconnected
: getQsCurrentIconId(), contentDescription);
callback.setWifiIndicators(mCurrentState.enabled, statusIcon, qsIcon,
ssidPresent && mCurrentState.activityIn, ssidPresent && mCurrentState.activityOut,
wifiDesc, mCurrentState.isTransient, mCurrentState.statusLabel);

View File

@@ -72,7 +72,7 @@ public class NetworkControllerWifiTest extends NetworkControllerBaseTest {
testSsid);
setConnectivityViaBroadcast(NetworkCapabilities.TRANSPORT_WIFI, false, true);
verifyLastQsWifiIcon(true, true, WifiIcons.QS_WIFI_SIGNAL_STRENGTH[0][testLevel],
null);
testSsid);
}
}