summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Greenwalt <robdroid@android.com>2010-01-25 17:54:29 -0800
committerRobert Greenwalt <robdroid@android.com>2010-01-25 17:54:29 -0800
commitcc4b4016e4b86db012f94bb889e5ca61ff362171 (patch)
tree07c0ed9947d212533c0db058a642a18da508bfb3
parent5381e4ef4ef1a05b25fa39ff942f4a95e0ae4750 (diff)
downloadbase-cc4b4016e4b86db012f94bb889e5ca61ff362171.tar.gz
Fix the reporting of NO_CONNECTIVITY.
A refactoring of handleDisconnect instroduced a bug - we were reporting NO_CONNECTIVITY after any non-primary network (supl, mms, hipri) was lost. bug:2395006 Change-Id: Ifa9e008872ec646981a35f2c316120cb9685a6a4
-rw-r--r--services/java/com/android/server/ConnectivityService.java33
1 files changed, 20 insertions, 13 deletions
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java
index 45eb6721092e..3d7025d131dd 100644
--- a/services/java/com/android/server/ConnectivityService.java
+++ b/services/java/com/android/server/ConnectivityService.java
@@ -811,12 +811,15 @@ public class ConnectivityService extends IConnectivityManager.Stub {
info.getExtraInfo());
}
- NetworkStateTracker newNet = tryFailover(prevNetType);
- if (newNet != null) {
- NetworkInfo switchTo = newNet.getNetworkInfo();
- intent.putExtra(ConnectivityManager.EXTRA_OTHER_NETWORK_INFO, switchTo);
- } else {
- intent.putExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, true);
+ NetworkStateTracker newNet = null;
+ if (mNetAttributes[prevNetType].isDefault()) {
+ newNet = tryFailover(prevNetType);
+ if (newNet != null) {
+ NetworkInfo switchTo = newNet.getNetworkInfo();
+ intent.putExtra(ConnectivityManager.EXTRA_OTHER_NETWORK_INFO, switchTo);
+ } else {
+ intent.putExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, true);
+ }
}
// do this before we broadcast the change
handleConnectivityChange();
@@ -831,7 +834,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
}
}
- // returns -1 if no failover available
+ // returns null if no failover available
private NetworkStateTracker tryFailover(int prevNetType) {
/*
* If this is a default network, check if other defaults are available
@@ -953,13 +956,17 @@ public class ConnectivityService extends IConnectivityManager.Stub {
info.setFailover(false);
}
- NetworkStateTracker newNet = tryFailover(info.getType());
- if (newNet != null) {
- NetworkInfo switchTo = newNet.getNetworkInfo();
- intent.putExtra(ConnectivityManager.EXTRA_OTHER_NETWORK_INFO, switchTo);
- } else {
- intent.putExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, true);
+ NetworkStateTracker newNet = null;
+ if (mNetAttributes[info.getType()].isDefault()) {
+ newNet = tryFailover(info.getType());
+ if (newNet != null) {
+ NetworkInfo switchTo = newNet.getNetworkInfo();
+ intent.putExtra(ConnectivityManager.EXTRA_OTHER_NETWORK_INFO, switchTo);
+ } else {
+ intent.putExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, true);
+ }
}
+
// do this before we broadcast the change
handleConnectivityChange();