Revert "Clean up published network condition reporting."
In some cases causes grey ICON's.
This reverts commit 2587a53c31
Change-Id: I09f893d03651c3fb9fcb88ee9e5ac7ce6cb6e273
This commit is contained in:
committed by
Android (Google) Code Review
parent
2587a53c31
commit
151eaa6bc1
@@ -194,6 +194,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
private int mNetworkPreference;
|
private int mNetworkPreference;
|
||||||
private int mActiveDefaultNetwork = -1;
|
private int mActiveDefaultNetwork = -1;
|
||||||
// 0 is full bad, 100 is full good
|
// 0 is full bad, 100 is full good
|
||||||
|
private int mDefaultInetCondition = 0;
|
||||||
private int mDefaultInetConditionPublished = 0;
|
private int mDefaultInetConditionPublished = 0;
|
||||||
private boolean mInetConditionChangeInFlight = false;
|
private boolean mInetConditionChangeInFlight = false;
|
||||||
private int mDefaultConnectionSequence = 0;
|
private int mDefaultConnectionSequence = 0;
|
||||||
@@ -1727,10 +1728,6 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
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
|
mDefaultInetConditionPublished = 0; // we're not connected anymore
|
||||||
if (DBG) {
|
|
||||||
log("handleDisconnect: net=" + mActiveDefaultNetwork +
|
|
||||||
", published condition=" + mDefaultInetConditionPublished);
|
|
||||||
}
|
|
||||||
intent.putExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, true);
|
intent.putExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1921,10 +1918,6 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
intent.putExtra(ConnectivityManager.EXTRA_OTHER_NETWORK_INFO, switchTo);
|
intent.putExtra(ConnectivityManager.EXTRA_OTHER_NETWORK_INFO, switchTo);
|
||||||
} else {
|
} else {
|
||||||
mDefaultInetConditionPublished = 0;
|
mDefaultInetConditionPublished = 0;
|
||||||
if (DBG) {
|
|
||||||
log("handleConnectionFailure: net=" + mActiveDefaultNetwork +
|
|
||||||
", published condition=" + mDefaultInetConditionPublished);
|
|
||||||
}
|
|
||||||
intent.putExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, true);
|
intent.putExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2069,10 +2062,6 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
mDefaultInetConditionPublished = 0;
|
mDefaultInetConditionPublished = 0;
|
||||||
mDefaultConnectionSequence++;
|
mDefaultConnectionSequence++;
|
||||||
mInetConditionChangeInFlight = false;
|
mInetConditionChangeInFlight = false;
|
||||||
if (DBG) {
|
|
||||||
log("handleConnect: net=" + newNetType +
|
|
||||||
", published condition=" + mDefaultInetConditionPublished);
|
|
||||||
}
|
|
||||||
// Don't do this - if we never sign in stay, grey
|
// Don't do this - if we never sign in stay, grey
|
||||||
//reportNetworkCondition(mActiveDefaultNetwork, 100);
|
//reportNetworkCondition(mActiveDefaultNetwork, 100);
|
||||||
}
|
}
|
||||||
@@ -2723,8 +2712,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
{
|
{
|
||||||
int netType = msg.arg1;
|
int netType = msg.arg1;
|
||||||
int sequence = msg.arg2;
|
int sequence = msg.arg2;
|
||||||
int condition = (Integer)msg.obj;
|
handleInetConditionHoldEnd(netType, sequence);
|
||||||
handleInetConditionHoldEnd(netType, sequence, condition);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EVENT_SET_NETWORK_PREFERENCE:
|
case EVENT_SET_NETWORK_PREFERENCE:
|
||||||
@@ -2937,13 +2925,14 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
if (VDBG) {
|
if (VDBG) {
|
||||||
log("handleInetConditionChange: net=" +
|
log("handleInetConditionChange: net=" +
|
||||||
netType + ", condition=" + condition +
|
netType + ", condition=" + condition +
|
||||||
" mActiveDefaultNetwork=" + mActiveDefaultNetwork);
|
",mActiveDefaultNetwork=" + mActiveDefaultNetwork);
|
||||||
}
|
}
|
||||||
|
mDefaultInetCondition = condition;
|
||||||
int delay;
|
int delay;
|
||||||
if (mInetConditionChangeInFlight == false) {
|
if (mInetConditionChangeInFlight == false) {
|
||||||
if (VDBG) log("handleInetConditionChange: starting a change hold");
|
if (VDBG) log("handleInetConditionChange: starting a change hold");
|
||||||
// setup a new hold to debounce this
|
// setup a new hold to debounce this
|
||||||
if (condition > 50) {
|
if (mDefaultInetCondition > 50) {
|
||||||
delay = Settings.Global.getInt(mContext.getContentResolver(),
|
delay = Settings.Global.getInt(mContext.getContentResolver(),
|
||||||
Settings.Global.INET_CONDITION_DEBOUNCE_UP_DELAY, 500);
|
Settings.Global.INET_CONDITION_DEBOUNCE_UP_DELAY, 500);
|
||||||
} else {
|
} else {
|
||||||
@@ -2952,16 +2941,18 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
}
|
}
|
||||||
mInetConditionChangeInFlight = true;
|
mInetConditionChangeInFlight = true;
|
||||||
mHandler.sendMessageDelayed(mHandler.obtainMessage(EVENT_INET_CONDITION_HOLD_END,
|
mHandler.sendMessageDelayed(mHandler.obtainMessage(EVENT_INET_CONDITION_HOLD_END,
|
||||||
mActiveDefaultNetwork, mDefaultConnectionSequence, new Integer(condition)), delay);
|
mActiveDefaultNetwork, mDefaultConnectionSequence), delay);
|
||||||
} else {
|
} else {
|
||||||
// we've set the new condition, when this hold ends that will get picked up
|
// we've set the new condition, when this hold ends that will get picked up
|
||||||
if (VDBG) log("handleInetConditionChange: currently in hold - not setting new end evt");
|
if (VDBG) log("handleInetConditionChange: currently in hold - not setting new end evt");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleInetConditionHoldEnd(int netType, int sequence, int condition) {
|
private void handleInetConditionHoldEnd(int netType, int sequence) {
|
||||||
if (DBG) {
|
if (DBG) {
|
||||||
log("handleInetConditionHoldEnd: net=" + netType + ", condition=" + condition);
|
log("handleInetConditionHoldEnd: net=" + netType +
|
||||||
|
", condition=" + mDefaultInetCondition +
|
||||||
|
", published condition=" + mDefaultInetConditionPublished);
|
||||||
}
|
}
|
||||||
mInetConditionChangeInFlight = false;
|
mInetConditionChangeInFlight = false;
|
||||||
|
|
||||||
@@ -2973,13 +2964,19 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
if (DBG) log("handleInetConditionHoldEnd: event hold for obsolete network - ignoring");
|
if (DBG) log("handleInetConditionHoldEnd: event hold for obsolete network - ignoring");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// TODO: Figure out why this optimization sometimes causes a
|
||||||
|
// change in mDefaultInetCondition to be missed and the
|
||||||
|
// UI to not be updated.
|
||||||
|
//if (mDefaultInetConditionPublished == mDefaultInetCondition) {
|
||||||
|
// if (DBG) log("no change in condition - aborting");
|
||||||
|
// return;
|
||||||
|
//}
|
||||||
NetworkInfo networkInfo = mNetTrackers[mActiveDefaultNetwork].getNetworkInfo();
|
NetworkInfo networkInfo = mNetTrackers[mActiveDefaultNetwork].getNetworkInfo();
|
||||||
if (networkInfo.isConnected() == false) {
|
if (networkInfo.isConnected() == false) {
|
||||||
if (DBG) log("handleInetConditionHoldEnd: default network not connected - ignoring");
|
if (DBG) log("handleInetConditionHoldEnd: default network not connected - ignoring");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mDefaultInetConditionPublished = condition;
|
mDefaultInetConditionPublished = mDefaultInetCondition;
|
||||||
sendInetConditionBroadcast(networkInfo);
|
sendInetConditionBroadcast(networkInfo);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user