summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/wifi/AccessPoint.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/settings/wifi/AccessPoint.java')
-rw-r--r--src/com/android/settings/wifi/AccessPoint.java43
1 files changed, 22 insertions, 21 deletions
diff --git a/src/com/android/settings/wifi/AccessPoint.java b/src/com/android/settings/wifi/AccessPoint.java
index b3fafa4..ac818a7 100644
--- a/src/com/android/settings/wifi/AccessPoint.java
+++ b/src/com/android/settings/wifi/AccessPoint.java
@@ -20,6 +20,7 @@ import com.android.settings.R;
import android.content.Context;
import android.graphics.drawable.Drawable;
+import android.graphics.drawable.StateListDrawable;
import android.net.NetworkInfo.DetailedState;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiConfiguration;
@@ -266,14 +267,21 @@ class AccessPoint extends Preference {
Drawable drawable = getIcon();
if (drawable == null) {
- drawable = context.getTheme().obtainStyledAttributes(
- wifi_signal_attributes).getDrawable(0);
- setIcon(drawable);
+ // To avoid a drawing race condition, we first set the state (SECURE/NONE) and then
+ // set the icon (drawable) to that state's drawable.
+ StateListDrawable sld = (StateListDrawable) context.getTheme()
+ .obtainStyledAttributes(wifi_signal_attributes).getDrawable(0);
+ // If sld is null then we are indexing and therefore do not have access to
+ // (nor need to display) the drawable.
+ if (sld != null) {
+ sld.setState((security != SECURITY_NONE) ? STATE_SECURED : STATE_NONE);
+ drawable = sld.getCurrent();
+ setIcon(drawable);
+ }
}
if (drawable != null) {
drawable.setLevel(level);
- drawable.setState((security != SECURITY_NONE) ? STATE_SECURED : STATE_NONE);
}
}
}
@@ -452,7 +460,7 @@ class AccessPoint extends Preference {
if (result.seen == 0)
continue;
- if (result.status != ScanResult.ENABLED)
+ if (result.autoJoinStatus != ScanResult.ENABLED)
numBlackListed++;
if (result.frequency > LOWER_FREQ_5GHZ
@@ -520,6 +528,10 @@ class AccessPoint extends Preference {
final Context context = getContext();
updateIcon(getLevel(), context);
+ // Force new summary
+ setSummary(null);
+
+ // Update to new summary
StringBuilder summary = new StringBuilder();
if (mState != null) { // This is the active connection
@@ -550,21 +562,6 @@ class AccessPoint extends Preference {
if (mConfig != null) { // Is saved network
summary.append(context.getString(R.string.wifi_remembered));
}
-
- 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);
- }
- }
-
- }
-
- // This is a workaround, see bug report...
- if (summary.length() < 1) {
- summary.append(" ");
}
if (WifiSettings.mVerboseLogging > 0) {
@@ -591,7 +588,11 @@ class AccessPoint extends Preference {
}
}
- setSummary(summary.toString());
+ if (summary.length() > 0) {
+ setSummary(summary.toString());
+ } else {
+ showSummary = false;
+ }
}
/**