summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorMingguang Xu <mingguangxu@google.com>2019-04-03 16:10:27 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-04-03 16:10:27 +0000
commit6cc0ee5c8c9139790e9a0f3e4d03eab5b618c1ee (patch)
treeca41c03e609dce09ff6c45f501f2628b460fadd5 /service
parente9d2b772127293d4f36ef9e2727b3ceb97ea69af (diff)
parent4e4fdb68c27fed31010ea1a791cc717d28e0b2bb (diff)
Merge "Wifi usability: Collect good usability stats when score breaches low"
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiMetrics.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/WifiMetrics.java b/service/java/com/android/server/wifi/WifiMetrics.java
index dca05e6ef..e8da69c12 100644
--- a/service/java/com/android/server/wifi/WifiMetrics.java
+++ b/service/java/com/android/server/wifi/WifiMetrics.java
@@ -168,6 +168,10 @@ public class WifiMetrics {
// >= 300
private static final int[] WIFI_CONFIG_STORE_IO_DURATION_BUCKET_RANGES_MS =
{50, 100, 150, 200, 300};
+ // Minimum time wait before generating a LABEL_GOOD stats after score breaching low.
+ public static final int MIN_SCORE_BREACH_TO_GOOD_STATS_WAIT_TIME_MS = 60 * 1000; // 1 minute
+ // Maximum time that a score breaching low event stays valid.
+ public static final int VALIDITY_PERIOD_OF_SCORE_BREACH_LOW_MS = 90 * 1000; // 1.5 minutes
private Clock mClock;
private boolean mScreenOn;
@@ -199,6 +203,7 @@ public class WifiMetrics {
android.net.wifi.WifiUsabilityStatsEntry.PROBE_STATUS_NO_PROBE;
private int mProbeElapsedTimeSinceLastUpdateMs = -1;
private int mProbeMcsRateSinceLastUpdate = -1;
+ private long mScoreBreachLowTimeMillis = -1;
/** Tracks if we should be logging WifiIsUnusableEvent */
private boolean mUnusableEventLogging = false;
@@ -1701,6 +1706,11 @@ public class WifiMetrics {
StaEvent event = new StaEvent();
event.type = StaEvent.TYPE_SCORE_BREACH;
addStaEvent(event);
+ // Only record the first score breach by checking whether mScoreBreachLowTimeMillis
+ // has been set to -1
+ if (!wifiWins && mScoreBreachLowTimeMillis == -1) {
+ mScoreBreachLowTimeMillis = mClock.getElapsedSinceBootMillis();
+ }
}
}
}
@@ -3429,6 +3439,7 @@ public class WifiMetrics {
android.net.wifi.WifiUsabilityStatsEntry.PROBE_STATUS_NO_PROBE;
mProbeElapsedTimeSinceLastUpdateMs = -1;
mProbeMcsRateSinceLastUpdate = -1;
+ mScoreBreachLowTimeMillis = -1;
mWifiConfigStoreReadDurationHistogram.clear();
mWifiConfigStoreWriteDurationHistogram.clear();
mLinkProbeSuccessRssiCounts.clear();
@@ -4037,6 +4048,7 @@ public class WifiMetrics {
* @param firmwareAlertCode WifiIsUnusableEvent.firmwareAlertCode for firmware alert code
*/
public void logWifiIsUnusableEvent(int triggerType, int firmwareAlertCode) {
+ mScoreBreachLowTimeMillis = -1;
if (!mUnusableEventLogging) {
return;
}
@@ -4215,6 +4227,16 @@ public class WifiMetrics {
addToWifiUsabilityStatsList(WifiUsabilityStats.LABEL_GOOD,
WifiUsabilityStats.TYPE_UNKNOWN, -1);
}
+ if (mScoreBreachLowTimeMillis != -1) {
+ long elapsedTime = mClock.getElapsedSinceBootMillis() - mScoreBreachLowTimeMillis;
+ if (elapsedTime >= MIN_SCORE_BREACH_TO_GOOD_STATS_WAIT_TIME_MS) {
+ mScoreBreachLowTimeMillis = -1;
+ if (elapsedTime <= VALIDITY_PERIOD_OF_SCORE_BREACH_LOW_MS) {
+ addToWifiUsabilityStatsList(WifiUsabilityStats.LABEL_GOOD,
+ WifiUsabilityStats.TYPE_UNKNOWN, -1);
+ }
+ }
+ }
// Invoke Wifi usability stats listener.
sendWifiUsabilityStats(mSeqNumInsideFramework, isSameBssidAndFreq,
@@ -4411,6 +4433,7 @@ public class WifiMetrics {
} else {
// Only add a bad event if at least |MIN_DATA_STALL_WAIT_MS|
// has passed.
+ mScoreBreachLowTimeMillis = -1;
if (mWifiUsabilityStatsListBad.isEmpty()
|| (mWifiUsabilityStatsListBad.getLast().stats[mWifiUsabilityStatsListBad
.getLast().stats.length - 1].timeStampMs
@@ -4569,6 +4592,11 @@ public class WifiMetrics {
StaEvent event = new StaEvent();
event.type = StaEvent.TYPE_WIFI_USABILITY_SCORE_BREACH;
addStaEvent(event);
+ // Only record the first score breach by checking whether mScoreBreachLowTimeMillis
+ // has been set to -1
+ if (!wifiWins && mScoreBreachLowTimeMillis == -1) {
+ mScoreBreachLowTimeMillis = mClock.getElapsedSinceBootMillis();
+ }
}
}
}