diff options
author | Rebecca Silberstein <silberst@google.com> | 2016-09-15 14:04:37 -0700 |
---|---|---|
committer | Rebecca Silberstein <silberst@google.com> | 2016-09-22 16:31:09 +0000 |
commit | a049f83a308e7753b68c1a5036ab67d9806807ec (patch) | |
tree | 310e530ec87fd40ee929b458276eae7a1db58d41 /service/java/com/android/server/wifi/scanner | |
parent | 8a694cf52d152ee11dc2a40727f1ae9127514e8a (diff) | |
download | android_frameworks_opt_net_wifi-a049f83a308e7753b68c1a5036ab67d9806807ec.tar.gz android_frameworks_opt_net_wifi-a049f83a308e7753b68c1a5036ab67d9806807ec.tar.bz2 android_frameworks_opt_net_wifi-a049f83a308e7753b68c1a5036ab67d9806807ec.zip |
WifiServiceImpl: move scan results dump to scanner
The dump command includes the most recent scan results. This
information should be dumped directly from WifiScanningServiceImpl
instead of WifiServiceImpl.
The output was also updated to better reflect the age of the entries.
Invalid scan result timestamps are output with "___?___". Values that
are older than the allotted characters are displayed as ">1000.0".
Valid ages were not changed. The character representing
isAutoJoinCandidate was removed from the output. SSID names that are
longer than 32 characters are truncated.
BUG: 31523862
Test: manual check of bugreport output
Test: manual check of adb shell dumpsys wifi output
Test: manual check of adb shell dumpsys wifiscanner output
Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh
Change-Id: I6529fa7b125a6d7d283fd7dc5f8938632ae4e93f
Diffstat (limited to 'service/java/com/android/server/wifi/scanner')
-rw-r--r-- | service/java/com/android/server/wifi/scanner/WifiScanningServiceImpl.java | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/scanner/WifiScanningServiceImpl.java b/service/java/com/android/server/wifi/scanner/WifiScanningServiceImpl.java index bded79d11..68c917ffd 100644 --- a/service/java/com/android/server/wifi/scanner/WifiScanningServiceImpl.java +++ b/service/java/com/android/server/wifi/scanner/WifiScanningServiceImpl.java @@ -63,6 +63,7 @@ import com.android.server.wifi.scanner.ChannelHelper.ChannelCollection; import java.io.FileDescriptor; import java.io.PrintWriter; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; @@ -879,6 +880,10 @@ public class WifiScanningServiceImpl extends IWifiScanner.Stub { mCachedScanResults = results.getResults(); sendScanResultBroadcast(true); } + + List<ScanResult> getCachedScanResultsAsList() { + return Arrays.asList(mCachedScanResults); + } } class WifiBackgroundScanStateMachine extends StateMachine @@ -2662,6 +2667,38 @@ public class WifiScanningServiceImpl extends IWifiScanner.Stub { if (mPnoScanStateMachine != null) { mPnoScanStateMachine.dump(fd, pw, args); } + pw.println(); + + if (mSingleScanStateMachine != null) { + pw.println("Latest scan results:"); + List<ScanResult> scanResults = mSingleScanStateMachine.getCachedScanResultsAsList(); + long nowMs = System.currentTimeMillis(); + if (scanResults != null && scanResults.size() != 0) { + pw.println(" BSSID Frequency RSSI Age(sec) SSID " + + " Flags"); + for (ScanResult r : scanResults) { + String age; + if (r.seen <= 0) { + age = "___?___"; + } else if (nowMs < r.seen) { + age = " 0.000"; + } else if (r.seen < nowMs - 1000000) { + age = ">1000.0"; + } else { + age = String.format("%3.3f", (nowMs - r.seen) / 1000.0); + } + String ssid = r.SSID == null ? "" : r.SSID; + pw.printf(" %17s %9d %5d %7s %-32s %s\n", + r.BSSID, + r.frequency, + r.level, + age, + String.format("%1.32s", ssid), + r.capabilities); + } + } + pw.println(); + } } void logScanRequest(String request, ClientInfo ci, int id, WorkSource workSource, |