Whitespace cleanup prior to real work.

This commit is contained in:
Robert Greenwalt
2009-07-16 17:21:39 -07:00
parent 1791998080
commit 0659da31df

View File

@@ -74,7 +74,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
private static class ConnectivityThread extends Thread { private static class ConnectivityThread extends Thread {
private Context mContext; private Context mContext;
private ConnectivityThread(Context context) { private ConnectivityThread(Context context) {
super("ConnectivityThread"); super("ConnectivityThread");
mContext = context; mContext = context;
@@ -89,11 +89,11 @@ public class ConnectivityService extends IConnectivityManager.Stub {
} }
Looper.loop(); Looper.loop();
} }
public static ConnectivityService getServiceInstance(Context context) { public static ConnectivityService getServiceInstance(Context context) {
ConnectivityThread thread = new ConnectivityThread(context); ConnectivityThread thread = new ConnectivityThread(context);
thread.start(); thread.start();
synchronized (thread) { synchronized (thread) {
while (sServiceInstance == null) { while (sServiceInstance == null) {
try { try {
@@ -101,27 +101,28 @@ public class ConnectivityService extends IConnectivityManager.Stub {
thread.wait(); thread.wait();
} catch (InterruptedException ignore) { } catch (InterruptedException ignore) {
Log.e(TAG, Log.e(TAG,
"Unexpected InterruptedException while waiting for ConnectivityService thread"); "Unexpected InterruptedException while waiting"+
" for ConnectivityService thread");
} }
} }
} }
return sServiceInstance; return sServiceInstance;
} }
} }
public static ConnectivityService getInstance(Context context) { public static ConnectivityService getInstance(Context context) {
return ConnectivityThread.getServiceInstance(context); return ConnectivityThread.getServiceInstance(context);
} }
private ConnectivityService(Context context) { private ConnectivityService(Context context) {
if (DBG) Log.v(TAG, "ConnectivityService starting up"); if (DBG) Log.v(TAG, "ConnectivityService starting up");
mContext = context; mContext = context;
mNetTrackers = new NetworkStateTracker[2]; mNetTrackers = new NetworkStateTracker[2];
Handler handler = new MyHandler(); Handler handler = new MyHandler();
mNetworkPreference = getPersistedNetworkPreference(); mNetworkPreference = getPersistedNetworkPreference();
/* /*
* Create the network state trackers for Wi-Fi and mobile * Create the network state trackers for Wi-Fi and mobile
* data. Maybe this could be done with a factory class, * data. Maybe this could be done with a factory class,
@@ -137,7 +138,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
mMobileDataStateTracker = new MobileDataStateTracker(context, handler); mMobileDataStateTracker = new MobileDataStateTracker(context, handler);
mNetTrackers[ConnectivityManager.TYPE_MOBILE] = mMobileDataStateTracker; mNetTrackers[ConnectivityManager.TYPE_MOBILE] = mMobileDataStateTracker;
mActiveNetwork = null; mActiveNetwork = null;
mNumDnsEntries = 0; mNumDnsEntries = 0;
@@ -148,11 +149,12 @@ public class ConnectivityService extends IConnectivityManager.Stub {
t.startMonitoring(); t.startMonitoring();
// Constructing this starts it too // Constructing this starts it too
mWifiWatchdogService = new WifiWatchdogService(context, mWifiStateTracker); mWifiWatchdogService = new WifiWatchdogService(context,
mWifiStateTracker);
} }
/** /**
* Sets the preferred network. * Sets the preferred network.
* @param preference the new preference * @param preference the new preference
*/ */
public synchronized void setNetworkPreference(int preference) { public synchronized void setNetworkPreference(int preference) {
@@ -173,9 +175,10 @@ public class ConnectivityService extends IConnectivityManager.Stub {
private void persistNetworkPreference(int networkPreference) { private void persistNetworkPreference(int networkPreference) {
final ContentResolver cr = mContext.getContentResolver(); final ContentResolver cr = mContext.getContentResolver();
Settings.Secure.putInt(cr, Settings.Secure.NETWORK_PREFERENCE, networkPreference); Settings.Secure.putInt(cr, Settings.Secure.NETWORK_PREFERENCE,
networkPreference);
} }
private int getPersistedNetworkPreference() { private int getPersistedNetworkPreference() {
final ContentResolver cr = mContext.getContentResolver(); final ContentResolver cr = mContext.getContentResolver();
@@ -187,9 +190,9 @@ public class ConnectivityService extends IConnectivityManager.Stub {
return ConnectivityManager.DEFAULT_NETWORK_PREFERENCE; return ConnectivityManager.DEFAULT_NETWORK_PREFERENCE;
} }
/** /**
* Make the state of network connectivity conform to the preference settings. * Make the state of network connectivity conform to the preference settings
* In this method, we only tear down a non-preferred network. Establishing * In this method, we only tear down a non-preferred network. Establishing
* a connection to the preferred network is taken care of when we handle * a connection to the preferred network is taken care of when we handle
* the disconnect event from the non-preferred network * the disconnect event from the non-preferred network
@@ -207,7 +210,8 @@ public class ConnectivityService extends IConnectivityManager.Stub {
ConnectivityManager.TYPE_WIFI); ConnectivityManager.TYPE_WIFI);
if (t.getNetworkInfo().getType() != mNetworkPreference) { if (t.getNetworkInfo().getType() != mNetworkPreference) {
NetworkStateTracker otherTracker = mNetTrackers[otherNetType]; NetworkStateTracker otherTracker =
mNetTrackers[otherNetType];
if (otherTracker.isAvailable()) { if (otherTracker.isAvailable()) {
teardown(t); teardown(t);
} }
@@ -229,7 +233,8 @@ public class ConnectivityService extends IConnectivityManager.Stub {
* Return NetworkInfo for the active (i.e., connected) network interface. * Return NetworkInfo for the active (i.e., connected) network interface.
* It is assumed that at most one network is active at a time. If more * It is assumed that at most one network is active at a time. If more
* than one is active, it is indeterminate which will be returned. * than one is active, it is indeterminate which will be returned.
* @return the info for the active network, or {@code null} if none is active * @return the info for the active network, or {@code null} if none is
* active
*/ */
public NetworkInfo getActiveNetworkInfo() { public NetworkInfo getActiveNetworkInfo() {
enforceAccessPermission(); enforceAccessPermission();
@@ -287,7 +292,8 @@ public class ConnectivityService extends IConnectivityManager.Stub {
} }
NetworkStateTracker tracker = mNetTrackers[networkType]; NetworkStateTracker tracker = mNetTrackers[networkType];
if (tracker != null) { if (tracker != null) {
return tracker.startUsingNetworkFeature(feature, getCallingPid(), getCallingUid()); return tracker.startUsingNetworkFeature(feature, getCallingPid(),
getCallingUid());
} }
return -1; return -1;
} }
@@ -299,7 +305,8 @@ public class ConnectivityService extends IConnectivityManager.Stub {
} }
NetworkStateTracker tracker = mNetTrackers[networkType]; NetworkStateTracker tracker = mNetTrackers[networkType];
if (tracker != null) { if (tracker != null) {
return tracker.stopUsingNetworkFeature(feature, getCallingPid(), getCallingUid()); return tracker.stopUsingNetworkFeature(feature, getCallingPid(),
getCallingUid());
} }
return -1; return -1;
} }
@@ -307,9 +314,10 @@ public class ConnectivityService extends IConnectivityManager.Stub {
/** /**
* Ensure that a network route exists to deliver traffic to the specified * Ensure that a network route exists to deliver traffic to the specified
* host via the specified network interface. * host via the specified network interface.
* @param networkType the type of the network over which traffic to the specified * @param networkType the type of the network over which traffic to the
* host is to be routed * specified host is to be routed
* @param hostAddress the IP address of the host to which the route is desired * @param hostAddress the IP address of the host to which the route is
* desired
* @return {@code true} on success, {@code false} on failure * @return {@code true} on success, {@code false} on failure
*/ */
public boolean requestRouteToHost(int networkType, int hostAddress) { public boolean requestRouteToHost(int networkType, int hostAddress) {
@@ -340,7 +348,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
return Settings.Secure.getInt(mContext.getContentResolver(), return Settings.Secure.getInt(mContext.getContentResolver(),
Settings.Secure.BACKGROUND_DATA, 1) == 1; Settings.Secure.BACKGROUND_DATA, 1) == 1;
} }
/** /**
* @see ConnectivityManager#setBackgroundDataSetting(boolean) * @see ConnectivityManager#setBackgroundDataSetting(boolean)
*/ */
@@ -348,22 +356,24 @@ public class ConnectivityService extends IConnectivityManager.Stub {
mContext.enforceCallingOrSelfPermission( mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.CHANGE_BACKGROUND_DATA_SETTING, android.Manifest.permission.CHANGE_BACKGROUND_DATA_SETTING,
"ConnectivityService"); "ConnectivityService");
if (getBackgroundDataSetting() == allowBackgroundDataUsage) return; if (getBackgroundDataSetting() == allowBackgroundDataUsage) return;
Settings.Secure.putInt(mContext.getContentResolver(), Settings.Secure.putInt(mContext.getContentResolver(),
Settings.Secure.BACKGROUND_DATA, allowBackgroundDataUsage ? 1 : 0); Settings.Secure.BACKGROUND_DATA,
allowBackgroundDataUsage ? 1 : 0);
Intent broadcast = new Intent( Intent broadcast = new Intent(
ConnectivityManager.ACTION_BACKGROUND_DATA_SETTING_CHANGED); ConnectivityManager.ACTION_BACKGROUND_DATA_SETTING_CHANGED);
mContext.sendBroadcast(broadcast); mContext.sendBroadcast(broadcast);
} }
private int getNumConnectedNetworks() { private int getNumConnectedNetworks() {
int numConnectedNets = 0; int numConnectedNets = 0;
for (NetworkStateTracker nt : mNetTrackers) { for (NetworkStateTracker nt : mNetTrackers) {
if (nt.getNetworkInfo().isConnected() && !nt.isTeardownRequested()) { if (nt.getNetworkInfo().isConnected() &&
!nt.isTeardownRequested()) {
++numConnectedNets; ++numConnectedNets;
} }
} }
@@ -371,21 +381,22 @@ public class ConnectivityService extends IConnectivityManager.Stub {
} }
private void enforceAccessPermission() { private void enforceAccessPermission() {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.ACCESS_NETWORK_STATE, mContext.enforceCallingOrSelfPermission(
"ConnectivityService"); android.Manifest.permission.ACCESS_NETWORK_STATE,
"ConnectivityService");
} }
private void enforceChangePermission() { private void enforceChangePermission() {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.CHANGE_NETWORK_STATE, mContext.enforceCallingOrSelfPermission(
"ConnectivityService"); android.Manifest.permission.CHANGE_NETWORK_STATE,
"ConnectivityService");
} }
/** /**
* Handle a {@code DISCONNECTED} event. If this pertains to the non-active network, * Handle a {@code DISCONNECTED} event. If this pertains to the non-active
* we ignore it. If it is for the active network, we send out a broadcast. * network, we ignore it. If it is for the active network, we send out a
* But first, we check whether it might be possible to connect to a different * broadcast. But first, we check whether it might be possible to connect
* network. * to a different network.
* @param info the {@code NetworkInfo} for the network * @param info the {@code NetworkInfo} for the network
*/ */
private void handleDisconnect(NetworkInfo info) { private void handleDisconnect(NetworkInfo info) {
@@ -399,7 +410,8 @@ public class ConnectivityService extends IConnectivityManager.Stub {
* getting the disconnect for a network that we explicitly disabled * getting the disconnect for a network that we explicitly disabled
* in accordance with network preference policies. * in accordance with network preference policies.
*/ */
if (mActiveNetwork == null || info.getType() != mActiveNetwork.getNetworkInfo().getType()) if (mActiveNetwork == null ||
info.getType() != mActiveNetwork.getNetworkInfo().getType())
return; return;
NetworkStateTracker newNet; NetworkStateTracker newNet;
@@ -439,28 +451,33 @@ public class ConnectivityService extends IConnectivityManager.Stub {
intent.putExtra(ConnectivityManager.EXTRA_REASON, info.getReason()); intent.putExtra(ConnectivityManager.EXTRA_REASON, info.getReason());
} }
if (info.getExtraInfo() != null) { if (info.getExtraInfo() != null) {
intent.putExtra(ConnectivityManager.EXTRA_EXTRA_INFO, info.getExtraInfo()); intent.putExtra(ConnectivityManager.EXTRA_EXTRA_INFO,
info.getExtraInfo());
} }
if (switchTo != null) { if (switchTo != null) {
otherNetworkConnected = switchTo.isConnected(); otherNetworkConnected = switchTo.isConnected();
if (DBG) { if (DBG) {
if (otherNetworkConnected) { if (otherNetworkConnected) {
Log.v(TAG, "Switching to already connected " + switchTo.getTypeName()); Log.v(TAG, "Switching to already connected " +
switchTo.getTypeName());
} else { } else {
Log.v(TAG, "Attempting to switch to " + switchTo.getTypeName()); Log.v(TAG, "Attempting to switch to " +
switchTo.getTypeName());
} }
} }
intent.putExtra(ConnectivityManager.EXTRA_OTHER_NETWORK_INFO, switchTo); intent.putExtra(ConnectivityManager.EXTRA_OTHER_NETWORK_INFO,
switchTo);
} else { } else {
intent.putExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, true); intent.putExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, true);
} }
if (DBG) Log.v(TAG, "Sending DISCONNECT bcast for " + info.getTypeName() + if (DBG) Log.v(TAG, "Sending DISCONNECT bcast for " +
info.getTypeName() +
(switchTo == null ? "" : " other=" + switchTo.getTypeName())); (switchTo == null ? "" : " other=" + switchTo.getTypeName()));
mContext.sendStickyBroadcast(intent); mContext.sendStickyBroadcast(intent);
/* /*
* If the failover network is already connected, then immediately send out * If the failover network is already connected, then immediately send
* a followup broadcast indicating successful failover * out a followup broadcast indicating successful failover
*/ */
if (switchTo != null && otherNetworkConnected) if (switchTo != null && otherNetworkConnected)
sendConnectedBroadcast(switchTo); sendConnectedBroadcast(switchTo);
@@ -477,7 +494,8 @@ public class ConnectivityService extends IConnectivityManager.Stub {
intent.putExtra(ConnectivityManager.EXTRA_REASON, info.getReason()); intent.putExtra(ConnectivityManager.EXTRA_REASON, info.getReason());
} }
if (info.getExtraInfo() != null) { if (info.getExtraInfo() != null) {
intent.putExtra(ConnectivityManager.EXTRA_EXTRA_INFO, info.getExtraInfo()); intent.putExtra(ConnectivityManager.EXTRA_EXTRA_INFO,
info.getExtraInfo());
} }
mContext.sendStickyBroadcast(intent); mContext.sendStickyBroadcast(intent);
} }
@@ -499,9 +517,10 @@ public class ConnectivityService extends IConnectivityManager.Stub {
} else { } else {
reasonText = " (" + reason + ")."; reasonText = " (" + reason + ").";
} }
Log.v(TAG, "Attempt to connect to " + info.getTypeName() + " failed" + reasonText); Log.v(TAG, "Attempt to connect to " + info.getTypeName() +
" failed" + reasonText);
} }
Intent intent = new Intent(ConnectivityManager.CONNECTIVITY_ACTION); Intent intent = new Intent(ConnectivityManager.CONNECTIVITY_ACTION);
intent.putExtra(ConnectivityManager.EXTRA_NETWORK_INFO, info); intent.putExtra(ConnectivityManager.EXTRA_NETWORK_INFO, info);
intent.putExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, true); intent.putExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, true);
@@ -509,7 +528,8 @@ public class ConnectivityService extends IConnectivityManager.Stub {
intent.putExtra(ConnectivityManager.EXTRA_REASON, reason); intent.putExtra(ConnectivityManager.EXTRA_REASON, reason);
} }
if (extraInfo != null) { if (extraInfo != null) {
intent.putExtra(ConnectivityManager.EXTRA_EXTRA_INFO, extraInfo); intent.putExtra(ConnectivityManager.EXTRA_EXTRA_INFO,
extraInfo);
} }
if (info.isFailover()) { if (info.isFailover()) {
intent.putExtra(ConnectivityManager.EXTRA_IS_FAILOVER, true); intent.putExtra(ConnectivityManager.EXTRA_IS_FAILOVER, true);
@@ -562,32 +582,34 @@ public class ConnectivityService extends IConnectivityManager.Stub {
*/ */
if (!toredown || deadnet.getNetworkInfo().getType() != info.getType()) { if (!toredown || deadnet.getNetworkInfo().getType() != info.getType()) {
mActiveNetwork = thisNet; mActiveNetwork = thisNet;
if (DBG) Log.v(TAG, "Sending CONNECT bcast for " + info.getTypeName()); if (DBG) Log.v(TAG, "Sending CONNECT bcast for " +
info.getTypeName());
thisNet.updateNetworkSettings(); thisNet.updateNetworkSettings();
sendConnectedBroadcast(info); sendConnectedBroadcast(info);
if (isFailover) { if (isFailover) {
otherNet.releaseWakeLock(); otherNet.releaseWakeLock();
} }
} else { } else {
if (DBG) Log.v(TAG, "Not broadcasting CONNECT_ACTION to torn down network " + if (DBG) Log.v(TAG, "Not broadcasting CONNECT_ACTION to torn " +
info.getTypeName()); "down network " + info.getTypeName());
} }
} }
private void handleScanResultsAvailable(NetworkInfo info) { private void handleScanResultsAvailable(NetworkInfo info) {
int networkType = info.getType(); int networkType = info.getType();
if (networkType != ConnectivityManager.TYPE_WIFI) { if (networkType != ConnectivityManager.TYPE_WIFI) {
if (DBG) Log.v(TAG, "Got ScanResultsAvailable for " + info.getTypeName() + " network." if (DBG) Log.v(TAG, "Got ScanResultsAvailable for " +
+ " Don't know how to handle."); info.getTypeName() + " network. Don't know how to handle.");
} }
mNetTrackers[networkType].interpretScanResultsAvailable(); mNetTrackers[networkType].interpretScanResultsAvailable();
} }
private void handleNotificationChange(boolean visible, int id, Notification notification) { private void handleNotificationChange(boolean visible, int id,
Notification notification) {
NotificationManager notificationManager = (NotificationManager) mContext NotificationManager notificationManager = (NotificationManager) mContext
.getSystemService(Context.NOTIFICATION_SERVICE); .getSystemService(Context.NOTIFICATION_SERVICE);
if (visible) { if (visible) {
notificationManager.notify(id, notification); notificationManager.notify(id, notification);
} else { } else {
@@ -629,12 +651,15 @@ public class ConnectivityService extends IConnectivityManager.Stub {
int index = 1; int index = 1;
String lastDns = ""; String lastDns = "";
int numConnectedNets = 0; int numConnectedNets = 0;
int incrValue = ConnectivityManager.TYPE_MOBILE - ConnectivityManager.TYPE_WIFI; int incrValue = ConnectivityManager.TYPE_MOBILE -
ConnectivityManager.TYPE_WIFI;
int stopValue = ConnectivityManager.TYPE_MOBILE + incrValue; int stopValue = ConnectivityManager.TYPE_MOBILE + incrValue;
for (int netType = ConnectivityManager.TYPE_WIFI; netType != stopValue; netType += incrValue) { for (int netType = ConnectivityManager.TYPE_WIFI; netType != stopValue;
netType += incrValue) {
NetworkStateTracker nt = mNetTrackers[netType]; NetworkStateTracker nt = mNetTrackers[netType];
if (nt.getNetworkInfo().isConnected() && !nt.isTeardownRequested()) { if (nt.getNetworkInfo().isConnected() &&
!nt.isTeardownRequested()) {
++numConnectedNets; ++numConnectedNets;
String[] dnsList = nt.getNameServers(); String[] dnsList = nt.getNameServers();
for (int i = 0; i < dnsList.length && dnsList[i] != null; i++) { for (int i = 0; i < dnsList.length && dnsList[i] != null; i++) {
@@ -652,23 +677,26 @@ public class ConnectivityService extends IConnectivityManager.Stub {
} }
mNumDnsEntries = index - 1; mNumDnsEntries = index - 1;
// Notify the name resolver library of the change // Notify the name resolver library of the change
SystemProperties.set("net.dnschange", String.valueOf(sDnsChangeCounter++)); SystemProperties.set("net.dnschange",
String.valueOf(sDnsChangeCounter++));
return numConnectedNets; return numConnectedNets;
} }
@Override @Override
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) { protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP) if (mContext.checkCallingOrSelfPermission(
android.Manifest.permission.DUMP)
!= PackageManager.PERMISSION_GRANTED) { != PackageManager.PERMISSION_GRANTED) {
pw.println("Permission Denial: can't dump ConnectivityService from from pid=" pw.println("Permission Denial: can't dump ConnectivityService " +
+ Binder.getCallingPid() "from from pid=" + Binder.getCallingPid() + ", uid=" +
+ ", uid=" + Binder.getCallingUid()); Binder.getCallingUid());
return; return;
} }
if (mActiveNetwork == null) { if (mActiveNetwork == null) {
pw.println("No active network"); pw.println("No active network");
} else { } else {
pw.println("Active network: " + mActiveNetwork.getNetworkInfo().getTypeName()); pw.println("Active network: " +
mActiveNetwork.getNetworkInfo().getTypeName());
} }
pw.println(); pw.println();
for (NetworkStateTracker nst : mNetTrackers) { for (NetworkStateTracker nst : mNetTrackers) {
@@ -685,29 +713,37 @@ public class ConnectivityService extends IConnectivityManager.Stub {
switch (msg.what) { switch (msg.what) {
case NetworkStateTracker.EVENT_STATE_CHANGED: case NetworkStateTracker.EVENT_STATE_CHANGED:
info = (NetworkInfo) msg.obj; info = (NetworkInfo) msg.obj;
if (DBG) Log.v(TAG, "ConnectivityChange for " + info.getTypeName() + ": " + if (DBG) Log.v(TAG, "ConnectivityChange for " +
info.getTypeName() + ": " +
info.getState() + "/" + info.getDetailedState()); info.getState() + "/" + info.getDetailedState());
// Connectivity state changed: // Connectivity state changed:
// [31-13] Reserved for future use // [31-13] Reserved for future use
// [12-9] Network subtype (for mobile network, as defined by TelephonyManager) // [12-9] Network subtype (for mobile network, as defined
// [8-3] Detailed state ordinal (as defined by NetworkInfo.DetailedState) // by TelephonyManager)
// [8-3] Detailed state ordinal (as defined by
// NetworkInfo.DetailedState)
// [2-0] Network type (as defined by ConnectivityManager) // [2-0] Network type (as defined by ConnectivityManager)
int eventLogParam = (info.getType() & 0x7) | int eventLogParam = (info.getType() & 0x7) |
((info.getDetailedState().ordinal() & 0x3f) << 3) | ((info.getDetailedState().ordinal() & 0x3f) << 3) |
(info.getSubtype() << 9); (info.getSubtype() << 9);
EventLog.writeEvent(EVENTLOG_CONNECTIVITY_STATE_CHANGED, eventLogParam); EventLog.writeEvent(EVENTLOG_CONNECTIVITY_STATE_CHANGED,
eventLogParam);
if (info.getDetailedState() == NetworkInfo.DetailedState.FAILED) {
if (info.getDetailedState() ==
NetworkInfo.DetailedState.FAILED) {
handleConnectionFailure(info); handleConnectionFailure(info);
} else if (info.getState() == NetworkInfo.State.DISCONNECTED) { } else if (info.getState() ==
NetworkInfo.State.DISCONNECTED) {
handleDisconnect(info); handleDisconnect(info);
} else if (info.getState() == NetworkInfo.State.SUSPENDED) { } else if (info.getState() == NetworkInfo.State.SUSPENDED) {
// TODO: need to think this over. // TODO: need to think this over.
// the logic here is, handle SUSPENDED the same as DISCONNECTED. The // the logic here is, handle SUSPENDED the same as
// only difference being we are broadcasting an intent with NetworkInfo // DISCONNECTED. The only difference being we are
// that's suspended. This allows the applications an opportunity to // broadcasting an intent with NetworkInfo that's
// handle DISCONNECTED and SUSPENDED differently, or not. // suspended. This allows the applications an
// opportunity to handle DISCONNECTED and SUSPENDED
// differently, or not.
handleDisconnect(info); handleDisconnect(info);
} else if (info.getState() == NetworkInfo.State.CONNECTED) { } else if (info.getState() == NetworkInfo.State.CONNECTED) {
handleConnect(info); handleConnect(info);
@@ -719,9 +755,10 @@ public class ConnectivityService extends IConnectivityManager.Stub {
info = (NetworkInfo) msg.obj; info = (NetworkInfo) msg.obj;
handleScanResultsAvailable(info); handleScanResultsAvailable(info);
break; break;
case NetworkStateTracker.EVENT_NOTIFICATION_CHANGED: case NetworkStateTracker.EVENT_NOTIFICATION_CHANGED:
handleNotificationChange(msg.arg1 == 1, msg.arg2, (Notification) msg.obj); handleNotificationChange(msg.arg1 == 1, msg.arg2,
(Notification) msg.obj);
case NetworkStateTracker.EVENT_CONFIGURATION_CHANGED: case NetworkStateTracker.EVENT_CONFIGURATION_CHANGED:
handleConfigurationChange(); handleConfigurationChange();