summaryrefslogtreecommitdiffstats
path: root/wifi
diff options
context:
space:
mode:
authorDmitry Shmidt <dimitrysh%android.com@gtempaccount.com>2013-05-10 15:57:02 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-05-10 15:57:02 -0700
commit509b51aa2560d47bcf64d63a1347b7ba8136450e (patch)
treea3518a5183dfe8a89abd5f3389d9fb2d1af7b5e6 /wifi
parentae925f62b9bb582384408c269427215e4cbeb531 (diff)
parent00ee47ead451ee2584c23f15a3760ae041e82e56 (diff)
downloadframeworks_base-509b51aa2560d47bcf64d63a1347b7ba8136450e.zip
frameworks_base-509b51aa2560d47bcf64d63a1347b7ba8136450e.tar.gz
frameworks_base-509b51aa2560d47bcf64d63a1347b7ba8136450e.tar.bz2
am 00ee47ea: Merge "framework/base: Handle ASSOC-REJECT events"
* commit '00ee47ead451ee2584c23f15a3760ae041e82e56': framework/base: Handle ASSOC-REJECT events
Diffstat (limited to 'wifi')
-rw-r--r--wifi/java/android/net/wifi/SupplicantStateTracker.java26
-rw-r--r--wifi/java/android/net/wifi/WifiConfiguration.java2
-rw-r--r--wifi/java/android/net/wifi/WifiMonitor.java14
-rw-r--r--wifi/java/android/net/wifi/WifiStateMachine.java8
4 files changed, 45 insertions, 5 deletions
diff --git a/wifi/java/android/net/wifi/SupplicantStateTracker.java b/wifi/java/android/net/wifi/SupplicantStateTracker.java
index f7fc795..f6a621f 100644
--- a/wifi/java/android/net/wifi/SupplicantStateTracker.java
+++ b/wifi/java/android/net/wifi/SupplicantStateTracker.java
@@ -45,6 +45,7 @@ class SupplicantStateTracker extends StateMachine {
private WifiStateMachine mWifiStateMachine;
private WifiConfigStore mWifiConfigStore;
private int mAuthenticationFailuresCount = 0;
+ private int mAssociationRejectCount = 0;
/* Indicates authentication failure in supplicant broadcast.
* TODO: enhance auth failure reporting to include notification
* for all type of failures: EAP, WPS & WPA networks */
@@ -53,6 +54,9 @@ class SupplicantStateTracker extends StateMachine {
/* Maximum retries on a authentication failure notification */
private static final int MAX_RETRIES_ON_AUTHENTICATION_FAILURE = 2;
+ /* Maximum retries on assoc rejection events */
+ private static final int MAX_RETRIES_ON_ASSOCIATION_REJECT = 4;
+
/* Tracks if networks have been disabled during a connection */
private boolean mNetworksDisabledDuringConnect = false;
@@ -89,14 +93,14 @@ class SupplicantStateTracker extends StateMachine {
start();
}
- private void handleNetworkConnectionFailure(int netId) {
+ private void handleNetworkConnectionFailure(int netId, int disableReason) {
/* If other networks disabled during connection, enable them */
if (mNetworksDisabledDuringConnect) {
mWifiConfigStore.enableAllNetworks();
mNetworksDisabledDuringConnect = false;
}
/* Disable failed network */
- mWifiConfigStore.disableNetwork(netId, WifiConfiguration.DISABLED_AUTH_FAILURE);
+ mWifiConfigStore.disableNetwork(netId, disableReason);
}
private void transitionOnSupplicantStateChange(StateChangeResult stateChangeResult) {
@@ -182,6 +186,10 @@ class SupplicantStateTracker extends StateMachine {
break;
case WifiManager.CONNECT_NETWORK:
mNetworksDisabledDuringConnect = true;
+ mAssociationRejectCount = 0;
+ break;
+ case WifiMonitor.ASSOCIATION_REJECTION_EVENT:
+ mAssociationRejectCount++;
break;
default:
Log.e(TAG, "Ignoring " + message);
@@ -226,9 +234,17 @@ class SupplicantStateTracker extends StateMachine {
if (mAuthenticationFailuresCount >= MAX_RETRIES_ON_AUTHENTICATION_FAILURE) {
Log.d(TAG, "Failed to authenticate, disabling network " +
stateChangeResult.networkId);
- handleNetworkConnectionFailure(stateChangeResult.networkId);
+ handleNetworkConnectionFailure(stateChangeResult.networkId,
+ WifiConfiguration.DISABLED_AUTH_FAILURE);
mAuthenticationFailuresCount = 0;
}
+ else if (mAssociationRejectCount >= MAX_RETRIES_ON_ASSOCIATION_REJECT) {
+ Log.d(TAG, "Association getting rejected, disabling network " +
+ stateChangeResult.networkId);
+ handleNetworkConnectionFailure(stateChangeResult.networkId,
+ WifiConfiguration.DISABLED_ASSOCIATION_REJECT);
+ mAssociationRejectCount = 0;
+ }
}
}
@@ -268,7 +284,8 @@ class SupplicantStateTracker extends StateMachine {
if (mLoopDetectCount > MAX_SUPPLICANT_LOOP_ITERATIONS) {
Log.d(TAG, "Supplicant loop detected, disabling network " +
stateChangeResult.networkId);
- handleNetworkConnectionFailure(stateChangeResult.networkId);
+ handleNetworkConnectionFailure(stateChangeResult.networkId,
+ WifiConfiguration.DISABLED_AUTH_FAILURE);
}
mLoopDetectIndex = state.ordinal();
sendSupplicantStateChangedBroadcast(state,
@@ -291,6 +308,7 @@ class SupplicantStateTracker extends StateMachine {
if (DBG) Log.d(TAG, getName() + "\n");
/* Reset authentication failure count */
mAuthenticationFailuresCount = 0;
+ mAssociationRejectCount = 0;
if (mNetworksDisabledDuringConnect) {
mWifiConfigStore.enableAllNetworks();
mNetworksDisabledDuringConnect = false;
diff --git a/wifi/java/android/net/wifi/WifiConfiguration.java b/wifi/java/android/net/wifi/WifiConfiguration.java
index b971fc3..bd8f0eb 100644
--- a/wifi/java/android/net/wifi/WifiConfiguration.java
+++ b/wifi/java/android/net/wifi/WifiConfiguration.java
@@ -173,6 +173,8 @@ public class WifiConfiguration implements Parcelable {
public static final int DISABLED_DHCP_FAILURE = 2;
/** @hide */
public static final int DISABLED_AUTH_FAILURE = 3;
+ /** @hide */
+ public static final int DISABLED_ASSOCIATION_REJECT = 4;
/**
* The ID number that the supplicant uses to identify this
diff --git a/wifi/java/android/net/wifi/WifiMonitor.java b/wifi/java/android/net/wifi/WifiMonitor.java
index 0b0d738..fe3c709 100644
--- a/wifi/java/android/net/wifi/WifiMonitor.java
+++ b/wifi/java/android/net/wifi/WifiMonitor.java
@@ -56,7 +56,8 @@ public class WifiMonitor {
private static final int TERMINATING = 6;
private static final int DRIVER_STATE = 7;
private static final int EAP_FAILURE = 8;
- private static final int UNKNOWN = 9;
+ private static final int ASSOC_REJECT = 9;
+ private static final int UNKNOWN = 10;
/** All events coming from the supplicant start with this prefix */
private static final String EVENT_PREFIX_STR = "CTRL-EVENT-";
@@ -153,6 +154,11 @@ public class WifiMonitor {
private static final String EAP_AUTH_FAILURE_STR = "EAP authentication failed";
/**
+ * This indicates an assoc reject event
+ */
+ private static final String ASSOC_REJECT_STR = "ASSOC-REJECT";
+
+ /**
* Regex pattern for extracting an Ethernet-style MAC address from a string.
* Matches a strings like the following:<pre>
* CTRL-EVENT-CONNECTED - Connection to 00:1e:58:ec:d5:6d completed (reauth) [id=1 id_str=]</pre>
@@ -328,6 +334,8 @@ public class WifiMonitor {
public static final int AP_STA_DISCONNECTED_EVENT = BASE + 41;
public static final int AP_STA_CONNECTED_EVENT = BASE + 42;
+ /* Indicates assoc reject event */
+ public static final int ASSOCIATION_REJECTION_EVENT = BASE + 43;
/**
* This indicates the supplicant connection for the monitor is closed
*/
@@ -429,6 +437,8 @@ public class WifiMonitor {
event = DRIVER_STATE;
else if (eventName.equals(EAP_FAILURE_STR))
event = EAP_FAILURE;
+ else if (eventName.equals(ASSOC_REJECT_STR))
+ event = ASSOC_REJECT;
else
event = UNKNOWN;
@@ -473,6 +483,8 @@ public class WifiMonitor {
if (eventData.startsWith(EAP_AUTH_FAILURE_STR)) {
mStateMachine.sendMessage(AUTHENTICATION_FAILURE_EVENT);
}
+ } else if (event == ASSOC_REJECT) {
+ mStateMachine.sendMessage(ASSOCIATION_REJECTION_EVENT);
} else {
handleEvent(event, eventData);
}
diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java
index 9cae2cb..81efd1c 100644
--- a/wifi/java/android/net/wifi/WifiStateMachine.java
+++ b/wifi/java/android/net/wifi/WifiStateMachine.java
@@ -1915,6 +1915,7 @@ public class WifiStateMachine extends StateMachine {
case WifiMonitor.SCAN_RESULTS_EVENT:
case WifiMonitor.SUPPLICANT_STATE_CHANGE_EVENT:
case WifiMonitor.AUTHENTICATION_FAILURE_EVENT:
+ case WifiMonitor.ASSOCIATION_REJECTION_EVENT:
case WifiMonitor.WPS_OVERLAP_EVENT:
case CMD_BLACKLIST_NETWORK:
case CMD_CLEAR_BLACKLIST:
@@ -2332,6 +2333,7 @@ public class WifiStateMachine extends StateMachine {
case WifiMonitor.NETWORK_CONNECTION_EVENT:
case WifiMonitor.NETWORK_DISCONNECTION_EVENT:
case WifiMonitor.AUTHENTICATION_FAILURE_EVENT:
+ case WifiMonitor.ASSOCIATION_REJECTION_EVENT:
case WifiMonitor.WPS_OVERLAP_EVENT:
case CMD_SET_COUNTRY_CODE:
case CMD_SET_FREQUENCY_BAND:
@@ -2697,6 +2699,9 @@ public class WifiStateMachine extends StateMachine {
WifiConfiguration config;
boolean ok;
switch(message.what) {
+ case WifiMonitor.ASSOCIATION_REJECTION_EVENT:
+ mSupplicantStateTracker.sendMessage(WifiMonitor.ASSOCIATION_REJECTION_EVENT);
+ break;
case WifiMonitor.AUTHENTICATION_FAILURE_EVENT:
mSupplicantStateTracker.sendMessage(WifiMonitor.AUTHENTICATION_FAILURE_EVENT);
break;
@@ -3426,6 +3431,9 @@ public class WifiStateMachine extends StateMachine {
if (DBG) log("Network connection lost");
handleNetworkDisconnect();
break;
+ case WifiMonitor.ASSOCIATION_REJECTION_EVENT:
+ if (DBG) log("Ignore Assoc reject event during WPS Connection");
+ break;
case WifiMonitor.AUTHENTICATION_FAILURE_EVENT:
// Disregard auth failure events during WPS connection. The
// EAP sequence is retried several times, and there might be