summaryrefslogtreecommitdiff
path: root/service/java/com/android/server/wifi/WifiLastResortWatchdog.java
diff options
context:
space:
mode:
authorRebecca Silberstein <silberst@google.com>2016-05-26 15:05:13 -0700
committerRebecca Silberstein <silberst@google.com>2016-05-27 14:59:57 -0700
commit11ad3437e833ead2c7c235f173824db16ee4ea02 (patch)
treee90ffb1832ff527c77edf9fc00040b996e375caf /service/java/com/android/server/wifi/WifiLastResortWatchdog.java
parentddd09bbe798f9fb257bb9c73649bee3bd77fb469 (diff)
downloadwifi-11ad3437e833ead2c7c235f173824db16ee4ea02.tar.gz
WifiLastResortWatchdog: reset wifi on trigger
Added wifi reset on WifiLastResortTrigger. The reset is implemented by sending the CMD_RESTART_WIFI message to WifiController. BUG: 27856267 Change-Id: Icb7c3a211afcd234cfcd25a42665aed03c33f5e1
Diffstat (limited to 'service/java/com/android/server/wifi/WifiLastResortWatchdog.java')
-rw-r--r--service/java/com/android/server/wifi/WifiLastResortWatchdog.java26
1 files changed, 23 insertions, 3 deletions
diff --git a/service/java/com/android/server/wifi/WifiLastResortWatchdog.java b/service/java/com/android/server/wifi/WifiLastResortWatchdog.java
index 896c1c816..558b50ef1 100644
--- a/service/java/com/android/server/wifi/WifiLastResortWatchdog.java
+++ b/service/java/com/android/server/wifi/WifiLastResortWatchdog.java
@@ -80,6 +80,8 @@ public class WifiLastResortWatchdog {
private WifiMetrics mWifiMetrics;
+ private WifiController mWifiController = null;
+
WifiLastResortWatchdog(WifiMetrics wifiMetrics) {
mWifiMetrics = wifiMetrics;
}
@@ -324,13 +326,21 @@ public class WifiLastResortWatchdog {
}
/**
- * Restart Supplicant, Driver & return WifiStateMachine to InitialState
+ * Trigger a restart of the wifi stack.
*/
private void restartWifiStack() {
if (VDBG) Log.v(TAG, "restartWifiStack.");
- Log.i(TAG, "Triggered.");
+
+ // First verify that we can send the trigger message.
+ if (mWifiController == null) {
+ Log.e(TAG, "WifiLastResortWatchdog unable to trigger: WifiController is null");
+ return;
+ }
+
if (DBG) Log.d(TAG, toString());
- // <TODO>
+
+ mWifiController.sendMessage(WifiController.CMD_RESTART_WIFI);
+ Log.i(TAG, "Triggered WiFi stack restart.");
}
/**
@@ -537,4 +547,14 @@ public class WifiLastResortWatchdog {
+ ", Age: " + age;
}
}
+
+ /**
+ * Method used to set the WifiController for the this watchdog.
+ *
+ * The WifiController is used to send the restart wifi command to carry out the wifi restart.
+ * @param wifiController WifiController instance that will be sent the CMD_RESTART_WIFI message.
+ */
+ public void setWifiController(WifiController wifiController) {
+ mWifiController = wifiController;
+ }
}