summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2018-10-17 09:05:00 -0700
committerRoshan Pius <rpius@google.com>2018-10-17 11:22:29 -0700
commit317ade534d1e97ddfa2870a5e93b9e24c92c36e4 (patch)
tree8566bdf5fdfaa0a53933764f18a53ba10170b28e /service
parent8a8f9588cbecb8236ac724dd604a9a0a0d546ac7 (diff)
WifiLastResortWatchdog: Use injector to get SelfRecovery
To solve cyclic dependencies between WifiLastResortWatchdog & SelfRecovery via ClientModeImpl. Bug: 117867598 Test: Unit tests Test: Device boots up and connects to networks. Test: Manual test using an assert to ensure SelfRecovery is not null. Change-Id: I81b973157b0804a5b8002dba71c57a2977ce4421
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiInjector.java2
-rw-r--r--service/java/com/android/server/wifi/WifiLastResortWatchdog.java9
2 files changed, 5 insertions, 6 deletions
diff --git a/service/java/com/android/server/wifi/WifiInjector.java b/service/java/com/android/server/wifi/WifiInjector.java
index 24e125a29..a0dd45545 100644
--- a/service/java/com/android/server/wifi/WifiInjector.java
+++ b/service/java/com/android/server/wifi/WifiInjector.java
@@ -525,7 +525,7 @@ public class WifiInjector {
mWifiCoreHandlerThread.getLooper(), mFrameworkFacade, mClock, mWifiMetrics,
mWifiConfigManager, mWifiConfigStore, clientModeImpl,
new ConnectToNetworkNotificationBuilder(mContext, mFrameworkFacade));
- mWifiLastResortWatchdog = new WifiLastResortWatchdog(mSelfRecovery, mClock,
+ mWifiLastResortWatchdog = new WifiLastResortWatchdog(this, mClock,
mWifiMetrics, clientModeImpl, clientModeImpl.getHandler().getLooper());
return new WifiConnectivityManager(mContext, getScoringParams(),
clientModeImpl, this,
diff --git a/service/java/com/android/server/wifi/WifiLastResortWatchdog.java b/service/java/com/android/server/wifi/WifiLastResortWatchdog.java
index 6a9b2f825..87d060d9b 100644
--- a/service/java/com/android/server/wifi/WifiLastResortWatchdog.java
+++ b/service/java/com/android/server/wifi/WifiLastResortWatchdog.java
@@ -87,7 +87,7 @@ public class WifiLastResortWatchdog {
private boolean mWatchdogAllowedToTrigger = true;
private long mTimeLastTrigger;
- private SelfRecovery mSelfRecovery;
+ private WifiInjector mWifiInjector;
private WifiMetrics mWifiMetrics;
private ClientModeImpl mClientModeImpl;
private Looper mClientModeImplLooper;
@@ -97,9 +97,9 @@ public class WifiLastResortWatchdog {
// did not fix the problem
private boolean mWatchdogFixedWifi = true;
- WifiLastResortWatchdog(SelfRecovery selfRecovery, Clock clock, WifiMetrics wifiMetrics,
+ WifiLastResortWatchdog(WifiInjector wifiInjector, Clock clock, WifiMetrics wifiMetrics,
ClientModeImpl clientModeImpl, Looper clientModeImplLooper) {
- mSelfRecovery = selfRecovery;
+ mWifiInjector = wifiInjector;
mClock = clock;
mWifiMetrics = wifiMetrics;
mClientModeImpl = clientModeImpl;
@@ -225,8 +225,7 @@ public class WifiLastResortWatchdog {
mWatchdogFixedWifi = true;
Log.e(TAG, "Watchdog triggering recovery");
mTimeLastTrigger = mClock.getElapsedSinceBootMillis();
- mSelfRecovery.trigger(SelfRecovery.REASON_LAST_RESORT_WATCHDOG);
- // increment various watchdog trigger count stats
+ mWifiInjector.getSelfRecovery().trigger(SelfRecovery.REASON_LAST_RESORT_WATCHDOG);
incrementWifiMetricsTriggerCounts();
clearAllFailureCounts();
}