Merge "Fix default network transition event recording" into nyc-dev am: 3cd6a8b85d am: 86d587563a

am: 1cb5371d88

* commit '1cb5371d888faa24181db1bbd75869413159cfea':
  Fix default network transition event recording

Change-Id: I37d885e48268e43944fe8afe4dca3f4322d508ac
This commit is contained in:
Hugo Benichi
2016-05-25 03:41:14 +00:00
committed by android-build-merger

View File

@@ -2248,6 +2248,11 @@ public class ConnectivityService extends IConnectivityManager.Stub
final boolean wasDefault = isDefaultNetwork(nai);
if (wasDefault) {
mDefaultInetConditionPublished = 0;
// Log default network disconnection before required book-keeping.
// Let rematchAllNetworksAndRequests() below record a new default network event
// if there is a fallback. Taken together, the two form a X -> 0, 0 -> Y sequence
// whose timestamps tell how long it takes to recover a default network.
logDefaultNetworkEvent(null, nai);
}
notifyIfacesChangedForNetworkStats();
// TODO - we shouldn't send CALLBACK_LOST to requests that can be satisfied
@@ -2281,10 +2286,6 @@ public class ConnectivityService extends IConnectivityManager.Stub
}
mLegacyTypeTracker.remove(nai, wasDefault);
rematchAllNetworksAndRequests(null, 0);
if (wasDefault && getDefaultNetwork() == null) {
// Log that we lost the default network and there is no replacement.
logDefaultNetworkEvent(null, nai);
}
if (nai.created) {
// Tell netd to clean up the configuration for this network
// (routing rules, DNS, etc).
@@ -4587,7 +4588,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
teardownUnneededNetwork(oldNetwork);
}
private void makeDefault(NetworkAgentInfo newNetwork, NetworkAgentInfo prevNetwork) {
private void makeDefault(NetworkAgentInfo newNetwork) {
if (DBG) log("Switching to new default network: " + newNetwork);
setupDataActivityTracking(newNetwork);
try {
@@ -4599,7 +4600,6 @@ public class ConnectivityService extends IConnectivityManager.Stub
handleApplyDefaultProxy(newNetwork.linkProperties.getHttpProxy());
updateTcpBufferSizes(newNetwork);
setDefaultDnsSystemProperties(newNetwork.linkProperties.getDnsServers());
logDefaultNetworkEvent(newNetwork, prevNetwork);
}
// Handles a network appearing or improving its score.
@@ -4750,7 +4750,9 @@ public class ConnectivityService extends IConnectivityManager.Stub
}
if (isNewDefault) {
// Notify system services that this network is up.
makeDefault(newNetwork, oldDefaultNetwork);
makeDefault(newNetwork);
// Log 0 -> X and Y -> X default network transitions, where X is the new default.
logDefaultNetworkEvent(newNetwork, oldDefaultNetwork);
synchronized (ConnectivityService.this) {
// have a new default network, release the transition wakelock in
// a second if it's held. The second pause is to allow apps