Add documentation to NetworkStateTracker and a small change to the API. am: 7fabfa2e6c
Original change: undetermined Change-Id: I4af766780d3f127707c615025f4a5f0ed05173f0
This commit is contained in:
@@ -313,21 +313,21 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
switch (mNetAttributes[netType].mRadio) {
|
switch (mNetAttributes[netType].mRadio) {
|
||||||
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();
|
||||||
WifiService wifiService = new WifiService(context);
|
WifiService wifiService = new WifiService(context);
|
||||||
ServiceManager.addService(Context.WIFI_SERVICE, wifiService);
|
ServiceManager.addService(Context.WIFI_SERVICE, wifiService);
|
||||||
wifiService.checkAndStartWifi();
|
wifiService.checkAndStartWifi();
|
||||||
mNetTrackers[ConnectivityManager.TYPE_WIFI] = wst;
|
mNetTrackers[ConnectivityManager.TYPE_WIFI] = wst;
|
||||||
wst.startMonitoring();
|
wst.startMonitoring(context, mHandler);
|
||||||
|
|
||||||
//TODO: as part of WWS refactor, create only when needed
|
//TODO: as part of WWS refactor, create only when needed
|
||||||
mWifiWatchdogService = new WifiWatchdogService(context);
|
mWifiWatchdogService = new WifiWatchdogService(context);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case ConnectivityManager.TYPE_MOBILE:
|
case ConnectivityManager.TYPE_MOBILE:
|
||||||
mNetTrackers[netType] = new MobileDataStateTracker(context, mHandler,
|
mNetTrackers[netType] = new MobileDataStateTracker(netType,
|
||||||
netType, mNetAttributes[netType].mName);
|
mNetAttributes[netType].mName);
|
||||||
mNetTrackers[netType].startMonitoring();
|
mNetTrackers[netType].startMonitoring(context, mHandler);
|
||||||
if (noMobileData) {
|
if (noMobileData) {
|
||||||
if (DBG) Slog.d(TAG, "tearing down Mobile networks due to setting");
|
if (DBG) Slog.d(TAG, "tearing down Mobile networks due to setting");
|
||||||
mNetTrackers[netType].teardown();
|
mNetTrackers[netType].teardown();
|
||||||
@@ -1205,18 +1205,6 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
sendConnectedBroadcast(info);
|
sendConnectedBroadcast(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleNotificationChange(boolean visible, int id,
|
|
||||||
Notification notification) {
|
|
||||||
NotificationManager notificationManager = (NotificationManager) mContext
|
|
||||||
.getSystemService(Context.NOTIFICATION_SERVICE);
|
|
||||||
|
|
||||||
if (visible) {
|
|
||||||
notificationManager.notify(id, notification);
|
|
||||||
} else {
|
|
||||||
notificationManager.cancel(id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* After a change in the connectivity state of a network. We're mainly
|
* After a change in the connectivity state of a network. We're mainly
|
||||||
* concerned with making sure that the list of DNS servers is set up
|
* concerned with making sure that the list of DNS servers is set up
|
||||||
@@ -1608,25 +1596,12 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
handleConnect(info);
|
handleConnect(info);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NetworkStateTracker.EVENT_NOTIFICATION_CHANGED:
|
|
||||||
handleNotificationChange(msg.arg1 == 1, msg.arg2,
|
|
||||||
(Notification) msg.obj);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case NetworkStateTracker.EVENT_CONFIGURATION_CHANGED:
|
case NetworkStateTracker.EVENT_CONFIGURATION_CHANGED:
|
||||||
// TODO - make this handle ip/proxy/gateway/dns changes
|
// TODO - make this handle ip/proxy/gateway/dns changes
|
||||||
info = (NetworkInfo) msg.obj;
|
info = (NetworkInfo) msg.obj;
|
||||||
type = info.getType();
|
type = info.getType();
|
||||||
handleDnsConfigurationChange(type);
|
handleDnsConfigurationChange(type);
|
||||||
break;
|
break;
|
||||||
case NetworkStateTracker.EVENT_ROAMING_CHANGED:
|
|
||||||
// fill me in
|
|
||||||
break;
|
|
||||||
|
|
||||||
case NetworkStateTracker.EVENT_NETWORK_SUBTYPE_CHANGED:
|
|
||||||
// fill me in
|
|
||||||
break;
|
|
||||||
case NetworkStateTracker.EVENT_RESTORE_DEFAULT_NETWORK:
|
case NetworkStateTracker.EVENT_RESTORE_DEFAULT_NETWORK:
|
||||||
FeatureUser u = (FeatureUser)msg.obj;
|
FeatureUser u = (FeatureUser)msg.obj;
|
||||||
u.expire();
|
u.expire();
|
||||||
|
|||||||
Reference in New Issue
Block a user