DO NOT MERGE Fix status fetch from supplicant
Bug: 3192891
Change-Id: I2471f144494d398fe1d4572ac4d6421c100693e2
diff --git a/wifi/java/android/net/wifi/WifiStateTracker.java b/wifi/java/android/net/wifi/WifiStateTracker.java
index a0e588d..1284072 100644
--- a/wifi/java/android/net/wifi/WifiStateTracker.java
+++ b/wifi/java/android/net/wifi/WifiStateTracker.java
@@ -1461,34 +1461,34 @@
}
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);