Skip to content

Commit 56379d2

Browse files
committed
Handle unexpected interface up/down events
WEXT on crespo has an issue where the interface up/down events can happen in an unexpected fashion. At a driver start, we can go from interface disabled to interface enabled, back to interface disabled and then eventually into an interface enabled state. Earlier, we were just expecting a single interface enable event that would trigger driver specific commands. Now, we just handle these events as individual driver stop and driver start situations so that we do appropriate things eventually Bug: 5239853 Change-Id: I6bd5d844edf9fadfdca4e8eb753c2ba738aa6ad5
1 parent 5390260 commit 56379d2

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

wifi/java/android/net/wifi/WifiStateMachine.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2597,6 +2597,15 @@ public void enter() {
25972597
public boolean processMessage(Message message) {
25982598
if (DBG) log(getName() + message.toString() + "\n");
25992599
switch (message.what) {
2600+
case WifiMonitor.SUPPLICANT_STATE_CHANGE_EVENT:
2601+
StateChangeResult stateChangeResult = (StateChangeResult) message.obj;
2602+
SupplicantState state = stateChangeResult.state;
2603+
// A WEXT bug means that we can be back to driver started state
2604+
// unexpectedly
2605+
if (SupplicantState.isDriverActive(state)) {
2606+
transitionTo(mDriverStartedState);
2607+
}
2608+
break;
26002609
case CMD_START_DRIVER:
26012610
mWakeLock.acquire();
26022611
WifiNative.startDriverCommand();
@@ -2667,8 +2676,18 @@ public boolean processMessage(Message message) {
26672676
sendErrorBroadcast(WifiManager.WPS_OVERLAP_ERROR);
26682677
break;
26692678
case WifiMonitor.SUPPLICANT_STATE_CHANGE_EVENT:
2670-
handleSupplicantStateChange(message);
2671-
break;
2679+
SupplicantState state = handleSupplicantStateChange(message);
2680+
// Due to a WEXT bug, during the time of driver start/stop
2681+
// we can go into a driver stopped state in an unexpected way.
2682+
// The sequence eventually puts interface
2683+
// up and we should be back to a connected state
2684+
if (!SupplicantState.isDriverActive(state)) {
2685+
if (mNetworkInfo.getState() != NetworkInfo.State.DISCONNECTED) {
2686+
handleNetworkDisconnect();
2687+
}
2688+
transitionTo(mDriverStoppedState);
2689+
}
2690+
break;
26722691
/* Do a redundant disconnect without transition */
26732692
case CMD_DISCONNECT:
26742693
WifiNative.disconnectCommand();

0 commit comments

Comments
 (0)