Test no Internet and partial connectivity notifications.
Test: new unit tests pass
Change-Id: I363fa3ef15476a30e7b8708a80867dd456e5e520
diff --git a/service/src/com/android/server/ConnectivityService.java b/service/src/com/android/server/ConnectivityService.java
index 7e63761..8ec979a 100755
--- a/service/src/com/android/server/ConnectivityService.java
+++ b/service/src/com/android/server/ConnectivityService.java
@@ -4949,11 +4949,16 @@
}
}
- private void scheduleUnvalidatedPrompt(NetworkAgentInfo nai) {
- if (VDBG) log("scheduleUnvalidatedPrompt " + nai.network);
+ private void scheduleUnvalidatedPrompt(@NonNull final Network network) {
+ scheduleUnvalidatedPrompt(network, PROMPT_UNVALIDATED_DELAY_MS);
+ }
+
+ /** Schedule unvalidated prompt for testing */
+ @VisibleForTesting
+ public void scheduleUnvalidatedPrompt(@NonNull final Network network, final long delayMs) {
+ if (VDBG) log("scheduleUnvalidatedPrompt " + network);
mHandler.sendMessageDelayed(
- mHandler.obtainMessage(EVENT_PROMPT_UNVALIDATED, nai.network),
- PROMPT_UNVALIDATED_DELAY_MS);
+ mHandler.obtainMessage(EVENT_PROMPT_UNVALIDATED, network), delayMs);
}
@Override
@@ -9208,7 +9213,7 @@
networkAgent.networkMonitor().notifyNetworkConnected(params.linkProperties,
params.networkCapabilities);
}
- scheduleUnvalidatedPrompt(networkAgent);
+ scheduleUnvalidatedPrompt(networkAgent.network);
// Whether a particular NetworkRequest listen should cause signal strength thresholds to
// be communicated to a particular NetworkAgent depends only on the network's immutable,
diff --git a/service/src/com/android/server/connectivity/NetworkNotificationManager.java b/service/src/com/android/server/connectivity/NetworkNotificationManager.java
index 155f6c4..45da0ea 100644
--- a/service/src/com/android/server/connectivity/NetworkNotificationManager.java
+++ b/service/src/com/android/server/connectivity/NetworkNotificationManager.java
@@ -394,8 +394,9 @@
Toast.makeText(mContext, text, Toast.LENGTH_LONG).show();
}
- @VisibleForTesting
- static String tagFor(int id) {
+ /** Get the logging tag for a notification ID */
+ @VisibleForTesting(visibility = VisibleForTesting.Visibility.PRIVATE)
+ public static String tagFor(int id) {
return String.format("ConnectivityNotification:%d", id);
}