summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Lorenzo Colitti <lorenzo@google.com> 2020-06-26 07:48:13 +0000
committer Chalard Jean <jchalard@google.com> 2020-06-26 07:59:04 +0000
commitf76c29b555b7c2a77c523e7f03e1237bd1a267c3 (patch)
tree66a9c329aa71825e1306e84d677529c96284902f
parentacd4508f468c688ab1f0304e2b663cca2da9dc2f (diff)
Send ConnDiags event before revalidating network in CS.
This change updates ConnectivityService to notify the ConnectivityDiagnosticsHandler of app-reported connectivity before attempting to revalidate the network. This change forces an ordering on Connectivity Diagnostics events in the case that the reported connectivity does not match the known connectivity for the network - this leads to the network being revalidated and the ConnectivityDiagnostics event onConnectivityReportAvailable. Passing the onNetworkConnectivityReported event to the ConnectivityDiagnosticsHandler first ensures that it is passed to callbacks before any potential ConnectivityReports are. Bug: 159718782 Test: android.net.cts.ConnectivityDiagnosticsManagerTest Original-Change: https://android-review.googlesource.com/1350662 Merged-In: Ic7bc7138c54c47bbfdf56af5811709fde66f8606 Change-Id: Ic7bc7138c54c47bbfdf56af5811709fde66f8606
-rw-r--r--services/core/java/com/android/server/ConnectivityService.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index 01b2e691d43a..77cd5d2ffdab 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -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(