summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Plass <mplass@google.com>2019-11-26 13:55:56 -0800
committerMichael Plass <mplass@google.com>2019-12-05 16:23:05 +0000
commitb9b048990db3624d21efaccf70cf5d0c211ec83a (patch)
tree21c9a6a945b6caa3b36b87248e4eb81c5a074e18
parentd44eaf0f88044996f2b935418c71c2144fa4c7f6 (diff)
[WifiScoreCard] Enable rssi histograms
Enable rssi histograms for selected event types. Use a bucket size of 1 for values between -100 and -20. Bug: 136675430 Test: atest WifiScoreCardTest Change-Id: Ic7ee5b2a6c4d100bfa35c7ff544f5f13c2aa1bd6
-rw-r--r--service/java/com/android/server/wifi/WifiScoreCard.java25
1 files changed, 19 insertions, 6 deletions
diff --git a/service/java/com/android/server/wifi/WifiScoreCard.java b/service/java/com/android/server/wifi/WifiScoreCard.java
index fa6de23c4..cc5f1285f 100644
--- a/service/java/com/android/server/wifi/WifiScoreCard.java
+++ b/service/java/com/android/server/wifi/WifiScoreCard.java
@@ -72,7 +72,7 @@ public class WifiScoreCard {
private static final boolean DBG = false;
@VisibleForTesting
- boolean mPersistentHistograms = false; // not ready yet
+ boolean mPersistentHistograms = true;
private static final int TARGET_IN_MEMORY_ENTRIES = 50;
@@ -81,10 +81,15 @@ public class WifiScoreCard {
private MemoryStore mMemoryStore;
@VisibleForTesting
- static final int[] RSSI_BUCKETS =
- {-99, -88, -87, -86, -85, -84, -83, -82, -81, -80, -79, -78, -77, -76, -75, -74, -73,
- -72, -71, -70, -66, -55};
+ static final int[] RSSI_BUCKETS = intsInRange(-100, -20);
+ private static int[] intsInRange(int min, int max) {
+ int[] a = new int[max - min + 1];
+ for (int i = 0; i < a.length; i++) {
+ a[i] = min + i;
+ }
+ return a;
+ }
/** Our view of the memory store */
public interface MemoryStore {
@@ -773,8 +778,16 @@ public class WifiScoreCard {
PerSignal(Event event, int frequency) {
this.event = event;
this.frequency = frequency;
- // TODO(b/136675430) - histograms not needed for all events?
- this.rssi = new PerUnivariateStatistic(RSSI_BUCKETS);
+ switch (event) {
+ case SIGNAL_POLL:
+ case IP_CONFIGURATION_SUCCESS:
+ case IP_REACHABILITY_LOST:
+ this.rssi = new PerUnivariateStatistic(RSSI_BUCKETS);
+ break;
+ default:
+ this.rssi = new PerUnivariateStatistic();
+ break;
+ }
this.linkspeed = new PerUnivariateStatistic();
switch (event) {
case FIRST_POLL_AFTER_CONNECTION: