Merge "Don't use a high-priority notification on auto-join."
This commit is contained in:
@@ -3597,21 +3597,31 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
|
|
||||||
private void showNetworkNotification(NetworkAgentInfo nai, NotificationType type) {
|
private void showNetworkNotification(NetworkAgentInfo nai, NotificationType type) {
|
||||||
final String action;
|
final String action;
|
||||||
|
final boolean highPriority;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case LOGGED_IN:
|
case LOGGED_IN:
|
||||||
action = Settings.ACTION_WIFI_SETTINGS;
|
action = Settings.ACTION_WIFI_SETTINGS;
|
||||||
mHandler.removeMessages(EVENT_TIMEOUT_NOTIFICATION);
|
mHandler.removeMessages(EVENT_TIMEOUT_NOTIFICATION);
|
||||||
mHandler.sendMessageDelayed(mHandler.obtainMessage(EVENT_TIMEOUT_NOTIFICATION,
|
mHandler.sendMessageDelayed(mHandler.obtainMessage(EVENT_TIMEOUT_NOTIFICATION,
|
||||||
nai.network.netId, 0), TIMEOUT_NOTIFICATION_DELAY_MS);
|
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;
|
break;
|
||||||
case NO_INTERNET:
|
case NO_INTERNET:
|
||||||
action = ConnectivityManager.ACTION_PROMPT_UNVALIDATED;
|
action = ConnectivityManager.ACTION_PROMPT_UNVALIDATED;
|
||||||
|
// High priority because it is only displayed for explicitly selected networks.
|
||||||
|
highPriority = true;
|
||||||
break;
|
break;
|
||||||
case LOST_INTERNET:
|
case LOST_INTERNET:
|
||||||
action = ConnectivityManager.ACTION_PROMPT_LOST_VALIDATION;
|
action = ConnectivityManager.ACTION_PROMPT_LOST_VALIDATION;
|
||||||
|
// High priority because it could help the user avoid unexpected data usage.
|
||||||
|
highPriority = true;
|
||||||
break;
|
break;
|
||||||
case PARTIAL_CONNECTIVITY:
|
case PARTIAL_CONNECTIVITY:
|
||||||
action = ConnectivityManager.ACTION_PROMPT_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;
|
break;
|
||||||
default:
|
default:
|
||||||
Slog.wtf(TAG, "Unknown notification type " + type);
|
Slog.wtf(TAG, "Unknown notification type " + type);
|
||||||
@@ -3628,7 +3638,8 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
|
|
||||||
PendingIntent pendingIntent = PendingIntent.getActivityAsUser(
|
PendingIntent pendingIntent = PendingIntent.getActivityAsUser(
|
||||||
mContext, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT, null, UserHandle.CURRENT);
|
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) {
|
private boolean shouldPromptUnvalidated(NetworkAgentInfo nai) {
|
||||||
|
|||||||
Reference in New Issue
Block a user