Merge "Fixed a bug were secure Wi-Fi connections would show unsecured." into lmp-dev

This commit is contained in:
PauloftheWest
2014-08-14 15:39:57 +00:00
committed by Android (Google) Code Review
2 changed files with 7 additions and 20 deletions

View File

@@ -1628,12 +1628,6 @@
<!-- Substring of wifi status when Wi-Fi Protected Setup (WPS) is available and <!-- Substring of wifi status when Wi-Fi Protected Setup (WPS) is available and
string is listed after a wifi_secured_* string--> string is listed after a wifi_secured_* string-->
<string name="wifi_wps_available_second_item">\u0020(WPS available)</string> <string name="wifi_wps_available_second_item">\u0020(WPS available)</string>
<!-- Substring of wifi status for wifi with authentication. This version is for when the
string is first in the list (titlecase in english) -->
<string name="wifi_secured_first_item">Secured with <xliff:g id="wifi_security_short">%1$s</xliff:g></string>
<!-- Substring of wifi status for wifi with authentication. This version is for when the
string is not first in the list (lowercase in english) -->
<string name="wifi_secured_second_item">, secured with <xliff:g id="wifi_security_short">%1$s</xliff:g></string>
<!-- Message in WriteWifiConfigToNfcDialog when prompted to enter network password [CHAR_LIMIT=40] --> <!-- Message in WriteWifiConfigToNfcDialog when prompted to enter network password [CHAR_LIMIT=40] -->
<string name="wifi_wps_nfc_enter_password">Enter your network password</string> <string name="wifi_wps_nfc_enter_password">Enter your network password</string>

View File

@@ -20,6 +20,7 @@ import com.android.settings.R;
import android.content.Context; import android.content.Context;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.graphics.drawable.StateListDrawable;
import android.net.NetworkInfo.DetailedState; import android.net.NetworkInfo.DetailedState;
import android.net.wifi.ScanResult; import android.net.wifi.ScanResult;
import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiConfiguration;
@@ -266,14 +267,17 @@ class AccessPoint extends Preference {
Drawable drawable = getIcon(); Drawable drawable = getIcon();
if (drawable == null) { if (drawable == null) {
drawable = context.getTheme().obtainStyledAttributes( // To avoid a drawing race condition, we first set the state (SECURE/NONE) and then
wifi_signal_attributes).getDrawable(0); // set the icon (drawable) to that state's drawable.
StateListDrawable sld = (StateListDrawable) context.getTheme()
.obtainStyledAttributes(wifi_signal_attributes).getDrawable(0);
sld.setState((security != SECURITY_NONE) ? STATE_SECURED : STATE_NONE);
drawable = sld.getCurrent();
setIcon(drawable); setIcon(drawable);
} }
if (drawable != null) { if (drawable != null) {
drawable.setLevel(level); drawable.setLevel(level);
drawable.setState((security != SECURITY_NONE) ? STATE_SECURED : STATE_NONE);
} }
} }
} }
@@ -554,17 +558,6 @@ class AccessPoint extends Preference {
if (mConfig != null) { // Is saved network if (mConfig != null) { // Is saved network
summary.append(context.getString(R.string.wifi_remembered)); summary.append(context.getString(R.string.wifi_remembered));
} }
// TODO: Wi-Fi team needs to decide what to do with this code.
// if (security != SECURITY_NONE) {
// String securityStrFormat;
// if (summary.length() == 0) {
// securityStrFormat = context.getString(R.string.wifi_secured_first_item);
// } else {
// securityStrFormat = context.getString(R.string.wifi_secured_second_item);
// }
// }
} }
if (WifiSettings.mVerboseLogging > 0) { if (WifiSettings.mVerboseLogging > 0) {