From 610fdf334338ad68e22e0c23224ed6bcdad9bac5 Mon Sep 17 00:00:00 2001 From: Maurice Lam Date: Mon, 15 Sep 2014 20:40:26 -0700 Subject: [PATCH] [WifiSetup] Update connection state for auto-finish In Wi-Fi setup, when the connection state changed, query ConnectivityManager for the latest Wi-Fi connection state instead of relying the NetworkInfo attached in the intent, because the first network info upon changing AP still shows the network as connected. Bug: 17511772 Change-Id: I9c7765086dc8fbc5e1c2a37124ca89db3eab04a3 --- src/com/android/settings/wifi/WifiSetupActivity.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/com/android/settings/wifi/WifiSetupActivity.java b/src/com/android/settings/wifi/WifiSetupActivity.java index 5452a033b29..a87c733913e 100644 --- a/src/com/android/settings/wifi/WifiSetupActivity.java +++ b/src/com/android/settings/wifi/WifiSetupActivity.java @@ -87,9 +87,10 @@ public class WifiSetupActivity extends WifiPickerActivity private final BroadcastReceiver mReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { - NetworkInfo info = (NetworkInfo) intent.getParcelableExtra( - WifiManager.EXTRA_NETWORK_INFO); - refreshConnectionState(info.isConnected()); + // Refresh the connection state with the latest connection info. Use the connection info + // from ConnectivityManager instead of the one attached in the intent to make sure + // we have the most up-to-date connection state. b/17511772 + refreshConnectionState(); } };