Merge "Simplification of code to prevent a Log.wtf in expected cases."
This commit is contained in:
@@ -178,31 +178,15 @@ public class NetworkNotificationManager {
|
|||||||
CharSequence title;
|
CharSequence title;
|
||||||
CharSequence details;
|
CharSequence details;
|
||||||
int icon = getIcon(transportType, notifyType);
|
int icon = getIcon(transportType, notifyType);
|
||||||
if (notifyType == NotificationType.NO_INTERNET) {
|
if (notifyType == NotificationType.NO_INTERNET && transportType == TRANSPORT_WIFI) {
|
||||||
switch (transportType) {
|
title = r.getString(R.string.wifi_no_internet,
|
||||||
case TRANSPORT_WIFI:
|
WifiInfo.removeDoubleQuotes(nai.networkCapabilities.getSSID()));
|
||||||
title = r.getString(R.string.wifi_no_internet,
|
details = r.getString(R.string.wifi_no_internet_detailed);
|
||||||
WifiInfo.removeDoubleQuotes(nai.networkCapabilities.getSSID()));
|
} else if (notifyType == NotificationType.PARTIAL_CONNECTIVITY
|
||||||
details = r.getString(R.string.wifi_no_internet_detailed);
|
&& transportType == TRANSPORT_WIFI) {
|
||||||
break;
|
title = r.getString(R.string.network_partial_connectivity,
|
||||||
default:
|
WifiInfo.removeDoubleQuotes(nai.networkCapabilities.getSSID()));
|
||||||
// TODO: Display notifications for those networks that provide internet.
|
details = r.getString(R.string.network_partial_connectivity_detailed);
|
||||||
// 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;
|
|
||||||
}
|
|
||||||
} else if (notifyType == NotificationType.LOST_INTERNET &&
|
} else if (notifyType == NotificationType.LOST_INTERNET &&
|
||||||
transportType == TRANSPORT_WIFI) {
|
transportType == TRANSPORT_WIFI) {
|
||||||
title = r.getString(R.string.wifi_no_internet,
|
title = r.getString(R.string.wifi_no_internet,
|
||||||
@@ -248,6 +232,11 @@ public class NetworkNotificationManager {
|
|||||||
title = r.getString(R.string.network_switch_metered, toTransport);
|
title = r.getString(R.string.network_switch_metered, toTransport);
|
||||||
details = r.getString(R.string.network_switch_metered_detail, toTransport,
|
details = r.getString(R.string.network_switch_metered_detail, toTransport,
|
||||||
fromTransport);
|
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 {
|
} else {
|
||||||
Slog.wtf(TAG, "Unknown notification type " + notifyType + " on network transport "
|
Slog.wtf(TAG, "Unknown notification type " + notifyType + " on network transport "
|
||||||
+ getTransportName(transportType));
|
+ getTransportName(transportType));
|
||||||
|
|||||||
Reference in New Issue
Block a user