Index: net/android/java/src/org/chromium/net/AndroidNetworkLibrary.java |
diff --git a/net/android/java/src/org/chromium/net/AndroidNetworkLibrary.java b/net/android/java/src/org/chromium/net/AndroidNetworkLibrary.java |
index 6b913186e9a11ed8fe252712cc6bffe371d7c547..32b719261e0604dc201f4b2c4b6355c062768bb8 100644 |
--- a/net/android/java/src/org/chromium/net/AndroidNetworkLibrary.java |
+++ b/net/android/java/src/org/chromium/net/AndroidNetworkLibrary.java |
@@ -14,9 +14,6 @@ import android.util.Log; |
import org.chromium.base.CalledByNative; |
import org.chromium.base.CalledByNativeUnchecked; |
-import java.net.Inet6Address; |
-import java.net.InetAddress; |
-import java.net.InterfaceAddress; |
import java.net.NetworkInterface; |
import java.net.SocketException; |
import java.net.URLConnection; |
@@ -140,65 +137,6 @@ class AndroidNetworkLibrary { |
} |
/** |
- * @return the network interfaces list (if any) string. The items in |
- * the list string are delimited by a new line, each item |
- * is tab separated network interface name, address with network |
- * prefix length and network interface index. |
- * as "name\taddress/prefix\tindex". e.g. |
- * eth0\t10.0.0.2/8\t5\neth0\tfe80::5054:ff:fe12:3456/16\t5 |
- * represents a network list string with two items. |
- */ |
- @CalledByNative |
- public static String getNetworkList() { |
- Enumeration<NetworkInterface> list = null; |
- try { |
- list = NetworkInterface.getNetworkInterfaces(); |
- if (list == null) return ""; |
- } catch (SocketException e) { |
- Log.w(TAG, "Unable to get network interfaces: " + e); |
- return ""; |
- } |
- |
- StringBuilder result = new StringBuilder(); |
- while (list.hasMoreElements()) { |
- NetworkInterface netIf = list.nextElement(); |
- try { |
- // Skip loopback interfaces, and ones which are down. |
- if (!netIf.isUp() || netIf.isLoopback()) |
- continue; |
- for (InterfaceAddress interfaceAddress : netIf.getInterfaceAddresses()) { |
- InetAddress address = interfaceAddress.getAddress(); |
- // Skip loopback addresses configured on non-loopback interfaces. |
- if (address.isLoopbackAddress()) |
- continue; |
- StringBuilder addressString = new StringBuilder(); |
- addressString.append(netIf.getName()); |
- addressString.append("\t"); |
- |
- String ipAddress = address.getHostAddress(); |
- if (address instanceof Inet6Address && ipAddress.contains("%")) { |
- ipAddress = ipAddress.substring(0, ipAddress.lastIndexOf("%")); |
- } |
- addressString.append(ipAddress); |
- addressString.append("/"); |
- addressString.append(interfaceAddress.getNetworkPrefixLength()); |
- addressString.append("\t"); |
- |
- // TODO(vitalybuka): use netIf.getIndex() when API level 19 is availible. |
- addressString.append("0"); |
- |
- if (result.length() != 0) |
- result.append("\n"); |
- result.append(addressString.toString()); |
- } |
- } catch (SocketException e) { |
- continue; |
- } |
- } |
- return result.toString(); |
- } |
- |
- /** |
* Validate the server's certificate chain is trusted. Note that the caller |
* must still verify the name matches that of the leaf certificate. |
* |