Make the interface with DHCP IPv6 capable.
It doesn't work (yet) for IPv6, but we can remove v4-centric notions from the framework.
bug:2542681
Change-Id: I21c058f5c88d07706c9265bf0ea902fc90357e56
diff --git a/core/java/android/bluetooth/BluetoothTetheringDataTracker.java b/core/java/android/bluetooth/BluetoothTetheringDataTracker.java
index 7b083f1..aa1adcb 100644
--- a/core/java/android/bluetooth/BluetoothTetheringDataTracker.java
+++ b/core/java/android/bluetooth/BluetoothTetheringDataTracker.java
@@ -18,7 +18,7 @@
import android.content.Context;
import android.net.ConnectivityManager;
-import android.net.DhcpInfo;
+import android.net.DhcpInfoInternal;
import android.net.LinkAddress;
import android.net.LinkCapabilities;
import android.net.LinkProperties;
@@ -251,23 +251,12 @@
public void run() {
//TODO(): Add callbacks for failure and success case.
//Currently this thread runs independently.
- DhcpInfo dhcpInfo = new DhcpInfo();
- if (!NetworkUtils.runDhcp(mIface, dhcpInfo)) {
+ DhcpInfoInternal dhcpInfoInternal = new DhcpInfoInternal();
+ if (!NetworkUtils.runDhcp(mIface, dhcpInfoInternal)) {
Log.e(TAG, "DHCP request error:" + NetworkUtils.getDhcpError());
return;
}
- mLinkProperties.addLinkAddress(new LinkAddress(
- NetworkUtils.intToInetAddress(dhcpInfo.ipAddress),
- NetworkUtils.intToInetAddress(dhcpInfo.netmask)));
- mLinkProperties.setGateway(NetworkUtils.intToInetAddress(dhcpInfo.gateway));
- InetAddress dns1Addr = NetworkUtils.intToInetAddress(dhcpInfo.dns1);
- if (dns1Addr == null || dns1Addr.equals("0.0.0.0")) {
- mLinkProperties.addDns(dns1Addr);
- }
- InetAddress dns2Addr = NetworkUtils.intToInetAddress(dhcpInfo.dns2);
- if (dns2Addr == null || dns2Addr.equals("0.0.0.0")) {
- mLinkProperties.addDns(dns2Addr);
- }
+ mLinkProperties = dhcpInfoInternal.makeLinkProperties();
mLinkProperties.setInterfaceName(mIface);
mNetworkInfo.setIsAvailable(true);