diff options
Diffstat (limited to 'service')
5 files changed, 20 insertions, 19 deletions
diff --git a/service/java/com/android/server/wifi/ClientModeImpl.java b/service/java/com/android/server/wifi/ClientModeImpl.java index cc859ebe1..f3a59b14b 100644 --- a/service/java/com/android/server/wifi/ClientModeImpl.java +++ b/service/java/com/android/server/wifi/ClientModeImpl.java @@ -48,7 +48,6 @@ import android.net.NetworkCapabilities; import android.net.NetworkInfo; import android.net.NetworkInfo.DetailedState; import android.net.NetworkMisc; -import android.net.NetworkUtils; import android.net.RouteInfo; import android.net.SocketKeepalive; import android.net.SocketKeepalive.InvalidPacketException; @@ -57,6 +56,7 @@ import android.net.TcpKeepalivePacketData; import android.net.ip.IIpClient; import android.net.ip.IpClientCallbacks; import android.net.ip.IpClientManager; +import android.net.shared.Inet4AddressUtils; import android.net.shared.ProvisioningConfiguration; import android.net.wifi.IActionListener; import android.net.wifi.INetworkRequestMatchCallback; @@ -2791,7 +2791,7 @@ public class ClientModeImpl extends StateMachine { if (mIsAutoRoaming) { int previousAddress = mWifiInfo.getIpAddress(); - int newAddress = NetworkUtils.inetAddressToInt(addr); + int newAddress = Inet4AddressUtils.inet4AddressToIntHTL(addr); if (previousAddress != newAddress) { logd("handleIPv4Success, roaming and address changed" + mWifiInfo + " got: " + addr); diff --git a/service/java/com/android/server/wifi/WifiBackupDataV1Parser.java b/service/java/com/android/server/wifi/WifiBackupDataV1Parser.java index 13352f7e1..7519a2490 100644 --- a/service/java/com/android/server/wifi/WifiBackupDataV1Parser.java +++ b/service/java/com/android/server/wifi/WifiBackupDataV1Parser.java @@ -17,11 +17,11 @@ package com.android.server.wifi; import android.annotation.Nullable; +import android.net.InetAddresses; import android.net.IpConfiguration; import android.net.IpConfiguration.IpAssignment; import android.net.IpConfiguration.ProxySettings; import android.net.LinkAddress; -import android.net.NetworkUtils; import android.net.ProxyInfo; import android.net.RouteInfo; import android.net.StaticIpConfiguration; @@ -506,7 +506,7 @@ class WifiBackupDataV1Parser implements WifiBackupDataParser { StaticIpConfiguration.Builder builder = new StaticIpConfiguration.Builder(); if (linkAddressString != null && linkPrefixLength != null) { LinkAddress linkAddress = new LinkAddress( - NetworkUtils.numericToInetAddress(linkAddressString), linkPrefixLength); + InetAddresses.parseNumericAddress(linkAddressString), linkPrefixLength); if (linkAddress.getAddress() instanceof Inet4Address) { builder.setIpAddress(linkAddress); } else { @@ -514,7 +514,7 @@ class WifiBackupDataV1Parser implements WifiBackupDataParser { } } if (gatewayAddressString != null) { - InetAddress gateway = NetworkUtils.numericToInetAddress(gatewayAddressString); + InetAddress gateway = InetAddresses.parseNumericAddress(gatewayAddressString); RouteInfo route = new RouteInfo(null, gateway, null, RouteInfo.RTN_UNICAST); if (route.isDefaultRoute() && route.getDestination().getAddress() instanceof Inet4Address) { @@ -527,7 +527,7 @@ class WifiBackupDataV1Parser implements WifiBackupDataParser { List<InetAddress> dnsServerAddresses = new ArrayList<>(); for (String dnsServerAddressString : dnsServerAddressesString) { InetAddress dnsServerAddress = - NetworkUtils.numericToInetAddress(dnsServerAddressString); + InetAddresses.parseNumericAddress(dnsServerAddressString); dnsServerAddresses.add(dnsServerAddress); } builder.setDnsServers(dnsServerAddresses); diff --git a/service/java/com/android/server/wifi/WifiServiceImpl.java b/service/java/com/android/server/wifi/WifiServiceImpl.java index 46f76a76d..18cd2f906 100644 --- a/service/java/com/android/server/wifi/WifiServiceImpl.java +++ b/service/java/com/android/server/wifi/WifiServiceImpl.java @@ -45,9 +45,9 @@ import android.net.DhcpInfo; import android.net.DhcpResults; import android.net.Network; import android.net.NetworkStack; -import android.net.NetworkUtils; import android.net.Uri; import android.net.ip.IpClientUtil; +import android.net.shared.Inet4AddressUtils; import android.net.wifi.IActionListener; import android.net.wifi.IDppCallback; import android.net.wifi.ILocalOnlyHotspotCallback; @@ -2375,28 +2375,29 @@ public class WifiServiceImpl extends BaseWifiService { if (dhcpResults.ipAddress != null && dhcpResults.ipAddress.getAddress() instanceof Inet4Address) { - info.ipAddress = NetworkUtils.inetAddressToInt( + info.ipAddress = Inet4AddressUtils.inet4AddressToIntHTL( (Inet4Address) dhcpResults.ipAddress.getAddress()); } if (dhcpResults.gateway != null) { - info.gateway = NetworkUtils.inetAddressToInt((Inet4Address) dhcpResults.gateway); + info.gateway = Inet4AddressUtils.inet4AddressToIntHTL( + (Inet4Address) dhcpResults.gateway); } int dnsFound = 0; for (InetAddress dns : dhcpResults.dnsServers) { if (dns instanceof Inet4Address) { if (dnsFound == 0) { - info.dns1 = NetworkUtils.inetAddressToInt((Inet4Address)dns); + info.dns1 = Inet4AddressUtils.inet4AddressToIntHTL((Inet4Address) dns); } else { - info.dns2 = NetworkUtils.inetAddressToInt((Inet4Address)dns); + info.dns2 = Inet4AddressUtils.inet4AddressToIntHTL((Inet4Address) dns); } if (++dnsFound > 1) break; } } Inet4Address serverAddress = dhcpResults.serverAddress; if (serverAddress != null) { - info.serverAddress = NetworkUtils.inetAddressToInt(serverAddress); + info.serverAddress = Inet4AddressUtils.inet4AddressToIntHTL(serverAddress); } info.leaseDuration = dhcpResults.leaseDuration; diff --git a/service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java b/service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java index 571444a47..1176ee7b5 100644 --- a/service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java +++ b/service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java @@ -31,11 +31,11 @@ import android.database.ContentObserver; import android.location.LocationManager; import android.net.ConnectivityManager; import android.net.DhcpResults; +import android.net.InetAddresses; import android.net.InterfaceConfiguration; import android.net.LinkAddress; import android.net.LinkProperties; import android.net.NetworkInfo; -import android.net.NetworkUtils; import android.net.ip.IIpClient; import android.net.ip.IpClientCallbacks; import android.net.ip.IpClientUtil; @@ -2633,7 +2633,7 @@ public class WifiP2pServiceImpl extends IWifiP2pManager.Stub { // DHCP server has already been started if I am a group owner if (mGroup.isGroupOwner()) { setWifiP2pInfoOnGroupFormation( - NetworkUtils.numericToInetAddress(SERVER_ADDRESS)); + InetAddresses.parseNumericAddress(SERVER_ADDRESS)); } // In case of a negotiation group, connection changed is sent @@ -3096,7 +3096,7 @@ public class WifiP2pServiceImpl extends IWifiP2pManager.Stub { InterfaceConfiguration ifcg = null; try { ifcg = mNwService.getInterfaceConfig(intf); - ifcg.setLinkAddress(new LinkAddress(NetworkUtils.numericToInetAddress( + ifcg.setLinkAddress(new LinkAddress(InetAddresses.parseNumericAddress( SERVER_ADDRESS), 24)); ifcg.setInterfaceUp(); mNwService.setInterfaceConfig(intf, ifcg); diff --git a/service/java/com/android/server/wifi/util/XmlUtil.java b/service/java/com/android/server/wifi/util/XmlUtil.java index 1093a9612..9ff6554be 100644 --- a/service/java/com/android/server/wifi/util/XmlUtil.java +++ b/service/java/com/android/server/wifi/util/XmlUtil.java @@ -18,12 +18,12 @@ package com.android.server.wifi.util; import android.annotation.NonNull; import android.annotation.Nullable; +import android.net.InetAddresses; import android.net.IpConfiguration; import android.net.IpConfiguration.IpAssignment; import android.net.IpConfiguration.ProxySettings; import android.net.LinkAddress; import android.net.MacAddress; -import android.net.NetworkUtils; import android.net.ProxyInfo; import android.net.RouteInfo; import android.net.StaticIpConfiguration; @@ -888,7 +888,7 @@ public class XmlUtil { (Integer) XmlUtil.readNextValueWithName(in, XML_TAG_LINK_PREFIX_LENGTH); if (linkAddressString != null && linkPrefixLength != null) { LinkAddress linkAddress = new LinkAddress( - NetworkUtils.numericToInetAddress(linkAddressString), + InetAddresses.parseNumericAddress(linkAddressString), linkPrefixLength); if (linkAddress.getAddress() instanceof Inet4Address) { builder.setIpAddress(linkAddress); @@ -900,7 +900,7 @@ public class XmlUtil { (String) XmlUtil.readNextValueWithName(in, XML_TAG_GATEWAY_ADDRESS); if (gatewayAddressString != null) { InetAddress gateway = - NetworkUtils.numericToInetAddress(gatewayAddressString); + InetAddresses.parseNumericAddress(gatewayAddressString); RouteInfo route = new RouteInfo(null, gateway, null, RouteInfo.RTN_UNICAST); if (route.isDefaultRoute() && route.getDestination().getAddress() instanceof Inet4Address) { @@ -915,7 +915,7 @@ public class XmlUtil { List<InetAddress> dnsServerAddresses = new ArrayList<>(); for (String dnsServerAddressString : dnsServerAddressesString) { InetAddress dnsServerAddress = - NetworkUtils.numericToInetAddress(dnsServerAddressString); + InetAddresses.parseNumericAddress(dnsServerAddressString); dnsServerAddresses.add(dnsServerAddress); } builder.setDnsServers(dnsServerAddresses); |