[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
This commit is contained in:
Maurice Lam
2014-09-15 20:40:26 -07:00
parent 13fbd848d4
commit 610fdf3343

View File

@@ -87,9 +87,10 @@ public class WifiSetupActivity extends WifiPickerActivity
private final BroadcastReceiver mReceiver = new BroadcastReceiver() { private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
NetworkInfo info = (NetworkInfo) intent.getParcelableExtra( // Refresh the connection state with the latest connection info. Use the connection info
WifiManager.EXTRA_NETWORK_INFO); // from ConnectivityManager instead of the one attached in the intent to make sure
refreshConnectionState(info.isConnected()); // we have the most up-to-date connection state. b/17511772
refreshConnectionState();
} }
}; };