From 769f069a4701bd91a60219ca3ecd52d6990ca1ac Mon Sep 17 00:00:00 2001 From: Lorenzo Colitti Date: Thu, 1 Aug 2013 17:30:07 +0900 Subject: [PATCH] Display all link IP addresses, on different lines Currently, the "IP address" field in the status page of the settings app displays only the IP addesses on the base link. Make it display the stacked link IP addresses as well. Also, separate IP addresses via newlines instead of commas. For example, display: 2a00:f40:e000:11c:cf93:ee9:5ad3:6686 192.0.0.4 instead of: 2a00:f40:e000:11c:cf93:ee9:5ad3:6686, 192.0.0.4 Change-Id: Ie78da142fea87735139adcefcfed7154b4f7fefb --- src/com/android/settings/Utils.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java index 58c0872da9e..2ee7b63fd90 100644 --- a/src/com/android/settings/Utils.java +++ b/src/com/android/settings/Utils.java @@ -330,7 +330,7 @@ public class Utils { /** * Returns the WIFI IP Addresses, if any, taking into account IPv4 and IPv6 style addresses. * @param context the application context - * @return the formatted and comma-separated IP addresses, or null if none. + * @return the formatted and newline-separated IP addresses, or null if none. */ public static String getWifiIpAddresses(Context context) { ConnectivityManager cm = (ConnectivityManager) @@ -343,7 +343,7 @@ public class Utils { * Returns the default link's IP addresses, if any, taking into account IPv4 and IPv6 style * addresses. * @param context the application context - * @return the formatted and comma-separated IP addresses, or null if none. + * @return the formatted and newline-separated IP addresses, or null if none. */ public static String getDefaultIpAddresses(Context context) { ConnectivityManager cm = (ConnectivityManager) @@ -354,14 +354,14 @@ public class Utils { private static String formatIpAddresses(LinkProperties prop) { if (prop == null) return null; - Iterator iter = prop.getAddresses().iterator(); + Iterator iter = prop.getAllAddresses().iterator(); // If there are no entries, return null if (!iter.hasNext()) return null; // Concatenate all available addresses, comma separated String addresses = ""; while (iter.hasNext()) { addresses += iter.next().getHostAddress(); - if (iter.hasNext()) addresses += ", "; + if (iter.hasNext()) addresses += "\n"; } return addresses; }