diff options
author | Robert Greenwalt <rgreenwalt@google.com> | 2013-09-19 17:30:19 -0700 |
---|---|---|
committer | Robert Greenwalt <rgreenwalt@google.com> | 2013-09-20 10:13:46 -0700 |
commit | 81fec6be04b302588a44e9730dbdf1d7d07a8abc (patch) | |
tree | 33273c32fc383a04e896d4d7346941d8e89df43b | |
parent | 8f435baca8b5285a6b4658fc9563f5fcbbdafc6e (diff) | |
download | frameworks_base-81fec6be04b302588a44e9730dbdf1d7d07a8abc.zip frameworks_base-81fec6be04b302588a44e9730dbdf1d7d07a8abc.tar.gz frameworks_base-81fec6be04b302588a44e9730dbdf1d7d07a8abc.tar.bz2 |
Supsend/resume batched scans around dhcp.
Scanning while dhcp is running breaks dhcp, so stop the batched scans
when we need dhcp and start it up again after.
bug:10691401
Change-Id: Ifdeb6f35cfe4509b90fed1e1e694d0c107f24a7e
-rw-r--r-- | wifi/java/android/net/wifi/WifiStateMachine.java | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java index 0f1aa71..33a67ca 100644 --- a/wifi/java/android/net/wifi/WifiStateMachine.java +++ b/wifi/java/android/net/wifi/WifiStateMachine.java @@ -228,6 +228,7 @@ public class WifiStateMachine extends StateMachine { private NetworkInfo mNetworkInfo; private SupplicantStateTracker mSupplicantStateTracker; private DhcpStateMachine mDhcpStateMachine; + private boolean mDhcpActive = false; private class InterfaceObserver extends BaseNetworkObserver { private WifiStateMachine mWifiStateMachine; @@ -848,6 +849,11 @@ public class WifiStateMachine extends StateMachine { } private void startBatchedScan() { + if (mDhcpActive) { + if (DBG) log("not starting Batched Scans due to DHCP"); + return; + } + // first grab any existing data retrieveBatchedScanData(); @@ -915,8 +921,10 @@ public class WifiStateMachine extends StateMachine { private void stopBatchedScan() { mAlarmManager.cancel(mBatchedScanIntervalIntent); - retrieveBatchedScanData(); - mWifiNative.setBatchedScanSettings(null); + if (mBatchedScanSettings != null) { + retrieveBatchedScanData(); + mWifiNative.setBatchedScanSettings(null); + } } private void setNextBatchedAlarm(int scansExpected) { @@ -2201,6 +2209,7 @@ public class WifiStateMachine extends StateMachine { } void handlePreDhcpSetup() { + mDhcpActive = true; if (!mBluetoothConnectionActive) { /* * There are problems setting the Wi-Fi driver's power @@ -2230,6 +2239,8 @@ public class WifiStateMachine extends StateMachine { setSuspendOptimizationsNative(SUSPEND_DUE_TO_DHCP, false); mWifiNative.setPowerSave(false); + stopBatchedScan(); + /* P2p discovery breaks dhcp, shut it down in order to get through this */ Message msg = new Message(); msg.what = WifiP2pService.BLOCK_DISCOVERY; @@ -2268,6 +2279,12 @@ public class WifiStateMachine extends StateMachine { // Set the coexistence mode back to its default value mWifiNative.setBluetoothCoexistenceMode( mWifiNative.BLUETOOTH_COEXISTENCE_MODE_SENSE); + + mDhcpActive = false; + + if (mBatchedScanSettings != null) { + startBatchedScan(); + } } private void handleSuccessfulIpConfiguration(DhcpResults dhcpResults) { @@ -2915,6 +2932,8 @@ public class WifiStateMachine extends StateMachine { mWifiNative.stopFilteringMulticastV4Packets(); } + mDhcpActive = false; + if (mBatchedScanSettings != null) { startBatchedScan(); } @@ -3484,6 +3503,14 @@ public class WifiStateMachine extends StateMachine { } @Override + public void exit() { + // if we're leaving before this is done, cleanup + if (mDhcpActive) { + handlePostDhcpSetup(); + } + } + + @Override public boolean processMessage(Message message) { switch (message.what) { case DhcpStateMachine.CMD_PRE_DHCP_ACTION: @@ -3675,7 +3702,7 @@ public class WifiStateMachine extends StateMachine { transitionTo(mCaptivePortalCheckState); break; default: - log(getName() + " what=" + message.what + " NOT_HANDLED"); + if (DBG) log(getName() + " what=" + message.what + " NOT_HANDLED"); return NOT_HANDLED; } return HANDLED; |