Split WifiStateMachine from WifiStateTracker

Notifications handled in WifiService. WifiStateTracker tracks
state for connectivity service

Change-Id: Idb0cf494898d28712af0f95f9e60c5417cd4a053
This commit is contained in:
Irfan Sheriff
2010-07-28 09:35:20 -07:00
parent 4a1052ea35
commit 25be076f74

View File

@@ -314,14 +314,14 @@ public class ConnectivityService extends IConnectivityManager.Stub {
case ConnectivityManager.TYPE_WIFI: case ConnectivityManager.TYPE_WIFI:
if (DBG) Slog.v(TAG, "Starting Wifi Service."); if (DBG) Slog.v(TAG, "Starting Wifi Service.");
WifiStateTracker wst = new WifiStateTracker(context, mHandler); WifiStateTracker wst = new WifiStateTracker(context, mHandler);
WifiService wifiService = new WifiService(context, wst); WifiService wifiService = new WifiService(context);
ServiceManager.addService(Context.WIFI_SERVICE, wifiService); ServiceManager.addService(Context.WIFI_SERVICE, wifiService);
wifiService.startWifi(); wifiService.checkAndStartWifi();
mNetTrackers[ConnectivityManager.TYPE_WIFI] = wst; mNetTrackers[ConnectivityManager.TYPE_WIFI] = wst;
wst.startMonitoring(); wst.startMonitoring();
//TODO: as part of WWS refactor, create only when needed //TODO: as part of WWS refactor, create only when needed
mWifiWatchdogService = new WifiWatchdogService(context, wst); mWifiWatchdogService = new WifiWatchdogService(context);
break; break;
case ConnectivityManager.TYPE_MOBILE: case ConnectivityManager.TYPE_MOBILE:
@@ -1205,16 +1205,6 @@ public class ConnectivityService extends IConnectivityManager.Stub {
sendConnectedBroadcast(info); sendConnectedBroadcast(info);
} }
private void handleScanResultsAvailable(NetworkInfo info) {
int networkType = info.getType();
if (networkType != ConnectivityManager.TYPE_WIFI) {
if (DBG) Slog.v(TAG, "Got ScanResultsAvailable for " +
info.getTypeName() + " network. Don't know how to handle.");
}
mNetTrackers[networkType].interpretScanResultsAvailable();
}
private void handleNotificationChange(boolean visible, int id, private void handleNotificationChange(boolean visible, int id,
Notification notification) { Notification notification) {
NotificationManager notificationManager = (NotificationManager) mContext NotificationManager notificationManager = (NotificationManager) mContext
@@ -1619,11 +1609,6 @@ public class ConnectivityService extends IConnectivityManager.Stub {
} }
break; break;
case NetworkStateTracker.EVENT_SCAN_RESULTS_AVAILABLE:
info = (NetworkInfo) msg.obj;
handleScanResultsAvailable(info);
break;
case NetworkStateTracker.EVENT_NOTIFICATION_CHANGED: case NetworkStateTracker.EVENT_NOTIFICATION_CHANGED:
handleNotificationChange(msg.arg1 == 1, msg.arg2, handleNotificationChange(msg.arg1 == 1, msg.arg2,
(Notification) msg.obj); (Notification) msg.obj);