diff options
Diffstat (limited to 'wifi/java/android')
-rw-r--r-- | wifi/java/android/net/wifi/WifiManager.java | 19 | ||||
-rw-r--r-- | wifi/java/android/net/wifi/WifiMonitor.java | 5 | ||||
-rw-r--r-- | wifi/java/android/net/wifi/WifiStateMachine.java | 24 |
3 files changed, 48 insertions, 0 deletions
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java index 54887d7..d05918f 100644 --- a/wifi/java/android/net/wifi/WifiManager.java +++ b/wifi/java/android/net/wifi/WifiManager.java @@ -274,6 +274,25 @@ public class WifiManager { * @see #ERROR_AUTHENTICATING */ public static final String EXTRA_SUPPLICANT_ERROR = "supplicantError"; + + /** + * Broadcast intent action for reporting errors + * @hide + */ + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String ERROR_ACTION = "android.net.wifi.ERROR"; + /** + * The type of error being reported + * @hide + */ + public static final String EXTRA_ERROR_CODE = "errorCode"; + + /** + * Valid error codes + * @hide + */ + public static final int WPS_OVERLAP_ERROR = 1; + /** * Broadcast intent action indicating that the configured networks changed. * This can be as a result of adding/updating/deleting a network diff --git a/wifi/java/android/net/wifi/WifiMonitor.java b/wifi/java/android/net/wifi/WifiMonitor.java index 934e509..090ad3b 100644 --- a/wifi/java/android/net/wifi/WifiMonitor.java +++ b/wifi/java/android/net/wifi/WifiMonitor.java @@ -53,6 +53,9 @@ public class WifiMonitor { private static final String passwordKeyMayBeIncorrectEvent = "pre-shared key may be incorrect"; + /* WPS events */ + private static final String wpsOverlapEvent = "WPS-OVERLAP-DETECTED"; + /** * Names of events from wpa_supplicant (minus the prefix). In the * format descriptions, * "<code>x</code>" @@ -174,6 +177,8 @@ public class WifiMonitor { if (eventStr.startsWith(wpaEventPrefix) && 0 < eventStr.indexOf(passwordKeyMayBeIncorrectEvent)) { handlePasswordKeyMayBeIncorrect(); + } else if (eventStr.startsWith(wpsOverlapEvent)) { + mWifiStateMachine.notifyWpsOverlap(); } continue; } diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java index d7d86f0..0548b4d 100644 --- a/wifi/java/android/net/wifi/WifiStateMachine.java +++ b/wifi/java/android/net/wifi/WifiStateMachine.java @@ -215,6 +215,9 @@ public class WifiStateMachine extends HierarchicalStateMachine { static final int SUPPLICANT_STATE_CHANGE_EVENT = 39; /* Password may be incorrect */ static final int PASSWORD_MAY_BE_INCORRECT_EVENT = 40; + /* WPS overlap detected */ + static final int WPS_OVERLAP_EVENT = 41; + /* Supplicant commands */ /* Is supplicant alive ? */ @@ -1287,6 +1290,13 @@ public class WifiStateMachine extends HierarchicalStateMachine { mContext.sendStickyBroadcast(intent); } + private void sendErrorBroadcast(int errorCode) { + Intent intent = new Intent(WifiManager.ERROR_ACTION); + intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); + intent.putExtra(WifiManager.EXTRA_ERROR_CODE, errorCode); + mContext.sendBroadcast(intent); + } + private void sendLinkConfigurationChangedBroadcast() { Intent intent = new Intent(WifiManager.LINK_CONFIGURATION_CHANGED_ACTION); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); @@ -1382,6 +1392,14 @@ public class WifiStateMachine extends HierarchicalStateMachine { } /** + * Send a notification that the supplicant has detected overlapped + * WPS sessions + */ + void notifyWpsOverlap() { + sendMessage(WPS_OVERLAP_EVENT); + } + + /** * Send the tracker a notification that a connection to the supplicant * daemon has been established. */ @@ -1499,6 +1517,7 @@ public class WifiStateMachine extends HierarchicalStateMachine { case SCAN_RESULTS_EVENT: case SUPPLICANT_STATE_CHANGE_EVENT: case PASSWORD_MAY_BE_INCORRECT_EVENT: + case WPS_OVERLAP_EVENT: case CMD_BLACKLIST_NETWORK: case CMD_CLEAR_BLACKLIST: case CMD_SET_SCAN_MODE: @@ -2042,6 +2061,7 @@ public class WifiStateMachine extends HierarchicalStateMachine { case NETWORK_CONNECTION_EVENT: case NETWORK_DISCONNECTION_EVENT: case PASSWORD_MAY_BE_INCORRECT_EVENT: + case WPS_OVERLAP_EVENT: case CMD_SET_SCAN_TYPE: case CMD_SET_HIGH_PERF_MODE: case CMD_SET_COUNTRY_CODE: @@ -2276,6 +2296,10 @@ public class WifiStateMachine extends HierarchicalStateMachine { case PASSWORD_MAY_BE_INCORRECT_EVENT: mSupplicantStateTracker.sendMessage(PASSWORD_MAY_BE_INCORRECT_EVENT); break; + case WPS_OVERLAP_EVENT: + /* We just need to broadcast the error */ + sendErrorBroadcast(WifiManager.WPS_OVERLAP_ERROR); + break; case SUPPLICANT_STATE_CHANGE_EVENT: stateChangeResult = (StateChangeResult) message.obj; SupplicantState state = stateChangeResult.state; |