summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Lorenzo Colitti <lorenzo@google.com> 2019-06-06 11:08:19 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2019-06-06 11:08:19 +0000
commit831831c76ca743efa6cf72bce9f61170d56ff897 (patch)
tree93676c2a08b14cd0b891b0b348d636c04f26dfb1
parent78a48f5512f5996d5adc7ce0dc432ea2b6f42fc6 (diff)
parentc8d0589c9caedfe8640a51e372f2ee4507b34d2d (diff)
Merge "Don't use a high-priority notification on auto-join." into qt-dev
-rw-r--r--services/core/java/com/android/server/ConnectivityService.java13
1 files changed, 12 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index a6ff37ebf7e1..a2abf26891e9 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -3599,21 +3599,31 @@ public class ConnectivityService extends IConnectivityManager.Stub
private void showNetworkNotification(NetworkAgentInfo nai, NotificationType type) {
final String action;
+ final boolean highPriority;
switch (type) {
case LOGGED_IN:
action = Settings.ACTION_WIFI_SETTINGS;
mHandler.removeMessages(EVENT_TIMEOUT_NOTIFICATION);
mHandler.sendMessageDelayed(mHandler.obtainMessage(EVENT_TIMEOUT_NOTIFICATION,
nai.network.netId, 0), TIMEOUT_NOTIFICATION_DELAY_MS);
+ // High priority because it is a direct result of the user logging in to a portal.
+ highPriority = true;
break;
case NO_INTERNET:
action = ConnectivityManager.ACTION_PROMPT_UNVALIDATED;
+ // High priority because it is only displayed for explicitly selected networks.
+ highPriority = true;
break;
case LOST_INTERNET:
action = ConnectivityManager.ACTION_PROMPT_LOST_VALIDATION;
+ // High priority because it could help the user avoid unexpected data usage.
+ highPriority = true;
break;
case PARTIAL_CONNECTIVITY:
action = ConnectivityManager.ACTION_PROMPT_PARTIAL_CONNECTIVITY;
+ // Don't bother the user with a high-priority notification if the network was not
+ // explicitly selected by the user.
+ highPriority = nai.networkMisc.explicitlySelected;
break;
default:
Slog.wtf(TAG, "Unknown notification type " + type);
@@ -3630,7 +3640,8 @@ public class ConnectivityService extends IConnectivityManager.Stub
PendingIntent pendingIntent = PendingIntent.getActivityAsUser(
mContext, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT, null, UserHandle.CURRENT);
- mNotifier.showNotification(nai.network.netId, type, nai, null, pendingIntent, true);
+
+ mNotifier.showNotification(nai.network.netId, type, nai, null, pendingIntent, highPriority);
}
private boolean shouldPromptUnvalidated(NetworkAgentInfo nai) {