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
This commit is contained in:
@@ -811,13 +811,16 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
info.getExtraInfo());
|
info.getExtraInfo());
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkStateTracker newNet = tryFailover(prevNetType);
|
NetworkStateTracker newNet = null;
|
||||||
|
if (mNetAttributes[prevNetType].isDefault()) {
|
||||||
|
newNet = tryFailover(prevNetType);
|
||||||
if (newNet != null) {
|
if (newNet != null) {
|
||||||
NetworkInfo switchTo = newNet.getNetworkInfo();
|
NetworkInfo switchTo = newNet.getNetworkInfo();
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// do this before we broadcast the change
|
// do this before we broadcast the change
|
||||||
handleConnectivityChange();
|
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) {
|
private NetworkStateTracker tryFailover(int prevNetType) {
|
||||||
/*
|
/*
|
||||||
* If this is a default network, check if other defaults are available
|
* 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);
|
info.setFailover(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkStateTracker newNet = tryFailover(info.getType());
|
NetworkStateTracker newNet = null;
|
||||||
|
if (mNetAttributes[info.getType()].isDefault()) {
|
||||||
|
newNet = tryFailover(info.getType());
|
||||||
if (newNet != null) {
|
if (newNet != null) {
|
||||||
NetworkInfo switchTo = newNet.getNetworkInfo();
|
NetworkInfo switchTo = newNet.getNetworkInfo();
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// do this before we broadcast the change
|
// do this before we broadcast the change
|
||||||
handleConnectivityChange();
|
handleConnectivityChange();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user