From b9f329f633f8a539a4c5bf22c6b5901d6493a677 Mon Sep 17 00:00:00 2001 From: Irfan Sheriff Date: Fri, 27 Jan 2012 21:00:19 -0800 Subject: [PATCH] Improve Wi-Fi hand-off When Wi-fi connects at L2 layer, the beacons reach and the device can maintain a connection to the access point, but the application connectivity can be flaky (due to bigger packet size exchange). We now use Watchdog to monitor the quality of the last hop on Wi-Fi using signal strength and ARP connectivity as indicators to decide if the link is good enough to switch to Wi-Fi as the uplink. ARP pings are useful for link validation but can still get through when the application traffic fails to go through and thus not best indicator real packet loss since they are tiny packets (28 bytes) and have much low chance of packet corruption than the regular data packets. Signal strength and ARP used together ends up working well in tests. The goal is to switch to Wi-Fi after validating ARP transfer and RSSI and then switching out of Wi-Fi when we hit a low signal strength threshold and waiting until the signal strength improves and validating ARP transfer. Change-Id: Ica593291ec7772da892f03cf45b649635b730c47 --- core/java/android/net/NetworkInfo.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/java/android/net/NetworkInfo.java b/core/java/android/net/NetworkInfo.java index 2f43cb87f6..0bc6b58aef 100644 --- a/core/java/android/net/NetworkInfo.java +++ b/core/java/android/net/NetworkInfo.java @@ -77,7 +77,9 @@ public class NetworkInfo implements Parcelable { /** Attempt to connect failed. */ FAILED, /** Access to this network is blocked. */ - BLOCKED + BLOCKED, + /** Link has poor connectivity. */ + VERIFYING_POOR_LINK } /** @@ -94,6 +96,7 @@ public class NetworkInfo implements Parcelable { stateMap.put(DetailedState.CONNECTING, State.CONNECTING); stateMap.put(DetailedState.AUTHENTICATING, State.CONNECTING); stateMap.put(DetailedState.OBTAINING_IPADDR, State.CONNECTING); + stateMap.put(DetailedState.VERIFYING_POOR_LINK, State.CONNECTING); stateMap.put(DetailedState.CONNECTED, State.CONNECTED); stateMap.put(DetailedState.SUSPENDED, State.SUSPENDED); stateMap.put(DetailedState.DISCONNECTING, State.DISCONNECTING);