Refactor wifi p2p's startDhcpServer function

Add getTetheredDhcpRanges() interface and call it before calling
mNwService.startTethering to update dhcp ranges.  This will allow
p2p apps to run well concurently with other tethering apps.

Manual import of AOSP change 81546 by jianzheng.zhou@freescale.com

Change-Id: Iebc62f95bdcedde80e2c1d3e9580d3f625c3b50b
This commit is contained in:
Robert Greenwalt
2014-06-23 14:53:42 -07:00
parent 9d896191e5
commit e594a76c9f
3 changed files with 21 additions and 0 deletions

View File

@@ -1461,6 +1461,20 @@ public class ConnectivityManager {
} }
} }
/**
* Get the set of tethered dhcp ranges.
*
* @return an array of 0 or more {@code String} of tethered dhcp ranges.
* {@hide}
*/
public String[] getTetheredDhcpRanges() {
try {
return mService.getTetheredDhcpRanges();
} catch (RemoteException e) {
return new String[0];
}
}
/** /**
* Attempt to tether the named interface. This will setup a dhcp server * Attempt to tether the named interface. This will setup a dhcp server
* on the interface, forward and NAT IP packets and forward DNS requests * on the interface, forward and NAT IP packets and forward DNS requests

View File

@@ -91,6 +91,8 @@ interface IConnectivityManager
String[] getTetheringErroredIfaces(); String[] getTetheringErroredIfaces();
String[] getTetheredDhcpRanges();
String[] getTetherableUsbRegexs(); String[] getTetherableUsbRegexs();
String[] getTetherableWifiRegexs(); String[] getTetherableWifiRegexs();

View File

@@ -3613,6 +3613,11 @@ public class ConnectivityService extends IConnectivityManager.Stub {
return mTethering.getErroredIfaces(); return mTethering.getErroredIfaces();
} }
public String[] getTetheredDhcpRanges() {
enforceConnectivityInternalPermission();
return mTethering.getTetheredDhcpRanges();
}
// if ro.tether.denied = true we default to no tethering // if ro.tether.denied = true we default to no tethering
// gservices could set the secure setting to 1 though to enable it on a build where it // gservices could set the secure setting to 1 though to enable it on a build where it
// had previously been turned off. // had previously been turned off.