summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Kline <ek@google.com>2016-02-23 17:48:24 +0900
committerErik Kline <ek@google.com>2016-02-24 10:36:34 +0900
commitbcbc449d47124ec8f73a38ffe228b97bd9b493bf (patch)
treedcd80f9d6196d7c0c0daa8a6fb091a4d1b4b7f40
parent290ee2a917976be96c978ae7340cba5e35e1b019 (diff)
Unbreak framework roaming
Framework roams could transition to ObtainingIpState in which we no longer send DHCPv4 RENEWs. Owing to a bug we still started the watchdog timer which would just fire 40 seconds later. Instead, don't transition to ObtainingIpState except when actually wanting to obtain IP configuration (gasp!). We transition instead back to ConnectedState and let IpReachabilityMonitor signal us if we need to transition further. Bug: 26991160 Change-Id: I535611aee542cf3dcebf57e618fcc73806797aac
-rw-r--r--service/java/com/android/server/wifi/WifiStateMachine.java53
1 files changed, 27 insertions, 26 deletions
diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java
index be069983f..c93e722b3 100644
--- a/service/java/com/android/server/wifi/WifiStateMachine.java
+++ b/service/java/com/android/server/wifi/WifiStateMachine.java
@@ -8071,21 +8071,24 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiPno
// cause the roam to fail and the device to disconnect.
clearCurrentConfigBSSID("ObtainingIpAddress");
+ // Stop IpManager in case we're switching from DHCP to static
+ // configuration or vice versa.
+ //
+ // TODO: Only ever enter this state the first time we connect to a
+ // network, never on switching between static configuration and
+ // DHCP. When we transition from static configuration to DHCP in
+ // particular, we must tell ConnectivityService that we're
+ // disconnected, because DHCP might take a long time during which
+ // connectivity APIs such as getActiveNetworkInfo should not return
+ // CONNECTED.
+ stopIpManager();
+
if (!mWifiConfigManager.isUsingStaticIp(mLastNetworkId)) {
- // We used to do DHCPv4 RENEWs on framework roams.
- // TODO: Investigate whether we should reinstitute this.
- //
- // When we get here after a roam, we will already have called
- // mIpManager.confirmConfiguration() to ensure we're on the
- // same network (in handling of SupplicantState.COMPLETED).
- if (!isRoaming()) {
- mIpManager.stop();
- final IpManager.ProvisioningConfiguration prov =
- mIpManager.buildProvisioningConfiguration()
- .withPreDhcpAction()
- .build();
- mIpManager.startProvisioning(prov);
- }
+ final IpManager.ProvisioningConfiguration prov =
+ mIpManager.buildProvisioningConfiguration()
+ .withPreDhcpAction()
+ .build();
+ mIpManager.startProvisioning(prov);
obtainingIpWatchdogCount++;
logd("Start Dhcp Watchdog " + obtainingIpWatchdogCount);
// Get Link layer stats so as we get fresh tx packet counters
@@ -8093,17 +8096,6 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiPno
sendMessageDelayed(obtainMessage(CMD_OBTAINING_IP_ADDRESS_WATCHDOG_TIMER,
obtainingIpWatchdogCount, 0), OBTAINING_IP_ADDRESS_GUARD_TIMER_MSEC);
} else {
- // Stop IpManager in case we're switching from static
- // configuration to DHCP.
- //
- // TODO: Only ever enter this state the first time we
- // connect to a network, never on changing from static
- // configuration to DHCP. When we transition from static
- // configuration to DHCP, we must tell ConnectivityService
- // that we're disconnected, because DHCP might take a long
- // time, during which connectivity APIs such as
- // getActiveNetworkInfo should not return CONNECTED.
- stopIpManager();
StaticIpConfiguration config = mWifiConfigManager.getStaticIpConfiguration(
mLastNetworkId);
if (config.ipAddress == null) {
@@ -8279,7 +8271,16 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiPno
mWifiQualifiedNetworkSelector.enableBssidForQualityNetworkSelection(
mLastBssid, true);
sendNetworkStateChangeBroadcast(mLastBssid);
- transitionTo(mObtainingIpState);
+
+ // We used to transition to ObtainingIpState in an
+ // attempt to do DHCPv4 RENEWs on framework roams.
+ // DHCP can take too long to time out, and we now rely
+ // upon IpManager's use of IpReachabilityMonitor to
+ // confirm our current network configuration.
+ //
+ // mIpManager.confirmConfiguration() is called within
+ // the handling of SupplicantState.COMPLETED.
+ transitionTo(mConnectedState);
} else {
messageHandlingStatus = MESSAGE_HANDLING_STATUS_DISCARD;
}