diff options
author | Erik Kline <ek@google.com> | 2015-08-19 22:17:27 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-08-19 22:17:27 +0000 |
commit | 195e2b5b6822142e7b8b91843aecc5d9f0b252ed (patch) | |
tree | dfa0dabcec90a10aae55098e49584eaa69587520 /service | |
parent | 8be016e09c31c9d0fb9044a9d3a9008bde559ca8 (diff) | |
parent | 50cc4f8cf4c35d5b97aceea4956f37724a91f207 (diff) | |
download | android_frameworks_opt_net_wifi-195e2b5b6822142e7b8b91843aecc5d9f0b252ed.tar.gz android_frameworks_opt_net_wifi-195e2b5b6822142e7b8b91843aecc5d9f0b252ed.tar.bz2 android_frameworks_opt_net_wifi-195e2b5b6822142e7b8b91843aecc5d9f0b252ed.zip |
Merge "Also track loss of IPv6 provisioning, not just IPv4" into mnc-dev
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/WifiStateMachine.java | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java index 2c543b71d..70b64db4e 100644 --- a/service/java/com/android/server/wifi/WifiStateMachine.java +++ b/service/java/com/android/server/wifi/WifiStateMachine.java @@ -4485,8 +4485,13 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiPno final boolean linkChanged = !newLp.equals(mLinkProperties); final boolean wasProvisioned = isProvisioned(mLinkProperties); final boolean isProvisioned = isProvisioned(newLp); - final boolean lostIPv4Provisioning = - mLinkProperties.hasIPv4Address() && !newLp.hasIPv4Address(); + // TODO: Teach LinkProperties how to understand static assignment + // and simplify all this provisioning change detection logic by + // unifying it under LinkProperties.compareProvisioning(). + final boolean lostProvisioning = + (wasProvisioned && !isProvisioned) || + (mLinkProperties.hasIPv4Address() && !newLp.hasIPv4Address()) || + (mLinkProperties.isIPv6Provisioned() && !newLp.isIPv6Provisioned()); final DetailedState detailedState = getNetworkDetailedState(); if (linkChanged) { @@ -4501,6 +4506,12 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiPno if (mNetworkAgent != null) mNetworkAgent.sendLinkProperties(mLinkProperties); } + if (lostProvisioning) { + log("Lost IP layer provisioning!" + + " was: " + mLinkProperties + + " now: " + newLp); + } + if (DBG) { StringBuilder sb = new StringBuilder(); sb.append("updateLinkProperties nid: " + mLastNetworkId); @@ -4557,7 +4568,7 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiPno // DHCP failed. If we're not already provisioned, or we had IPv4 and now lost it, // give up and disconnect. // If we're already provisioned (e.g., IPv6-only network), stay connected. - if (!isProvisioned || lostIPv4Provisioning) { + if (!isProvisioned || lostProvisioning) { sendMessage(CMD_IP_CONFIGURATION_LOST); } else { // DHCP failed, but we're provisioned (e.g., if we're on an IPv6-only network). @@ -4588,7 +4599,7 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiPno case CMD_UPDATE_LINKPROPERTIES: // IP addresses, DNS servers, etc. changed. Act accordingly. - if (wasProvisioned && !isProvisioned) { + if (lostProvisioning) { // We no longer have a usable network configuration. Disconnect. sendMessage(CMD_IP_CONFIGURATION_LOST); } else if (!wasProvisioned && isProvisioned) { |