summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2016-08-23 09:27:57 -0700
committerRoshan Pius <rpius@google.com>2016-08-24 13:40:57 -0700
commite445510f55e09d4c63ad08d725395563038cee76 (patch)
tree7c099bc2108a18384cdaee0100755762d5dc3746 /service
parentd58768eee13969fda1c4dd465b09aef6db30c14c (diff)
WifiInjector: Add WifiConfigManagerNew and dependencies.
Add the WifiConfigManagerNew object instantiation and all it's dependencies. Only the WifiConfigManagerNew & WifiSupplicantControl objects need to be exposed through getters. Refactored WifiStateMachine object instantiation to add WifiNative instance in the contructor and modified unit tests. BUG: 31009287 Change-Id: I6e757ec2a80813a8cc453cd0293cae679e5683ce TEST: Unit tests. TEST: Successfully tested Connection to a network on the device.
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiInjector.java42
-rw-r--r--service/java/com/android/server/wifi/WifiStateMachine.java6
2 files changed, 44 insertions, 4 deletions
diff --git a/service/java/com/android/server/wifi/WifiInjector.java b/service/java/com/android/server/wifi/WifiInjector.java
index 971e69e9c..b26f1c5f2 100644
--- a/service/java/com/android/server/wifi/WifiInjector.java
+++ b/service/java/com/android/server/wifi/WifiInjector.java
@@ -25,6 +25,7 @@ import android.os.IBinder;
import android.os.INetworkManagementService;
import android.os.ServiceManager;
import android.os.SystemProperties;
+import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Settings;
import android.security.KeyStore;
@@ -32,6 +33,8 @@ import android.telephony.TelephonyManager;
import com.android.internal.R;
import com.android.server.am.BatteryStatsService;
+import com.android.server.net.DelayedDiskWrite;
+import com.android.server.net.IpConfigStore;
import java.util.ArrayList;
@@ -56,6 +59,7 @@ public class WifiInjector {
private final WifiTrafficPoller mTrafficPoller;
private final WifiCountryCode mCountryCode;
private final BackupManagerProxy mBackupManagerProxy = new BackupManagerProxy();
+ private final WifiNative mWifiNative;
private final WifiStateMachine mWifiStateMachine;
private final WifiSettingsStore mSettingsStore;
private final WifiCertManager mCertManager;
@@ -70,6 +74,14 @@ public class WifiInjector {
private final KeyStore mKeyStore = KeyStore.getInstance();
private final WifiBackupRestore mWifiBackupRestore = new WifiBackupRestore();
private final WifiMulticastLockManager mWifiMulticastLockManager;
+ private final WifiConfigStoreNew mWifiConfigStore;
+ private final WifiKeyStore mWifiKeyStore;
+ private final WifiNetworkHistory mWifiNetworkHistory;
+ private final WifiSupplicantControl mWifiSupplicantControl;
+ private final IpConfigStore mIpConfigStore;
+ private final WifiConfigStoreLegacy mWifiConfigStoreLegacy;
+ private final WifiConfigManagerNew mWifiConfigManager;
+
private final boolean mUseRealLogger;
public WifiInjector(Context context) {
@@ -103,9 +115,10 @@ public class WifiInjector {
mFrameworkFacade.getStringSetting(mContext, Settings.Global.WIFI_COUNTRY_CODE),
mContext.getResources()
.getBoolean(R.bool.config_wifi_revert_country_code_on_cellular_loss));
+ mWifiNative = WifiNative.getWlanNativeInterface();
mWifiStateMachine = new WifiStateMachine(mContext, mFrameworkFacade,
mWifiStateMachineHandlerThread.getLooper(), UserManager.get(mContext),
- this, mBackupManagerProxy, mCountryCode);
+ this, mBackupManagerProxy, mCountryCode, mWifiNative);
mSettingsStore = new WifiSettingsStore(mContext);
mCertManager = new WifiCertManager(mContext);
mNotificationController = new WifiNotificationController(mContext,
@@ -117,6 +130,25 @@ public class WifiInjector {
mWifiLastResortWatchdog = new WifiLastResortWatchdog(mWifiController, mWifiMetrics);
mWifiMulticastLockManager = new WifiMulticastLockManager(mWifiStateMachine,
BatteryStatsService.getService());
+
+ // WifiConfigManager/Store objects and their dependencies.
+ // New config store
+ mWifiConfigStore = new WifiConfigStoreNew(mContext,
+ mWifiStateMachineHandlerThread.getLooper(), mClock,
+ WifiConfigStoreNew.createSharedFile(),
+ WifiConfigStoreNew.createUserFile(UserHandle.USER_SYSTEM));
+ mWifiKeyStore = new WifiKeyStore(mKeyStore);
+ // Legacy config store
+ DelayedDiskWrite writer = new DelayedDiskWrite();
+ mWifiNetworkHistory = new WifiNetworkHistory(mContext, mWifiNative.getLocalLog(), writer);
+ mWifiSupplicantControl = new WifiSupplicantControl(
+ TelephonyManager.from(mContext), mWifiNative, mWifiNative.getLocalLog());
+ mIpConfigStore = new IpConfigStore(writer);
+ mWifiConfigStoreLegacy = new WifiConfigStoreLegacy(
+ mWifiNetworkHistory, mWifiSupplicantControl, mIpConfigStore);
+ // Config Manager
+ mWifiConfigManager = new WifiConfigManagerNew(mContext, mFrameworkFacade, mClock,
+ UserManager.get(mContext), mWifiKeyStore, mWifiConfigStore, mWifiConfigStoreLegacy);
}
/**
@@ -213,6 +245,14 @@ public class WifiInjector {
return mWifiMulticastLockManager;
}
+ public WifiSupplicantControl getWifiSupplicantControl() {
+ return mWifiSupplicantControl;
+ }
+
+ public WifiConfigManagerNew getWifiConfigManager() {
+ return mWifiConfigManager;
+ }
+
public TelephonyManager makeTelephonyManager() {
// may not be available when WiFi starts
return (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java
index c1f163dce..11f504528 100644
--- a/service/java/com/android/server/wifi/WifiStateMachine.java
+++ b/service/java/com/android/server/wifi/WifiStateMachine.java
@@ -929,8 +929,8 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss
public WifiStateMachine(Context context, FrameworkFacade facade, Looper looper,
UserManager userManager, WifiInjector wifiInjector,
- BackupManagerProxy backupManagerProxy,
- WifiCountryCode countryCode) {
+ BackupManagerProxy backupManagerProxy, WifiCountryCode countryCode,
+ WifiNative wifiNative) {
super("WifiStateMachine", looper);
mWifiInjector = wifiInjector;
mWifiMetrics = mWifiInjector.getWifiMetrics();
@@ -939,7 +939,7 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss
mBuildProperties = wifiInjector.getBuildProperties();
mContext = context;
mFacade = facade;
- mWifiNative = WifiNative.getWlanNativeInterface();
+ mWifiNative = wifiNative;
mBackupManagerProxy = backupManagerProxy;
// TODO refactor WifiNative use of context out into it's own class