diff options
author | 2019-06-17 04:04:29 -0700 | |
---|---|---|
committer | 2019-06-17 04:04:29 -0700 | |
commit | fbc68b975aef26a72ea0b18998077856b6be17a9 (patch) | |
tree | 189109ff9450cfe3381144e6bfdd5546c6f8720c | |
parent | 5127a760dbb0b7101fbf56428d34304d0075a688 (diff) | |
parent | f54483b6efb8fdf5afcd8e1a8bf24ae76d2537b5 (diff) |
Merge "Simplification of code to prevent a Log.wtf in expected cases."
am: f54483b6ef
Change-Id: Ia35b3f095a626436b989862281c0f13074818752
-rw-r--r-- | services/core/java/com/android/server/connectivity/NetworkNotificationManager.java | 39 |
1 files changed, 14 insertions, 25 deletions
diff --git a/services/core/java/com/android/server/connectivity/NetworkNotificationManager.java b/services/core/java/com/android/server/connectivity/NetworkNotificationManager.java index bcf5a71344b0..077c4057a3a0 100644 --- a/services/core/java/com/android/server/connectivity/NetworkNotificationManager.java +++ b/services/core/java/com/android/server/connectivity/NetworkNotificationManager.java @@ -178,31 +178,15 @@ public class NetworkNotificationManager { CharSequence title; CharSequence details; int icon = getIcon(transportType, notifyType); - if (notifyType == NotificationType.NO_INTERNET) { - switch (transportType) { - case TRANSPORT_WIFI: - title = r.getString(R.string.wifi_no_internet, - WifiInfo.removeDoubleQuotes(nai.networkCapabilities.getSSID())); - details = r.getString(R.string.wifi_no_internet_detailed); - break; - default: - // TODO: Display notifications for those networks that provide internet. - // except VPN. - return; - } - - } else if (notifyType == NotificationType.PARTIAL_CONNECTIVITY) { - switch (transportType) { - case TRANSPORT_WIFI: - title = r.getString(R.string.network_partial_connectivity, - WifiInfo.removeDoubleQuotes(nai.networkCapabilities.getSSID())); - details = r.getString(R.string.network_partial_connectivity_detailed); - break; - default: - // TODO: Display notifications for those networks that provide internet. - // except VPN. - return; - } + if (notifyType == NotificationType.NO_INTERNET && transportType == TRANSPORT_WIFI) { + title = r.getString(R.string.wifi_no_internet, + WifiInfo.removeDoubleQuotes(nai.networkCapabilities.getSSID())); + details = r.getString(R.string.wifi_no_internet_detailed); + } else if (notifyType == NotificationType.PARTIAL_CONNECTIVITY + && transportType == TRANSPORT_WIFI) { + title = r.getString(R.string.network_partial_connectivity, + WifiInfo.removeDoubleQuotes(nai.networkCapabilities.getSSID())); + details = r.getString(R.string.network_partial_connectivity_detailed); } else if (notifyType == NotificationType.LOST_INTERNET && transportType == TRANSPORT_WIFI) { title = r.getString(R.string.wifi_no_internet, @@ -248,6 +232,11 @@ public class NetworkNotificationManager { title = r.getString(R.string.network_switch_metered, toTransport); details = r.getString(R.string.network_switch_metered_detail, toTransport, fromTransport); + } else if (notifyType == NotificationType.NO_INTERNET + || notifyType == NotificationType.PARTIAL_CONNECTIVITY) { + // NO_INTERNET and PARTIAL_CONNECTIVITY notification for non-WiFi networks + // are sent, but they are not implemented yet. + return; } else { Slog.wtf(TAG, "Unknown notification type " + notifyType + " on network transport " + getTransportName(transportType)); |