am 6548f395: Merge "Inet status bug fix" into gingerbread

Merge commit '6548f395a974d2a8dcefe29b3a498d1ca87d8aef' into gingerbread-plus-aosp

* commit '6548f395a974d2a8dcefe29b3a498d1ca87d8aef':
  Inet status bug fix
This commit is contained in:
Robert Greenwalt
2010-09-21 08:22:59 -07:00
committed by Android Git Automerger
2 changed files with 25 additions and 13 deletions

View File

@@ -711,21 +711,20 @@ public class StatusBarPolicy {
ConnectivityManager.EXTRA_NETWORK_INFO)); ConnectivityManager.EXTRA_NETWORK_INFO));
int connectionStatus = intent.getIntExtra(ConnectivityManager.EXTRA_INET_CONDITION, 0); int connectionStatus = intent.getIntExtra(ConnectivityManager.EXTRA_INET_CONDITION, 0);
Slog.d(TAG, "got CONNECTIVITY_ACTION - info=" + info + ", status = " + connectionStatus); Slog.d(TAG, "got CONNECTIVITY_ACTION - info=" + info + ", status = " + connectionStatus);
if (info.isConnected() == false) return;
int inetCondition = (connectionStatus > INET_CONDITION_THRESHOLD ? 1 : 0);
switch (info.getType()) { switch (info.getType()) {
case ConnectivityManager.TYPE_MOBILE: case ConnectivityManager.TYPE_MOBILE:
if (info.isConnected()) { mInetCondition = inetCondition;
updateDataNetType(info.getSubtype(), connectionStatus); updateDataNetType(info.getSubtype());
updateDataIcon(); updateDataIcon();
updateSignalStrength(); // apply any change in connectionStatus updateSignalStrength(); // apply any change in connectionStatus
}
break; break;
case ConnectivityManager.TYPE_WIFI: case ConnectivityManager.TYPE_WIFI:
mInetCondition = inetCondition;
if (info.isConnected()) { if (info.isConnected()) {
mIsWifiConnected = true; mIsWifiConnected = true;
mInetCondition =
(connectionStatus > INET_CONDITION_THRESHOLD ? 1 : 0);
int iconId; int iconId;
if (mLastWifiSignalLevel == -1) { if (mLastWifiSignalLevel == -1) {
iconId = sWifiSignalImages[mInetCondition][0]; iconId = sWifiSignalImages[mInetCondition][0];
@@ -738,7 +737,6 @@ public class StatusBarPolicy {
} else { } else {
mLastWifiSignalLevel = -1; mLastWifiSignalLevel = -1;
mIsWifiConnected = false; mIsWifiConnected = false;
mInetCondition = 0;
int iconId = sWifiSignalImages[0][0]; int iconId = sWifiSignalImages[0][0];
mService.setIcon("wifi", iconId, 0); mService.setIcon("wifi", iconId, 0);
@@ -777,9 +775,8 @@ public class StatusBarPolicy {
@Override @Override
public void onDataConnectionStateChanged(int state, int networkType) { public void onDataConnectionStateChanged(int state, int networkType) {
mDataState = state; mDataState = state;
updateDataNetType(networkType, 0); updateDataNetType(networkType);
updateDataIcon(); updateDataIcon();
updateSignalStrength(); // apply the change in connection status
} }
@Override @Override
@@ -940,8 +937,7 @@ public class StatusBarPolicy {
return (levelEvdoDbm < levelEvdoSnr) ? levelEvdoDbm : levelEvdoSnr; return (levelEvdoDbm < levelEvdoSnr) ? levelEvdoDbm : levelEvdoSnr;
} }
private final void updateDataNetType(int net, int inetCondition) { private final void updateDataNetType(int net) {
mInetCondition = (inetCondition > INET_CONDITION_THRESHOLD ? 1 : 0);
switch (net) { switch (net) {
case TelephonyManager.NETWORK_TYPE_EDGE: case TelephonyManager.NETWORK_TYPE_EDGE:
mDataIconList = sDataNetType_e[mInetCondition]; mDataIconList = sDataNetType_e[mInetCondition];

View File

@@ -951,11 +951,19 @@ public class ConnectivityService extends IConnectivityManager.Stub {
newNet = tryFailover(prevNetType); newNet = tryFailover(prevNetType);
if (newNet != null) { if (newNet != null) {
NetworkInfo switchTo = newNet.getNetworkInfo(); NetworkInfo switchTo = newNet.getNetworkInfo();
if (!switchTo.isConnected()) {
// if the other net is connected they've already reset this and perhaps even gotten
// a positive report we don't want to overwrite, but if not we need to clear this now
// to turn our cellular sig strength white
mDefaultInetConditionPublished = 0;
}
intent.putExtra(ConnectivityManager.EXTRA_OTHER_NETWORK_INFO, switchTo); intent.putExtra(ConnectivityManager.EXTRA_OTHER_NETWORK_INFO, switchTo);
} else { } else {
mDefaultInetConditionPublished = 0; // we're not connected anymore
intent.putExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, true); intent.putExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, true);
} }
} }
intent.putExtra(ConnectivityManager.EXTRA_INET_CONDITION, mDefaultInetConditionPublished);
// do this before we broadcast the change // do this before we broadcast the change
handleConnectivityChange(prevNetType); handleConnectivityChange(prevNetType);
@@ -1114,12 +1122,20 @@ public class ConnectivityService extends IConnectivityManager.Stub {
newNet = tryFailover(info.getType()); newNet = tryFailover(info.getType());
if (newNet != null) { if (newNet != null) {
NetworkInfo switchTo = newNet.getNetworkInfo(); NetworkInfo switchTo = newNet.getNetworkInfo();
if (!switchTo.isConnected()) {
// if the other net is connected they've already reset this and perhaps even gotten
// a positive report we don't want to overwrite, but if not we need to clear this now
// to turn our cellular sig strength white
mDefaultInetConditionPublished = 0;
}
intent.putExtra(ConnectivityManager.EXTRA_OTHER_NETWORK_INFO, switchTo); intent.putExtra(ConnectivityManager.EXTRA_OTHER_NETWORK_INFO, switchTo);
} else { } else {
mDefaultInetConditionPublished = 0;
intent.putExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, true); intent.putExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, true);
} }
} }
intent.putExtra(ConnectivityManager.EXTRA_INET_CONDITION, mDefaultInetConditionPublished);
sendStickyBroadcast(intent); sendStickyBroadcast(intent);
/* /*
* If the failover network is already connected, then immediately send * If the failover network is already connected, then immediately send