diff options
| author | Lorenzo Colitti <lorenzo@google.com> | 2015-06-24 17:13:08 +0900 |
|---|---|---|
| committer | Lorenzo Colitti <lorenzo@google.com> | 2015-06-24 17:47:44 +0900 |
| commit | 9ce8a9da407161dc6a17d100364b2e19c753765d (patch) | |
| tree | 70d96a9f10e39c9438e2fbef6014f527f6c96f73 | |
| parent | ddfe5d573ec002843324694c2bed723acf1d293e (diff) | |
| download | frameworks_base-9ce8a9da407161dc6a17d100364b2e19c753765d.zip frameworks_base-9ce8a9da407161dc6a17d100364b2e19c753765d.tar.gz frameworks_base-9ce8a9da407161dc6a17d100364b2e19c753765d.tar.bz2 | |
Use heads-up notifications when selecting networks with no Internet
Currently, when connecting to a network that has a captive portal
or has no Internet access, we display a regular notification.
Because this notification is easy to miss, switch to using a
heads-up notification if the user just manually selected the
network. If the system connects automatically, continue to use a
regular notification.
Bug: 20081183
Change-Id: I7a988b2bddfe898a0d2607ad85a04b227d678469
| -rw-r--r-- | services/core/java/com/android/server/ConnectivityService.java | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java index e4f3f49..2d5141e 100644 --- a/services/core/java/com/android/server/ConnectivityService.java +++ b/services/core/java/com/android/server/ConnectivityService.java @@ -2006,15 +2006,15 @@ public class ConnectivityService extends IConnectivityManager.Stub NascentState.NOT_JUST_VALIDATED); } if (!visible) { - setProvNotificationVisibleIntent(false, netId, null, 0, null, null); + setProvNotificationVisibleIntent(false, netId, null, 0, null, null, false); } else { if (nai == null) { loge("EVENT_PROVISIONING_NOTIFICATION from unknown NetworkMonitor"); break; } setProvNotificationVisibleIntent(true, netId, NotificationType.SIGN_IN, - nai.networkInfo.getType(),nai.networkInfo.getExtraInfo(), - (PendingIntent)msg.obj); + nai.networkInfo.getType(), nai.networkInfo.getExtraInfo(), + (PendingIntent)msg.obj, nai.networkMisc.explicitlySelected); } break; } @@ -2447,7 +2447,7 @@ public class ConnectivityService extends IConnectivityManager.Stub PendingIntent pendingIntent = PendingIntent.getActivityAsUser( mContext, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT, null, UserHandle.CURRENT); setProvNotificationVisibleIntent(true, nai.network.netId, NotificationType.NO_INTERNET, - nai.networkInfo.getType(), nai.networkInfo.getExtraInfo(), pendingIntent); + nai.networkInfo.getType(), nai.networkInfo.getExtraInfo(), pendingIntent, true); } private class InternalHandler extends Handler { @@ -3240,7 +3240,7 @@ public class ConnectivityService extends IConnectivityManager.Stub // Concatenate the range of types onto the range of NetIDs. int id = MAX_NET_ID + 1 + (networkType - ConnectivityManager.TYPE_NONE); setProvNotificationVisibleIntent(visible, id, NotificationType.SIGN_IN, - networkType, null, pendingIntent); + networkType, null, pendingIntent, false); } /** @@ -3259,11 +3259,12 @@ public class ConnectivityService extends IConnectivityManager.Stub * we concatenate the range of types with the range of NetIDs. */ private void setProvNotificationVisibleIntent(boolean visible, int id, - NotificationType notifyType, int networkType, String extraInfo, PendingIntent intent) { + NotificationType notifyType, int networkType, String extraInfo, PendingIntent intent, + boolean highPriority) { if (DBG) { log("setProvNotificationVisibleIntent " + notifyType + " visible=" + visible + " networkType=" + getNetworkTypeName(networkType) - + " extraInfo=" + extraInfo); + + " extraInfo=" + extraInfo + " highPriority=" + highPriority); } Resources r = Resources.getSystem(); @@ -3318,6 +3319,12 @@ public class ConnectivityService extends IConnectivityManager.Stub .setContentTitle(title) .setContentText(details) .setContentIntent(intent) + .setLocalOnly(true) + .setPriority(highPriority ? + Notification.PRIORITY_HIGH : + Notification.PRIORITY_DEFAULT) + .setDefaults(Notification.DEFAULT_ALL) + .setOnlyAlertOnce(true) .build(); try { |
