diff options
author | Irfan Sheriff <isheriff@google.com> | 2011-01-13 13:58:39 -0800 |
---|---|---|
committer | Irfan Sheriff <isheriff@google.com> | 2011-01-14 09:43:13 -0800 |
commit | dee5b268925641c2e8f6280ce817fafa7e76d953 (patch) | |
tree | 38c5e00dcb39962114d87d9ad00c1756472f654c /src | |
parent | ec0be8ce2e70041f6133cbe68afcfd561eb4a30d (diff) | |
download | packages_apps_Settings-dee5b268925641c2e8f6280ce817fafa7e76d953.zip packages_apps_Settings-dee5b268925641c2e8f6280ce817fafa7e76d953.tar.gz packages_apps_Settings-dee5b268925641c2e8f6280ce817fafa7e76d953.tar.bz2 |
Add feedback dialogs for WPS
Upon failure or an existing WPS session,
a dialog message is conveyed to the user
Bug: 3316078
Change-Id: Ibcf27e21058970f8f1667061c7654948c690d48e
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/settings/wifi/WifiSettings.java | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java index 857e153..c0b6da3 100644 --- a/src/com/android/settings/wifi/WifiSettings.java +++ b/src/com/android/settings/wifi/WifiSettings.java @@ -37,7 +37,9 @@ import android.net.wifi.SupplicantState; import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; +import android.net.wifi.WpsResult; import android.net.wifi.WifiConfiguration.KeyMgmt; +import android.net.wifi.WpsConfiguration; import android.os.Bundle; import android.os.Handler; import android.os.Message; @@ -569,18 +571,32 @@ public class WifiSettings extends SettingsPreferenceFragment } /* package */ void submit(WifiConfigController configController) { - switch(configController.chosenNetworkSetupMethod()) { + int networkSetup = configController.chosenNetworkSetupMethod(); + switch(networkSetup) { case WifiConfigController.WPS_PBC: case WifiConfigController.WPS_PIN_FROM_ACCESS_POINT: - mWifiManager.startWps(configController.getWpsConfig()); - break; case WifiConfigController.WPS_PIN_FROM_DEVICE: - String pin = mWifiManager.startWps(configController.getWpsConfig()); - new AlertDialog.Builder(getActivity()) - .setTitle(R.string.wifi_wps_pin_method_configuration) - .setMessage(getResources().getString(R.string.wifi_wps_pin_output, pin)) - .setPositiveButton(android.R.string.ok, null) - .show(); + WpsResult result = mWifiManager.startWps(configController.getWpsConfig()); + AlertDialog.Builder dialog = new AlertDialog.Builder(getActivity()) + .setTitle(R.string.wifi_wps_setup_title) + .setPositiveButton(android.R.string.ok, null); + switch (result.status) { + case FAILURE: + dialog.setMessage(R.string.wifi_wps_failed); + dialog.show(); + break; + case IN_PROGRESS: + dialog.setMessage(R.string.wifi_wps_in_progress); + dialog.show(); + break; + default: + if (networkSetup == WifiConfigController.WPS_PIN_FROM_DEVICE) { + dialog.setMessage(getResources().getString(R.string.wifi_wps_pin_output, + result.pin)); + dialog.show(); + } + break; + } break; case WifiConfigController.MANUAL: final WifiConfiguration config = configController.getConfig(); |