Add UI to report WPS overlap error

Bug: 3354319
Change-Id: I4584bc3a820ace1232026920c4dc29e6b273461c
This commit is contained in:
Irfan Sheriff
2011-01-16 10:51:49 -08:00
parent 4de7499d7c
commit 6377e47f8b
2 changed files with 15 additions and 2 deletions

View File

@@ -1013,6 +1013,10 @@
<!-- Button label to dismiss the dialog --> <!-- Button label to dismiss the dialog -->
<string name="wifi_cancel">Cancel</string> <string name="wifi_cancel">Cancel</string>
<!-- Errors reported on wifi settings page -->
<!-- Toast message indicating WPS overlap detection [CHAR LIMIT=75] -->
<string name="wifi_wps_overlap_error">Another WPS session detected, please retry in a few minutes</string>
<!-- Wi-Fi Advanced Settings --> <skip /> <!-- Wi-Fi Advanced Settings --> <skip />
<!-- Wi-Fi settings screen, advanced, settings section. This is a header shown above advanced wifi settings. --> <!-- Wi-Fi settings screen, advanced, settings section. This is a header shown above advanced wifi settings. -->
<string name="wifi_advanced_titlebar">Advanced</string> <string name="wifi_advanced_titlebar">Advanced</string>

View File

@@ -128,11 +128,12 @@ public class WifiSettings extends SettingsPreferenceFragment
mFilter.addAction(WifiManager.LINK_CONFIGURATION_CHANGED_ACTION); mFilter.addAction(WifiManager.LINK_CONFIGURATION_CHANGED_ACTION);
mFilter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION); mFilter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION);
mFilter.addAction(WifiManager.RSSI_CHANGED_ACTION); mFilter.addAction(WifiManager.RSSI_CHANGED_ACTION);
mFilter.addAction(WifiManager.ERROR_ACTION);
mReceiver = new BroadcastReceiver() { mReceiver = new BroadcastReceiver() {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
handleEvent(intent); handleEvent(context, intent);
} }
}; };
@@ -430,7 +431,7 @@ public class WifiSettings extends SettingsPreferenceFragment
return accessPoints; return accessPoints;
} }
private void handleEvent(Intent intent) { private void handleEvent(Context context, Intent intent) {
String action = intent.getAction(); String action = intent.getAction();
if (WifiManager.WIFI_STATE_CHANGED_ACTION.equals(action)) { if (WifiManager.WIFI_STATE_CHANGED_ACTION.equals(action)) {
updateWifiState(intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE, updateWifiState(intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE,
@@ -462,6 +463,14 @@ public class WifiSettings extends SettingsPreferenceFragment
updateConnectionState(info.getDetailedState()); updateConnectionState(info.getDetailedState());
} else if (WifiManager.RSSI_CHANGED_ACTION.equals(action)) { } else if (WifiManager.RSSI_CHANGED_ACTION.equals(action)) {
updateConnectionState(null); updateConnectionState(null);
} else if (WifiManager.ERROR_ACTION.equals(action)) {
int errorCode = intent.getIntExtra(WifiManager.EXTRA_ERROR_CODE, 0);
switch (errorCode) {
case WifiManager.WPS_OVERLAP_ERROR:
Toast.makeText(context, R.string.wifi_wps_overlap_error,
Toast.LENGTH_SHORT).show();
break;
}
} }
} }