diff options
author | Christopher Wiley <wiley@google.com> | 2016-08-05 17:32:01 -0700 |
---|---|---|
committer | Christopher Wiley <wiley@google.com> | 2016-08-10 16:18:16 -0700 |
commit | 8b84cf53d7f1ed263b0bfa1966160677c2ef3d14 (patch) | |
tree | bbd9b311478f188978e389d7a87667d23dbd6368 /service | |
parent | a4fbb5f3e68204a07939a8b544693d6899beb3ed (diff) |
Remove dead code related to stopping/starting driver
Bug: 30764863
Test: unittests pass on bullhead and upcoming devices
Test: WiFi continues to be able to connect/disconnect on bullhead
Change-Id: I0bded8709ffb329a1df9c37a28872c58132254f3
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/WifiNative.java | 9 | ||||
-rw-r--r-- | service/java/com/android/server/wifi/WifiStateMachine.java | 215 |
2 files changed, 3 insertions, 221 deletions
diff --git a/service/java/com/android/server/wifi/WifiNative.java b/service/java/com/android/server/wifi/WifiNative.java index b03046bbc..0bba2224c 100644 --- a/service/java/com/android/server/wifi/WifiNative.java +++ b/service/java/com/android/server/wifi/WifiNative.java @@ -743,15 +743,6 @@ public class WifiNative { return doStringCommand("BSS " + bssid); } - public boolean startDriver() { - return doBooleanCommand("DRIVER START"); - } - - public boolean stopDriver() { - return doBooleanCommand("DRIVER STOP"); - } - - /** * Start filtering out Multicast V4 packets * @return {@code true} if the operation succeeded, {@code false} otherwise diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java index 773c6d495..66af1c9f9 100644 --- a/service/java/com/android/server/wifi/WifiStateMachine.java +++ b/service/java/com/android/server/wifi/WifiStateMachine.java @@ -321,14 +321,6 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss private int mSupplicantStopFailureToken = 0; /** - * Driver start time out. - */ - private static final int DRIVER_START_TIME_OUT_MSECS = 10000; - - /* Tracks sequence number on a driver time out */ - private int mDriverStartToken = 0; - - /** * The link properties of the wifi interface. * Do not modify this directly; use updateLinkProperties instead. */ @@ -548,10 +540,6 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss static final int CMD_START_SUPPLICANT = BASE + 11; /* Stop the supplicant */ static final int CMD_STOP_SUPPLICANT = BASE + 12; - /* Start the driver */ - static final int CMD_START_DRIVER = BASE + 13; - /* Stop the driver */ - static final int CMD_STOP_DRIVER = BASE + 14; /* Indicates Static IP succeeded */ static final int CMD_STATIC_IP_SUCCESS = BASE + 15; /* Indicates Static IP failed */ @@ -848,19 +836,11 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss private State mSupplicantStartedState = new SupplicantStartedState(); /* Waiting for supplicant to stop and monitor to exit */ private State mSupplicantStoppingState = new SupplicantStoppingState(); - /* Driver start issued, waiting for completed event */ - private State mDriverStartingState = new DriverStartingState(); - /* Driver started */ - private State mDriverStartedState = new DriverStartedState(); /* Wait until p2p is disabled * This is a special state which is entered right after we exit out of DriverStartedState * before transitioning to another state. */ private State mWaitForP2pDisableState = new WaitForP2pDisableState(); - /* Driver stopping */ - private State mDriverStoppingState = new DriverStoppingState(); - /* Driver stopped */ - private State mDriverStoppedState = new DriverStoppedState(); /* Scan for networks, no connection will be established */ private State mScanModeState = new ScanModeState(); /* Connecting to an access point */ @@ -1077,10 +1057,8 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss addState(mInitialState, mDefaultState); addState(mSupplicantStartingState, mDefaultState); addState(mSupplicantStartedState, mDefaultState); - addState(mDriverStartingState, mSupplicantStartedState); - addState(mDriverStartedState, mSupplicantStartedState); - addState(mScanModeState, mDriverStartedState); - addState(mConnectModeState, mDriverStartedState); + addState(mScanModeState, mSupplicantStartedState); + addState(mConnectModeState, mSupplicantStartedState); addState(mL2ConnectedState, mConnectModeState); addState(mObtainingIpState, mL2ConnectedState); addState(mConnectedState, mL2ConnectedState); @@ -1089,8 +1067,6 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss addState(mDisconnectedState, mConnectModeState); addState(mWpsRunningState, mConnectModeState); addState(mWaitForP2pDisableState, mSupplicantStartedState); - addState(mDriverStoppingState, mSupplicantStartedState); - addState(mDriverStoppedState, mSupplicantStartedState); addState(mSupplicantStoppingState, mDefaultState); addState(mSoftApState, mDefaultState); // CHECKSTYLE:ON IndentationCheck @@ -3850,8 +3826,6 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss case CMD_START_SUPPLICANT: case CMD_STOP_SUPPLICANT: case CMD_STOP_SUPPLICANT_FAILED: - case CMD_START_DRIVER: - case CMD_STOP_DRIVER: case CMD_DRIVER_START_TIMED_OUT: case CMD_START_AP: case CMD_START_AP_FAILURE: @@ -4224,8 +4198,6 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss case CMD_STOP_SUPPLICANT: case CMD_START_AP: case CMD_STOP_AP: - case CMD_START_DRIVER: - case CMD_STOP_DRIVER: case CMD_SET_OPERATIONAL_MODE: case CMD_SET_FREQUENCY_BAND: messageHandlingStatus = MESSAGE_HANDLING_STATUS_DEFERRED; @@ -4602,8 +4574,6 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss case CMD_STOP_SUPPLICANT: case CMD_START_AP: case CMD_STOP_AP: - case CMD_START_DRIVER: - case CMD_STOP_DRIVER: case CMD_SET_OPERATIONAL_MODE: case CMD_SET_FREQUENCY_BAND: deferMessage(message); @@ -4615,120 +4585,6 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss } } - class DriverStartingState extends State { - private int mTries; - @Override - public void enter() { - mTries = 1; - /* Send ourselves a delayed message to start driver a second time */ - sendMessageDelayed(obtainMessage(CMD_DRIVER_START_TIMED_OUT, - ++mDriverStartToken, 0), DRIVER_START_TIME_OUT_MSECS); - } - @Override - public boolean processMessage(Message message) { - logStateAndMessage(message, this); - - switch(message.what) { - case WifiMonitor.SUPPLICANT_STATE_CHANGE_EVENT: - SupplicantState state = handleSupplicantStateChange(message); - /* If supplicant is exiting out of INTERFACE_DISABLED state into - * a state that indicates driver has started, it is ready to - * receive driver commands - */ - if (SupplicantState.isDriverActive(state)) { - transitionTo(mDriverStartedState); - } - break; - case CMD_DRIVER_START_TIMED_OUT: - if (message.arg1 == mDriverStartToken) { - if (mTries >= 2) { - loge("Failed to start driver after " + mTries); - setSupplicantRunning(false); - setSupplicantRunning(true); - } else { - loge("Driver start failed, retrying"); - mWakeLock.acquire(); - mWifiNative.startDriver(); - mWakeLock.release(); - - ++mTries; - /* Send ourselves a delayed message to start driver again */ - sendMessageDelayed(obtainMessage(CMD_DRIVER_START_TIMED_OUT, - ++mDriverStartToken, 0), DRIVER_START_TIME_OUT_MSECS); - } - } - break; - /* Queue driver commands & connection events */ - case CMD_START_DRIVER: - case CMD_STOP_DRIVER: - 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_FREQUENCY_BAND: - case CMD_START_SCAN: - case CMD_DISCONNECT: - case CMD_REASSOCIATE: - case CMD_RECONNECT: - messageHandlingStatus = MESSAGE_HANDLING_STATUS_DEFERRED; - deferMessage(message); - break; - case WifiMonitor.SCAN_RESULTS_EVENT: - case WifiMonitor.SCAN_FAILED_EVENT: - // Loose scan results obtained in Driver Starting state, they can only confuse - // the state machine - break; - default: - return NOT_HANDLED; - } - return HANDLED; - } - } - - class DriverStartedState extends State { - @Override - public void enter() { - } - - @Override - public boolean processMessage(Message message) { - logStateAndMessage(message, this); - - switch(message.what) { - case CMD_STOP_DRIVER: - log("stop driver"); - mWifiConfigManager.disableAllNetworksNative(); - - if (getCurrentState() != mDisconnectedState) { - mWifiNative.disconnect(); - handleNetworkDisconnect(); - } - mWakeLock.acquire(); - mWifiNative.stopDriver(); - mWakeLock.release(); - if (mP2pSupported) { - transitionTo(mWaitForP2pDisableState); - } else { - transitionTo(mDriverStoppingState); - } - break; - case CMD_START_DRIVER: - if (mOperationalMode == CONNECT_MODE) { - mWifiConfigManager.enableAllNetworks(); - } - break; - default: - return NOT_HANDLED; - } - return HANDLED; - } - - @Override - public void exit() { - } - } - class WaitForP2pDisableState extends State { private State mTransitionToState; @Override @@ -4737,14 +4593,9 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss case WifiMonitor.SUP_DISCONNECTION_EVENT: mTransitionToState = mInitialState; break; - case CMD_STOP_DRIVER: - mTransitionToState = mDriverStoppingState; - break; case CMD_STOP_SUPPLICANT: - mTransitionToState = mSupplicantStoppingState; - break; default: - mTransitionToState = mDriverStoppingState; + mTransitionToState = mSupplicantStoppingState; break; } p2pSendMessage(WifiStateMachine.CMD_DISABLE_P2P_REQ); @@ -4763,8 +4614,6 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss case CMD_STOP_SUPPLICANT: case CMD_START_AP: case CMD_STOP_AP: - case CMD_START_DRIVER: - case CMD_STOP_DRIVER: case CMD_SET_OPERATIONAL_MODE: case CMD_SET_FREQUENCY_BAND: case CMD_START_SCAN: @@ -4781,63 +4630,6 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss } } - class DriverStoppingState extends State { - @Override - public boolean processMessage(Message message) { - logStateAndMessage(message, this); - - switch(message.what) { - case WifiMonitor.SUPPLICANT_STATE_CHANGE_EVENT: - SupplicantState state = handleSupplicantStateChange(message); - if (state == SupplicantState.INTERFACE_DISABLED) { - transitionTo(mDriverStoppedState); - } - break; - /* Queue driver commands */ - case CMD_START_DRIVER: - case CMD_STOP_DRIVER: - case CMD_SET_FREQUENCY_BAND: - case CMD_START_SCAN: - case CMD_DISCONNECT: - case CMD_REASSOCIATE: - case CMD_RECONNECT: - messageHandlingStatus = MESSAGE_HANDLING_STATUS_DEFERRED; - deferMessage(message); - break; - default: - return NOT_HANDLED; - } - return HANDLED; - } - } - - class DriverStoppedState extends State { - @Override - public boolean processMessage(Message message) { - logStateAndMessage(message, this); - switch (message.what) { - case WifiMonitor.SUPPLICANT_STATE_CHANGE_EVENT: - StateChangeResult stateChangeResult = (StateChangeResult) message.obj; - SupplicantState state = stateChangeResult.state; - // A WEXT bug means that we can be back to driver started state - // unexpectedly - if (SupplicantState.isDriverActive(state)) { - transitionTo(mDriverStartedState); - } - break; - case CMD_START_DRIVER: - mWakeLock.acquire(); - mWifiNative.startDriver(); - mWakeLock.release(); - transitionTo(mDriverStartingState); - break; - default: - return NOT_HANDLED; - } - return HANDLED; - } - } - class ScanModeState extends State { private int mLastOperationMode; @Override @@ -7431,7 +7223,6 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss * Defer all commands that can cause connections to a different network * or put the state machine out of connect mode */ - case CMD_STOP_DRIVER: case CMD_SET_OPERATIONAL_MODE: case WifiManager.CONNECT_NETWORK: case CMD_ENABLE_NETWORK: |