From 28325f27222cae3f8ac4adeac20ace31200592e8 Mon Sep 17 00:00:00 2001 From: Lorenzo Colitti Date: Mon, 3 Jun 2019 06:04:00 -0700 Subject: [PATCH] Re-notify if the network goes to PARTIAL. If NetworkMonitor detects partial connectivity before EVENT_PROMPT_UNVALIDATED arrives, show the partial connectivity notification immediately. Re-notify partial connectivity silently if no internet notification already there. Bug: 130683832 Bug: 130766237 Test: atest com.android.server.ConnectivityServiceTest Change-Id: I7d4eddc643ec795c3961097dc1bdd314d168f6c7 Merged-In: I1b79d3faf96ffe792738935088e4ebbdfcc0d878 (cherry picked from commit 58d4e7304cfce68e338ab34022a0b29d45f42c38) --- .../java/com/android/server/ConnectivityService.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java index d6b4043af4..5da1a19def 100644 --- a/services/core/java/com/android/server/ConnectivityService.java +++ b/services/core/java/com/android/server/ConnectivityService.java @@ -2663,6 +2663,17 @@ public class ConnectivityService extends IConnectivityManager.Stub NetworkAgent.CMD_REPORT_NETWORK_STATUS, (valid ? NetworkAgent.VALID_NETWORK : NetworkAgent.INVALID_NETWORK), 0, redirectUrlBundle); + + // If NetworkMonitor detects partial connectivity before + // EVENT_PROMPT_UNVALIDATED arrives, show the partial connectivity notification + // immediately. Re-notify partial connectivity silently if no internet + // notification already there. + if (!wasPartial && nai.partialConnectivity) { + // Remove delayed message if there is a pending message. + mHandler.removeMessages(EVENT_PROMPT_UNVALIDATED, nai.network); + handlePromptUnvalidated(nai.network); + } + if (wasValidated && !nai.lastValidated) { handleNetworkUnvalidated(nai); }