Merge "Allow WiFi components to manage interface up state"
am: dfa6e6f186
Change-Id: If2bdb1b6671465daffa8c0161f52c8693146a816
This commit is contained in:
@@ -80,6 +80,14 @@ public class InterfaceConfiguration implements Parcelable {
|
|||||||
mFlags.add(FLAG_DOWN);
|
mFlags.add(FLAG_DOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set flags so that no changes will be made to the up/down status.
|
||||||
|
*/
|
||||||
|
public void ignoreInterfaceUpDownStatus() {
|
||||||
|
mFlags.remove(FLAG_UP);
|
||||||
|
mFlags.remove(FLAG_DOWN);
|
||||||
|
}
|
||||||
|
|
||||||
public LinkAddress getLinkAddress() {
|
public LinkAddress getLinkAddress() {
|
||||||
return mAddr;
|
return mAddr;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -136,11 +136,18 @@ public class TetherInterfaceStateMachine extends StateMachine {
|
|||||||
if (ifcg != null) {
|
if (ifcg != null) {
|
||||||
InetAddress addr = NetworkUtils.numericToInetAddress(ipAsString);
|
InetAddress addr = NetworkUtils.numericToInetAddress(ipAsString);
|
||||||
ifcg.setLinkAddress(new LinkAddress(addr, prefixLen));
|
ifcg.setLinkAddress(new LinkAddress(addr, prefixLen));
|
||||||
|
if (mInterfaceType == ConnectivityManager.TETHERING_WIFI) {
|
||||||
|
// The WiFi stack has ownership of the interface up/down state.
|
||||||
|
// It is unclear whether the bluetooth or USB stacks will manage their own
|
||||||
|
// state.
|
||||||
|
ifcg.ignoreInterfaceUpDownStatus();
|
||||||
|
} else {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
ifcg.setInterfaceUp();
|
ifcg.setInterfaceUp();
|
||||||
} else {
|
} else {
|
||||||
ifcg.setInterfaceDown();
|
ifcg.setInterfaceDown();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
ifcg.clearFlag("running");
|
ifcg.clearFlag("running");
|
||||||
mNMService.setInterfaceConfig(mIfaceName, ifcg);
|
mNMService.setInterfaceConfig(mIfaceName, ifcg);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user