From e142eb0c24b0757343fb0f8cd9e21cacd444a880 Mon Sep 17 00:00:00 2001 From: Irfan Sheriff Date: Mon, 15 Nov 2010 14:33:21 -0800 Subject: [PATCH] DO NOT MERGE Fix status fetch from supplicant Bug: 3192891 Change-Id: I2471f144494d398fe1d4572ac4d6421c100693e2 --- .../android/net/wifi/WifiStateTracker.java | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/wifi/java/android/net/wifi/WifiStateTracker.java b/wifi/java/android/net/wifi/WifiStateTracker.java index a0e588d3f33d4..1284072a20ac5 100644 --- a/wifi/java/android/net/wifi/WifiStateTracker.java +++ b/wifi/java/android/net/wifi/WifiStateTracker.java @@ -1461,34 +1461,34 @@ public class WifiStateTracker extends NetworkStateTracker { } private void requestConnectionStatus(WifiInfo info) { - String reply = status(); - if (reply == null) { - return; - } - /* - * Parse the reply from the supplicant to the status command, and update - * local state accordingly. The reply is a series of lines of the form - * "name=value". - */ String SSID = null; String BSSID = null; String suppState = null; int netId = -1; - String[] lines = reply.split("\n"); - for (String line : lines) { - String[] prop = line.split(" *= *"); - if (prop.length < 2) - continue; - String name = prop[0]; - String value = prop[1]; - if (name.equalsIgnoreCase("id")) - netId = Integer.parseInt(value); - else if (name.equalsIgnoreCase("ssid")) - SSID = value; - else if (name.equalsIgnoreCase("bssid")) - BSSID = value; - else if (name.equalsIgnoreCase("wpa_state")) - suppState = value; + String reply = status(); + if (reply != null) { + /* + * Parse the reply from the supplicant to the status command, and update + * local state accordingly. The reply is a series of lines of the form + * "name=value". + */ + + String[] lines = reply.split("\n"); + for (String line : lines) { + String[] prop = line.split(" *= *"); + if (prop.length < 2) + continue; + String name = prop[0]; + String value = prop[1]; + if (name.equalsIgnoreCase("id")) + netId = Integer.parseInt(value); + else if (name.equalsIgnoreCase("ssid")) + SSID = value; + else if (name.equalsIgnoreCase("bssid")) + BSSID = value; + else if (name.equalsIgnoreCase("wpa_state")) + suppState = value; + } } info.setNetworkId(netId); info.setSSID(SSID);