diff options
author | Iliyan Malchev <malchev@google.com> | 2013-06-19 01:16:23 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-06-19 01:16:23 +0000 |
commit | 0dff78aa32d8e7bc2eb057f2878a9e010417e42a (patch) | |
tree | 10bb1131fe5b6199479b26dd0c09c8bf5c741f11 | |
parent | 99700bfee02dd99e47bca5f0ab4e841239deda04 (diff) | |
parent | c2cbd4c11bfb83344502bd80389538795bae03cb (diff) | |
download | frameworks_base-0dff78aa32d8e7bc2eb057f2878a9e010417e42a.zip frameworks_base-0dff78aa32d8e7bc2eb057f2878a9e010417e42a.tar.gz frameworks_base-0dff78aa32d8e7bc2eb057f2878a9e010417e42a.tar.bz2 |
Merge "Revert "wifi: Get full scan results"" into jb-mr2-dev
-rw-r--r-- | wifi/java/android/net/wifi/WifiNative.java | 6 | ||||
-rw-r--r-- | wifi/java/android/net/wifi/WifiStateMachine.java | 41 |
2 files changed, 7 insertions, 40 deletions
diff --git a/wifi/java/android/net/wifi/WifiNative.java b/wifi/java/android/net/wifi/WifiNative.java index f637e89..ab289b3 100644 --- a/wifi/java/android/net/wifi/WifiNative.java +++ b/wifi/java/android/net/wifi/WifiNative.java @@ -198,7 +198,6 @@ public class WifiNative { /** * Format of results: * ================= - * id=1 * bssid=68:7f:74:d7:1b:6e * freq=2412 * level=-43 @@ -209,11 +208,10 @@ public class WifiNative { * ==== * * RANGE=ALL gets all scan results - * RANGE=ID- gets results from ID * MASK=<N> see wpa_supplicant/src/common/wpa_ctrl.h for details */ - public String scanResults(int sid) { - return doStringCommand("BSS RANGE=" + sid + "- MASK=0x21987"); + public String scanResults() { + return doStringCommand("BSS RANGE=ALL MASK=0x21987"); } public boolean startDriver() { diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java index 3e3752e..32d48ac 100644 --- a/wifi/java/android/net/wifi/WifiStateMachine.java +++ b/wifi/java/android/net/wifi/WifiStateMachine.java @@ -67,8 +67,8 @@ import android.os.SystemProperties; import android.os.UserHandle; import android.os.WorkSource; import android.provider.Settings; -import android.util.LruCache; import android.text.TextUtils; +import android.util.LruCache; import com.android.internal.R; import com.android.internal.app.IBatteryStats; @@ -1337,7 +1337,6 @@ public class WifiStateMachine extends StateMachine { mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL); } - private static final String ID_STR = "id="; private static final String BSSID_STR = "bssid="; private static final String FREQ_STR = "freq="; private static final String LEVEL_STR = "level="; @@ -1349,8 +1348,6 @@ public class WifiStateMachine extends StateMachine { /** * Format: - * - * id=1 * bssid=68:7f:76:d7:1a:6e * freq=2412 * level=-44 @@ -1358,7 +1355,6 @@ public class WifiStateMachine extends StateMachine { * flags=[WPA2-PSK-CCMP][WPS][ESS] * ssid=zfdy * ==== - * id=2 * bssid=68:5f:74:d7:1a:6f * freq=5180 * level=-73 @@ -1367,43 +1363,16 @@ public class WifiStateMachine extends StateMachine { * ssid=zuby * ==== */ - private void setScanResults() { + private void setScanResults(String scanResults) { String bssid = ""; int level = 0; int freq = 0; long tsf = 0; String flags = ""; WifiSsid wifiSsid = null; - String scanResults; - String tmpResults; - StringBuffer scanResultsBuf = new StringBuffer(); - int sid = 0; - - while (true) { - tmpResults = mWifiNative.scanResults(sid); - if (TextUtils.isEmpty(tmpResults)) break; - scanResultsBuf.append(tmpResults); - scanResultsBuf.append("\n"); - String[] lines = tmpResults.split("\n"); - sid = -1; - for (int i=lines.length - 1; i >= 0; i--) { - if (lines[i].startsWith(END_STR)) { - break; - } else if (lines[i].startsWith(ID_STR)) { - try { - sid = Integer.parseInt(lines[i].substring(ID_STR.length())) + 1; - } catch (NumberFormatException e) { - // Nothing to do - } - break; - } - } - if (sid == -1) break; - } - scanResults = scanResultsBuf.toString(); - if (TextUtils.isEmpty(scanResults)) { - return; + if (scanResults == null) { + return; } synchronized(mScanResultCache) { @@ -2229,7 +2198,7 @@ public class WifiStateMachine extends StateMachine { sendMessageDelayed(CMD_START_SUPPLICANT, SUPPLICANT_RESTART_INTERVAL_MSECS); break; case WifiMonitor.SCAN_RESULTS_EVENT: - setScanResults(); + setScanResults(mWifiNative.scanResults()); sendScanResultsAvailableBroadcast(); mScanResultIsPending = false; break; |