From e0118abc5b1b0de2f6c35f57ad130cbde953367c Mon Sep 17 00:00:00 2001 From: lucaslin Date: Thu, 21 Mar 2019 11:59:22 +0800 Subject: [PATCH] Enable PARTIAL_CONNECTIVITY dialog Enable PARTIAL_CONNECTIVITY dialog to complete the function. Bug: 113450764 Test: 1. Build pass 2. atest FrameworksNetTests 3. atest NetworkStackTests 4. Change captive_portal_https_url to https://invalid.com to simulate partial connectivity. Change-Id: I5c9fe7a898d30d2f7f75142c85e73fefc257a147 --- .../java/com/android/server/ConnectivityService.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java index 52fcd4a968..2d70f3555a 100644 --- a/services/core/java/com/android/server/ConnectivityService.java +++ b/services/core/java/com/android/server/ConnectivityService.java @@ -2564,7 +2564,12 @@ public class ConnectivityService extends IConnectivityManager.Stub || (nai.networkMisc.acceptPartialConnectivity && nai.partialConnectivity); // Once a network is determined to have partial connectivity, it cannot - // go back to full connectivity without a disconnect. + // go back to full connectivity without a disconnect. This is because + // NetworkMonitor can only communicate either PARTIAL_CONNECTIVITY or VALID, + // but not both. + // TODO: Provide multi-testResult to improve the communication between + // ConnectivityService and NetworkMonitor, so that ConnectivityService could + // know the real status of network. final boolean partialConnectivityChanged = (partialConnectivity && !nai.partialConnectivity); @@ -3581,9 +3586,7 @@ public class ConnectivityService extends IConnectivityManager.Stub // NetworkMonitor detects the network is partial connectivity. Need to change the design to // popup the notification immediately when the network is partial connectivity. if (nai.partialConnectivity) { - // Treat PARTIAL_CONNECTIVITY as NO_INTERNET temporary until Settings has been updated. - // TODO: Need to change back to PARTIAL_CONNECTIVITY when Settings part is merged. - showNetworkNotification(nai, NotificationType.NO_INTERNET); + showNetworkNotification(nai, NotificationType.PARTIAL_CONNECTIVITY); } else { showNetworkNotification(nai, NotificationType.NO_INTERNET); }