Merge "Send ConnDiags event before revalidating network in CS." into rvc-dev am: 874dec6ba8

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12004847

Change-Id: I1562abb163e5ddf8a84bbac17d140d4fa1e54adf
This commit is contained in:
Lorenzo Colitti
2020-06-26 15:21:45 +00:00
committed by Automerger Merge Worker

View File

@@ -4323,9 +4323,11 @@ public class ConnectivityService extends IConnectivityManager.Stub
enforceInternetPermission();
final int uid = Binder.getCallingUid();
final int connectivityInfo = encodeBool(hasConnectivity);
mHandler.sendMessage(
mHandler.obtainMessage(EVENT_REVALIDATE_NETWORK, uid, connectivityInfo, network));
// Handle ConnectivityDiagnostics event before attempting to revalidate the network. This
// forces an ordering of ConnectivityDiagnostics events in the case where hasConnectivity
// does not match the known connectivity of the network - this causes NetworkMonitor to
// revalidate the network and generate a ConnectivityDiagnostics ConnectivityReport event.
final NetworkAgentInfo nai;
if (network == null) {
nai = getDefaultNetwork();
@@ -4338,6 +4340,9 @@ public class ConnectivityService extends IConnectivityManager.Stub
ConnectivityDiagnosticsHandler.EVENT_NETWORK_CONNECTIVITY_REPORTED,
connectivityInfo, 0, nai));
}
mHandler.sendMessage(
mHandler.obtainMessage(EVENT_REVALIDATE_NETWORK, uid, connectivityInfo, network));
}
private void handleReportNetworkConnectivity(