diff options
author | Rebecca Silberstein <silberst@google.com> | 2016-05-26 15:05:13 -0700 |
---|---|---|
committer | Rebecca Silberstein <silberst@google.com> | 2016-06-28 15:52:08 -0700 |
commit | 969de309e3edc1795d6df24415e586d1a1587cb6 (patch) | |
tree | 965886f4b8caa794c6cb845bc80cfa523287fb66 /service | |
parent | 5f0238c0d7b4b037dcb1c397217eb65dcfbf53ce (diff) |
DO NOT MERGE WifiLastResortWatchdog: reset wifi on trigger
( cherry-pick of Icb7c3a211afcd234cfcd25a42665aed03c33f5e1 from master )
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')
-rw-r--r-- | service/java/com/android/server/wifi/WifiLastResortWatchdog.java | 26 | ||||
-rw-r--r-- | service/java/com/android/server/wifi/WifiServiceImpl.java | 2 |
2 files changed, 25 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; + } } diff --git a/service/java/com/android/server/wifi/WifiServiceImpl.java b/service/java/com/android/server/wifi/WifiServiceImpl.java index 5b109138e..be24e49a9 100644 --- a/service/java/com/android/server/wifi/WifiServiceImpl.java +++ b/service/java/com/android/server/wifi/WifiServiceImpl.java @@ -346,6 +346,8 @@ public class WifiServiceImpl extends IWifiManager.Stub { mWifiStateMachineHandler = new WifiStateMachineHandler(wifiThread.getLooper()); mWifiController = new WifiController(mContext, mWifiStateMachine, mSettingsStore, mWifiLockManager, wifiThread.getLooper(), mFacade); + // Set the WifiController for WifiLastResortWatchdog + mWifiInjector.getWifiLastResortWatchdog().setWifiController(mWifiController); } |