summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorOscar Shu <xshu@google.com>2018-04-18 21:07:07 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2018-04-18 21:07:07 +0000
commitd5faea1644d2360f5c776cb833f2123e1c082f35 (patch)
treeb5b5ba2f125ba64cb6a2bf03c995858bfae6844f /service
parent2a78fd6b8dd165346650ed56335b2f0774baa553 (diff)
parent338d87ce46cf0766005f747bb82ac590ceaff54d (diff)
Merge "metrics: Watchdog success delay" into pi-dev
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiInjector.java4
-rw-r--r--service/java/com/android/server/wifi/WifiLastResortWatchdog.java8
-rw-r--r--service/java/com/android/server/wifi/WifiMetrics.java10
3 files changed, 19 insertions, 3 deletions
diff --git a/service/java/com/android/server/wifi/WifiInjector.java b/service/java/com/android/server/wifi/WifiInjector.java
index cdde22268..a64075006 100644
--- a/service/java/com/android/server/wifi/WifiInjector.java
+++ b/service/java/com/android/server/wifi/WifiInjector.java
@@ -284,8 +284,8 @@ public class WifiInjector {
mSettingsStore, mWifiServiceHandlerThread.getLooper(), mFrameworkFacade,
mWifiStateMachinePrime);
mSelfRecovery = new SelfRecovery(mWifiController, mClock);
- mWifiLastResortWatchdog = new WifiLastResortWatchdog(mSelfRecovery, mWifiMetrics,
- mWifiStateMachine, wifiStateMachineLooper);
+ mWifiLastResortWatchdog = new WifiLastResortWatchdog(mSelfRecovery, mClock,
+ mWifiMetrics, mWifiStateMachine, wifiStateMachineLooper);
mWifiMulticastLockManager = new WifiMulticastLockManager(
mWifiStateMachine.getMcastLockManagerFilterController(),
BatteryStatsService.getService());
diff --git a/service/java/com/android/server/wifi/WifiLastResortWatchdog.java b/service/java/com/android/server/wifi/WifiLastResortWatchdog.java
index f759b1782..38f1be092 100644
--- a/service/java/com/android/server/wifi/WifiLastResortWatchdog.java
+++ b/service/java/com/android/server/wifi/WifiLastResortWatchdog.java
@@ -90,16 +90,19 @@ public class WifiLastResortWatchdog {
// Is Watchdog allowed to trigger now? Set to false after triggering. Set to true after
// successfully connecting or a new network (SSID) becomes available to connect to.
private boolean mWatchdogAllowedToTrigger = true;
+ private long mTimeLastTrigger;
private SelfRecovery mSelfRecovery;
private WifiMetrics mWifiMetrics;
private WifiStateMachine mWifiStateMachine;
private Looper mWifiStateMachineLooper;
private double mBugReportProbability = PROB_TAKE_BUGREPORT_DEFAULT;
+ private Clock mClock;
- WifiLastResortWatchdog(SelfRecovery selfRecovery, WifiMetrics wifiMetrics,
+ WifiLastResortWatchdog(SelfRecovery selfRecovery, Clock clock, WifiMetrics wifiMetrics,
WifiStateMachine wsm, Looper wifiStateMachineLooper) {
mSelfRecovery = selfRecovery;
+ mClock = clock;
mWifiMetrics = wifiMetrics;
mWifiStateMachine = wsm;
mWifiStateMachineLooper = wifiStateMachineLooper;
@@ -223,6 +226,7 @@ public class WifiLastResortWatchdog {
Log.e(TAG, "Watchdog triggering recovery");
mSsidAvailableAtFailure.clear();
mSsidAvailableAtFailure.addAll(mSsidFailureCount.keySet());
+ mTimeLastTrigger = mClock.getElapsedSinceBootMillis();
mSelfRecovery.trigger(SelfRecovery.REASON_LAST_RESORT_WATCHDOG);
// increment various watchdog trigger count stats
incrementWifiMetricsTriggerCounts();
@@ -249,6 +253,8 @@ public class WifiLastResortWatchdog {
// WiFi has connected after a Watchdog trigger, without any new networks becoming
// available, log a Watchdog success in wifi metrics
mWifiMetrics.incrementNumLastResortWatchdogSuccesses();
+ long durationMs = mClock.getElapsedSinceBootMillis() - mTimeLastTrigger;
+ mWifiMetrics.setWatchdogSuccessTimeDurationMs(durationMs);
if (mSsidAvailableAtFailure.contains(ssid)) {
Log.e(TAG, "Wifi failed to connect on " + mSsidAvailableAtFailure.size()
+ " networks but was able to reconnect to one of them after a restart.");
diff --git a/service/java/com/android/server/wifi/WifiMetrics.java b/service/java/com/android/server/wifi/WifiMetrics.java
index ea04f2f73..584e51043 100644
--- a/service/java/com/android/server/wifi/WifiMetrics.java
+++ b/service/java/com/android/server/wifi/WifiMetrics.java
@@ -1144,6 +1144,16 @@ public class WifiMetrics {
}
/**
+ * Sets the time taken for wifi to connect after a watchdog triggers a restart.
+ * @param milliseconds
+ */
+ public void setWatchdogSuccessTimeDurationMs(long ms) {
+ synchronized (mLock) {
+ mWifiLogProto.watchdogTriggerToConnectionSuccessDurationMs = ms;
+ }
+ }
+
+ /**
* Increments the count of alerts by alert reason.
*
* @param reason The cause of the alert. The reason values are driver-specific.