summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorRebecca Silberstein <silberst@google.com>2016-11-30 18:01:10 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-11-30 18:01:10 +0000
commit671a6d626dc3297f0de822fb45aedea8a1e4d43a (patch)
tree0a06c88a30a6e0e2d553eafb18e90146f43dc27e /service
parent21eb6963363f96064964b33dd7fbc0616b712cd1 (diff)
parent585cd77a9c472af47ecd67ccd47e119b6a26bc38 (diff)
Merge "WifiInjector: add WifiConnectivityManager"
am: 585cd77a9c Change-Id: I7666adfdcf01c55bb470267e96c61a7efdbf0e5c
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiConnectivityManager.java10
-rw-r--r--service/java/com/android/server/wifi/WifiInjector.java18
-rw-r--r--service/java/com/android/server/wifi/WifiStateMachine.java7
3 files changed, 26 insertions, 9 deletions
diff --git a/service/java/com/android/server/wifi/WifiConnectivityManager.java b/service/java/com/android/server/wifi/WifiConnectivityManager.java
index 5210adcaa..0576ba566 100644
--- a/service/java/com/android/server/wifi/WifiConnectivityManager.java
+++ b/service/java/com/android/server/wifi/WifiConnectivityManager.java
@@ -465,19 +465,19 @@ public class WifiConnectivityManager {
*/
WifiConnectivityManager(Context context, WifiStateMachine stateMachine,
WifiScanner scanner, WifiConfigManager configManager, WifiInfo wifiInfo,
- WifiNetworkSelector networkSelector, WifiInjector wifiInjector, Looper looper,
- boolean enable) {
+ WifiNetworkSelector networkSelector, WifiLastResortWatchdog wifiLastResortWatchdog,
+ WifiMetrics wifiMetrics, Looper looper, Clock clock, boolean enable) {
mStateMachine = stateMachine;
mScanner = scanner;
mConfigManager = configManager;
mWifiInfo = wifiInfo;
mNetworkSelector = networkSelector;
mLocalLog = networkSelector.getLocalLog();
- mWifiLastResortWatchdog = wifiInjector.getWifiLastResortWatchdog();
- mWifiMetrics = wifiInjector.getWifiMetrics();
+ mWifiLastResortWatchdog = wifiLastResortWatchdog;
+ mWifiMetrics = wifiMetrics;
mAlarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
mEventHandler = new Handler(looper);
- mClock = wifiInjector.getClock();
+ mClock = clock;
mConnectionAttemptTimeStamps = new LinkedList<>();
mMin5GHzRssi = context.getResources().getInteger(
diff --git a/service/java/com/android/server/wifi/WifiInjector.java b/service/java/com/android/server/wifi/WifiInjector.java
index bfe6446af..63787dfb0 100644
--- a/service/java/com/android/server/wifi/WifiInjector.java
+++ b/service/java/com/android/server/wifi/WifiInjector.java
@@ -21,6 +21,7 @@ import android.net.wifi.IApInterface;
import android.net.wifi.IWifiScanner;
import android.net.wifi.IWificond;
import android.net.wifi.WifiConfiguration;
+import android.net.wifi.WifiInfo;
import android.net.wifi.WifiScanner;
import android.os.HandlerThread;
import android.os.IBinder;
@@ -358,6 +359,23 @@ public class WifiInjector {
return mWifiNetworkSelector;
}
+ /**
+ * Obtain a new instance of WifiConnectivityManager.
+ *
+ * Create and return a new WifiConnectivityManager.
+ * @param wifiInfo WifiInfo object for updating wifi state.
+ * @param hasConnectionRequests boolean indicating if WifiConnectivityManager to start
+ * immediately based on connection requests.
+ */
+ public WifiConnectivityManager makeWifiConnectivityManager(WifiInfo wifiInfo,
+ boolean hasConnectionRequests) {
+ return new WifiConnectivityManager(mContext, mWifiStateMachine, getWifiScanner(),
+ mWifiConfigManager, wifiInfo, mWifiNetworkSelector,
+ mWifiLastResortWatchdog, mWifiMetrics,
+ mWifiStateMachineHandlerThread.getLooper(), mClock,
+ hasConnectionRequests);
+ }
+
public WifiPermissionsUtil getWifiPermissionsUtil() {
return mWifiPermissionsUtil;
}
diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java
index ad13d00a0..952300636 100644
--- a/service/java/com/android/server/wifi/WifiStateMachine.java
+++ b/service/java/com/android/server/wifi/WifiStateMachine.java
@@ -4137,10 +4137,9 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss
mWifiScanner = mWifiInjector.getWifiScanner();
synchronized (mWifiReqCountLock) {
- mWifiConnectivityManager = new WifiConnectivityManager(mContext,
- WifiStateMachine.this, mWifiScanner, mWifiConfigManager, mWifiInfo,
- mWifiNetworkSelector, mWifiInjector,
- getHandler().getLooper(), hasConnectionRequests());
+ mWifiConnectivityManager =
+ mWifiInjector.makeWifiConnectivityManager(mWifiInfo,
+ hasConnectionRequests());
mWifiConnectivityManager.setUntrustedConnectionAllowed(mUntrustedReqCount > 0);
mWifiConnectivityManager.handleScreenStateChanged(mScreenOn);
}