Data stall detection using DNS event
If dns resolver on a network get consecutively timeout then it
is a strong signal that the network is no longer usable.
Reevaluate the network once it's data stall suspected
Test: 1. runtest frameworks-net
2. SettingsBackupTest passes
2. Run on wifi w/o internet capability
Bug: 112653893, 113916551
Change-Id: I74287b174d933f97a91fa1529b1809856ac3b38d
This commit is contained in:
@@ -1659,6 +1659,24 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
loge("Error parsing ip address in validation event");
|
loge("Error parsing ip address in validation event");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDnsEvent(int netId, int eventType, int returnCode, String hostname,
|
||||||
|
String[] ipAddresses, int ipAddressesCount, long timestamp, int uid) {
|
||||||
|
NetworkAgentInfo nai = getNetworkAgentInfoForNetId(netId);
|
||||||
|
// Netd event only allow registrants from system. Each NetworkMonitor thread is under
|
||||||
|
// the caller thread of registerNetworkAgent. Thus, it's not allowed to register netd
|
||||||
|
// event callback for certain nai. e.g. cellular. Register here to pass to
|
||||||
|
// NetworkMonitor instead.
|
||||||
|
// TODO: Move the Dns Event to NetworkMonitor. Use Binder.clearCallingIdentity() in
|
||||||
|
// registerNetworkAgent to have NetworkMonitor created with system process as design
|
||||||
|
// expectation. Also, NetdEventListenerService only allow one callback from each
|
||||||
|
// caller type. Need to re-factor NetdEventListenerService to allow multiple
|
||||||
|
// NetworkMonitor registrants.
|
||||||
|
if (nai != null && nai.satisfies(mDefaultRequest)) {
|
||||||
|
nai.networkMonitor.sendMessage(NetworkMonitor.EVENT_DNS_NOTIFICATION, returnCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
|
|||||||
Reference in New Issue
Block a user