summaryrefslogtreecommitdiffstats
path: root/wifi/java/android/net
diff options
context:
space:
mode:
authorRobert Greenwalt <rgreenwalt@google.com>2013-09-20 11:22:40 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-09-20 11:22:40 -0700
commit12f6510170864ed199cca6b0ab27a234b6da4395 (patch)
tree4088c78dc128e13468f6f175537d083bce26b363 /wifi/java/android/net
parent692af53a20772150a1715a4f48c660d9de0ef851 (diff)
parent032de6c6294893045c0c17946b45800b5af47d60 (diff)
downloadframeworks_base-12f6510170864ed199cca6b0ab27a234b6da4395.zip
frameworks_base-12f6510170864ed199cca6b0ab27a234b6da4395.tar.gz
frameworks_base-12f6510170864ed199cca6b0ab27a234b6da4395.tar.bz2
am 032de6c6: am c237c204: Merge "Supsend/resume batched scans around dhcp." into klp-dev
* commit '032de6c6294893045c0c17946b45800b5af47d60': Supsend/resume batched scans around dhcp.
Diffstat (limited to 'wifi/java/android/net')
-rw-r--r--wifi/java/android/net/wifi/WifiStateMachine.java33
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 ad89716..94d9288 100644
--- a/wifi/java/android/net/wifi/WifiStateMachine.java
+++ b/wifi/java/android/net/wifi/WifiStateMachine.java
@@ -229,6 +229,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;
@@ -849,6 +850,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();
@@ -916,8 +922,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) {
@@ -2203,6 +2211,7 @@ public class WifiStateMachine extends StateMachine {
}
void handlePreDhcpSetup() {
+ mDhcpActive = true;
if (!mBluetoothConnectionActive) {
/*
* There are problems setting the Wi-Fi driver's power
@@ -2232,6 +2241,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;
@@ -2270,6 +2281,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) {
@@ -2917,6 +2934,8 @@ public class WifiStateMachine extends StateMachine {
mWifiNative.stopFilteringMulticastV4Packets();
}
+ mDhcpActive = false;
+
if (mBatchedScanSettings != null) {
startBatchedScan();
}
@@ -3486,6 +3505,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:
@@ -3677,7 +3704,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;