Merge "[WIFI][SysUI] Update QS iconography for Wi-Fi" into rvc-dev
This commit is contained in:
@@ -68,6 +68,7 @@ public class WifiStatusTracker extends ConnectivityManager.NetworkCallback {
|
|||||||
|
|
||||||
private WifiInfo mWifiInfo;
|
private WifiInfo mWifiInfo;
|
||||||
public boolean enabled;
|
public boolean enabled;
|
||||||
|
public boolean isCaptivePortal;
|
||||||
public int state;
|
public int state;
|
||||||
public boolean connected;
|
public boolean connected;
|
||||||
public String ssid;
|
public String ssid;
|
||||||
@@ -155,9 +156,11 @@ public class WifiStatusTracker extends ConnectivityManager.NetworkCallback {
|
|||||||
private void updateStatusLabel() {
|
private void updateStatusLabel() {
|
||||||
final NetworkCapabilities networkCapabilities
|
final NetworkCapabilities networkCapabilities
|
||||||
= mConnectivityManager.getNetworkCapabilities(mWifiManager.getCurrentNetwork());
|
= mConnectivityManager.getNetworkCapabilities(mWifiManager.getCurrentNetwork());
|
||||||
|
isCaptivePortal = false;
|
||||||
if (networkCapabilities != null) {
|
if (networkCapabilities != null) {
|
||||||
if (networkCapabilities.hasCapability(NET_CAPABILITY_CAPTIVE_PORTAL)) {
|
if (networkCapabilities.hasCapability(NET_CAPABILITY_CAPTIVE_PORTAL)) {
|
||||||
statusLabel = mContext.getString(R.string.wifi_status_sign_in_required);
|
statusLabel = mContext.getString(R.string.wifi_status_sign_in_required);
|
||||||
|
isCaptivePortal = true;
|
||||||
return;
|
return;
|
||||||
} else if (networkCapabilities.hasCapability(NET_CAPABILITY_PARTIAL_CONNECTIVITY)) {
|
} else if (networkCapabilities.hasCapability(NET_CAPABILITY_PARTIAL_CONNECTIVITY)) {
|
||||||
statusLabel = mContext.getString(R.string.wifi_limited_connection);
|
statusLabel = mContext.getString(R.string.wifi_limited_connection);
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ public class WifiTile extends QSTileImpl<SignalState> {
|
|||||||
state.icon = ResourceIcon.get(cb.wifiSignalIconId);
|
state.icon = ResourceIcon.get(cb.wifiSignalIconId);
|
||||||
state.label = removeDoubleQuotes(cb.ssid);
|
state.label = removeDoubleQuotes(cb.ssid);
|
||||||
} else if (wifiNotConnected) {
|
} 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);
|
state.label = r.getString(R.string.quick_settings_wifi_label);
|
||||||
} else {
|
} else {
|
||||||
state.icon = ResourceIcon.get(WifiIcons.QS_WIFI_NO_NETWORK);
|
state.icon = ResourceIcon.get(WifiIcons.QS_WIFI_NO_NETWORK);
|
||||||
|
|||||||
@@ -88,15 +88,16 @@ public class WifiSignalController extends
|
|||||||
boolean wifiVisible = mCurrentState.enabled
|
boolean wifiVisible = mCurrentState.enabled
|
||||||
&& ((mCurrentState.connected && mCurrentState.inetCondition == 1)
|
&& ((mCurrentState.connected && mCurrentState.inetCondition == 1)
|
||||||
|| !mHasMobileData || visibleWhenEnabled);
|
|| !mHasMobileData || visibleWhenEnabled);
|
||||||
String wifiDesc = wifiVisible ? mCurrentState.ssid : null;
|
String wifiDesc = mCurrentState.connected ? mCurrentState.ssid : null;
|
||||||
boolean ssidPresent = wifiVisible && mCurrentState.ssid != null;
|
boolean ssidPresent = wifiVisible && mCurrentState.ssid != null;
|
||||||
String contentDescription = getTextIfExists(getContentDescription()).toString();
|
String contentDescription = getTextIfExists(getContentDescription()).toString();
|
||||||
if (mCurrentState.inetCondition == 0) {
|
if (mCurrentState.inetCondition == 0) {
|
||||||
contentDescription += ("," + mContext.getString(R.string.data_connection_no_internet));
|
contentDescription += ("," + mContext.getString(R.string.data_connection_no_internet));
|
||||||
}
|
}
|
||||||
IconState statusIcon = new IconState(wifiVisible, getCurrentIconId(), contentDescription);
|
IconState statusIcon = new IconState(wifiVisible, getCurrentIconId(), contentDescription);
|
||||||
IconState qsIcon = new IconState(mCurrentState.connected, getQsCurrentIconId(),
|
IconState qsIcon = new IconState(mCurrentState.connected,
|
||||||
contentDescription);
|
mWifiTracker.isCaptivePortal ? R.drawable.ic_qs_wifi_disconnected
|
||||||
|
: getQsCurrentIconId(), contentDescription);
|
||||||
callback.setWifiIndicators(mCurrentState.enabled, statusIcon, qsIcon,
|
callback.setWifiIndicators(mCurrentState.enabled, statusIcon, qsIcon,
|
||||||
ssidPresent && mCurrentState.activityIn, ssidPresent && mCurrentState.activityOut,
|
ssidPresent && mCurrentState.activityIn, ssidPresent && mCurrentState.activityOut,
|
||||||
wifiDesc, mCurrentState.isTransient, mCurrentState.statusLabel);
|
wifiDesc, mCurrentState.isTransient, mCurrentState.statusLabel);
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ public class NetworkControllerWifiTest extends NetworkControllerBaseTest {
|
|||||||
testSsid);
|
testSsid);
|
||||||
setConnectivityViaBroadcast(NetworkCapabilities.TRANSPORT_WIFI, false, true);
|
setConnectivityViaBroadcast(NetworkCapabilities.TRANSPORT_WIFI, false, true);
|
||||||
verifyLastQsWifiIcon(true, true, WifiIcons.QS_WIFI_SIGNAL_STRENGTH[0][testLevel],
|
verifyLastQsWifiIcon(true, true, WifiIcons.QS_WIFI_SIGNAL_STRENGTH[0][testLevel],
|
||||||
null);
|
testSsid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user