Merge "Report WPS overlap error" into honeycomb
This commit is contained in:
committed by
Android (Google) Code Review
commit
6374d7e2e0
@@ -274,6 +274,25 @@ public class WifiManager {
|
|||||||
* @see #ERROR_AUTHENTICATING
|
* @see #ERROR_AUTHENTICATING
|
||||||
*/
|
*/
|
||||||
public static final String EXTRA_SUPPLICANT_ERROR = "supplicantError";
|
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.
|
* Broadcast intent action indicating that the configured networks changed.
|
||||||
* This can be as a result of adding/updating/deleting a network
|
* This can be as a result of adding/updating/deleting a network
|
||||||
|
|||||||
@@ -53,6 +53,9 @@ public class WifiMonitor {
|
|||||||
private static final String passwordKeyMayBeIncorrectEvent =
|
private static final String passwordKeyMayBeIncorrectEvent =
|
||||||
"pre-shared key may be incorrect";
|
"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
|
* Names of events from wpa_supplicant (minus the prefix). In the
|
||||||
* format descriptions, * "<code>x</code>"
|
* format descriptions, * "<code>x</code>"
|
||||||
@@ -174,6 +177,8 @@ public class WifiMonitor {
|
|||||||
if (eventStr.startsWith(wpaEventPrefix) &&
|
if (eventStr.startsWith(wpaEventPrefix) &&
|
||||||
0 < eventStr.indexOf(passwordKeyMayBeIncorrectEvent)) {
|
0 < eventStr.indexOf(passwordKeyMayBeIncorrectEvent)) {
|
||||||
handlePasswordKeyMayBeIncorrect();
|
handlePasswordKeyMayBeIncorrect();
|
||||||
|
} else if (eventStr.startsWith(wpsOverlapEvent)) {
|
||||||
|
mWifiStateMachine.notifyWpsOverlap();
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -215,6 +215,9 @@ public class WifiStateMachine extends HierarchicalStateMachine {
|
|||||||
static final int SUPPLICANT_STATE_CHANGE_EVENT = 39;
|
static final int SUPPLICANT_STATE_CHANGE_EVENT = 39;
|
||||||
/* Password may be incorrect */
|
/* Password may be incorrect */
|
||||||
static final int PASSWORD_MAY_BE_INCORRECT_EVENT = 40;
|
static final int PASSWORD_MAY_BE_INCORRECT_EVENT = 40;
|
||||||
|
/* WPS overlap detected */
|
||||||
|
static final int WPS_OVERLAP_EVENT = 41;
|
||||||
|
|
||||||
|
|
||||||
/* Supplicant commands */
|
/* Supplicant commands */
|
||||||
/* Is supplicant alive ? */
|
/* Is supplicant alive ? */
|
||||||
@@ -1287,6 +1290,13 @@ public class WifiStateMachine extends HierarchicalStateMachine {
|
|||||||
mContext.sendStickyBroadcast(intent);
|
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() {
|
private void sendLinkConfigurationChangedBroadcast() {
|
||||||
Intent intent = new Intent(WifiManager.LINK_CONFIGURATION_CHANGED_ACTION);
|
Intent intent = new Intent(WifiManager.LINK_CONFIGURATION_CHANGED_ACTION);
|
||||||
intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
|
intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
|
||||||
@@ -1381,6 +1391,14 @@ public class WifiStateMachine extends HierarchicalStateMachine {
|
|||||||
sendMessage(PASSWORD_MAY_BE_INCORRECT_EVENT);
|
sendMessage(PASSWORD_MAY_BE_INCORRECT_EVENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
* Send the tracker a notification that a connection to the supplicant
|
||||||
* daemon has been established.
|
* daemon has been established.
|
||||||
@@ -1499,6 +1517,7 @@ public class WifiStateMachine extends HierarchicalStateMachine {
|
|||||||
case SCAN_RESULTS_EVENT:
|
case SCAN_RESULTS_EVENT:
|
||||||
case SUPPLICANT_STATE_CHANGE_EVENT:
|
case SUPPLICANT_STATE_CHANGE_EVENT:
|
||||||
case PASSWORD_MAY_BE_INCORRECT_EVENT:
|
case PASSWORD_MAY_BE_INCORRECT_EVENT:
|
||||||
|
case WPS_OVERLAP_EVENT:
|
||||||
case CMD_BLACKLIST_NETWORK:
|
case CMD_BLACKLIST_NETWORK:
|
||||||
case CMD_CLEAR_BLACKLIST:
|
case CMD_CLEAR_BLACKLIST:
|
||||||
case CMD_SET_SCAN_MODE:
|
case CMD_SET_SCAN_MODE:
|
||||||
@@ -2042,6 +2061,7 @@ public class WifiStateMachine extends HierarchicalStateMachine {
|
|||||||
case NETWORK_CONNECTION_EVENT:
|
case NETWORK_CONNECTION_EVENT:
|
||||||
case NETWORK_DISCONNECTION_EVENT:
|
case NETWORK_DISCONNECTION_EVENT:
|
||||||
case PASSWORD_MAY_BE_INCORRECT_EVENT:
|
case PASSWORD_MAY_BE_INCORRECT_EVENT:
|
||||||
|
case WPS_OVERLAP_EVENT:
|
||||||
case CMD_SET_SCAN_TYPE:
|
case CMD_SET_SCAN_TYPE:
|
||||||
case CMD_SET_HIGH_PERF_MODE:
|
case CMD_SET_HIGH_PERF_MODE:
|
||||||
case CMD_SET_COUNTRY_CODE:
|
case CMD_SET_COUNTRY_CODE:
|
||||||
@@ -2276,6 +2296,10 @@ public class WifiStateMachine extends HierarchicalStateMachine {
|
|||||||
case PASSWORD_MAY_BE_INCORRECT_EVENT:
|
case PASSWORD_MAY_BE_INCORRECT_EVENT:
|
||||||
mSupplicantStateTracker.sendMessage(PASSWORD_MAY_BE_INCORRECT_EVENT);
|
mSupplicantStateTracker.sendMessage(PASSWORD_MAY_BE_INCORRECT_EVENT);
|
||||||
break;
|
break;
|
||||||
|
case WPS_OVERLAP_EVENT:
|
||||||
|
/* We just need to broadcast the error */
|
||||||
|
sendErrorBroadcast(WifiManager.WPS_OVERLAP_ERROR);
|
||||||
|
break;
|
||||||
case SUPPLICANT_STATE_CHANGE_EVENT:
|
case SUPPLICANT_STATE_CHANGE_EVENT:
|
||||||
stateChangeResult = (StateChangeResult) message.obj;
|
stateChangeResult = (StateChangeResult) message.obj;
|
||||||
SupplicantState state = stateChangeResult.state;
|
SupplicantState state = stateChangeResult.state;
|
||||||
|
|||||||
Reference in New Issue
Block a user