Change removeStackedLink to take an interface name.
This simplifies callers. Also remove all "implementations" of addStackedLink and removeStackedLink except the one in LinkProperties, because they are unused. Bug: 12111730 Change-Id: Ie294b855facba4b1436299dcb3211b72d9ba448e
This commit is contained in:
@@ -493,16 +493,16 @@ public final class LinkProperties implements Parcelable {
|
||||
/**
|
||||
* Removes a stacked link.
|
||||
*
|
||||
* If there a stacked link with the same interfacename as link, it is
|
||||
* If there is a stacked link with the given interface name, it is
|
||||
* removed. Otherwise, nothing changes.
|
||||
*
|
||||
* @param link The link to remove.
|
||||
* @param iface The interface name of the link to remove.
|
||||
* @return true if the link was removed, false otherwise.
|
||||
* @hide
|
||||
*/
|
||||
public boolean removeStackedLink(LinkProperties link) {
|
||||
if (link != null && link.getInterfaceName() != null) {
|
||||
LinkProperties removed = mStackedLinks.remove(link.getInterfaceName());
|
||||
public boolean removeStackedLink(String iface) {
|
||||
if (iface != null) {
|
||||
LinkProperties removed = mStackedLinks.remove(iface);
|
||||
return removed != null;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -338,14 +338,14 @@ public class LinkPropertiesTest extends TestCase {
|
||||
assertFalse("newname".equals(link.getInterfaceName()));
|
||||
}
|
||||
|
||||
assertTrue(rmnet0.removeStackedLink(clat4));
|
||||
assertTrue(rmnet0.removeStackedLink("clat4"));
|
||||
assertEquals(0, rmnet0.getStackedLinks().size());
|
||||
assertEquals(1, rmnet0.getAddresses().size());
|
||||
assertEquals(1, rmnet0.getLinkAddresses().size());
|
||||
assertEquals(1, rmnet0.getAllAddresses().size());
|
||||
assertEquals(1, rmnet0.getAllLinkAddresses().size());
|
||||
|
||||
assertFalse(rmnet0.removeStackedLink(clat4));
|
||||
assertFalse(rmnet0.removeStackedLink("clat4"));
|
||||
}
|
||||
|
||||
private LinkAddress getFirstLinkAddress(LinkProperties lp) {
|
||||
@@ -370,7 +370,7 @@ public class LinkPropertiesTest extends TestCase {
|
||||
assertTrue(stacked.hasGlobalIPv6Address());
|
||||
assertFalse(lp.hasIPv4Address());
|
||||
assertFalse(lp.hasGlobalIPv6Address());
|
||||
lp.removeStackedLink(stacked);
|
||||
lp.removeStackedLink("stacked");
|
||||
assertFalse(lp.hasIPv4Address());
|
||||
assertFalse(lp.hasGlobalIPv6Address());
|
||||
|
||||
|
||||
@@ -217,7 +217,7 @@ public class Nat464Xlat extends BaseNetworkObserver {
|
||||
NetworkUtils.resetConnections(
|
||||
CLAT_INTERFACE_NAME,
|
||||
NetworkUtils.RESET_IPV4_ADDRESSES);
|
||||
mBaseLP.removeStackedLink(mLP);
|
||||
mBaseLP.removeStackedLink(CLAT_INTERFACE_NAME);
|
||||
updateConnectivityService();
|
||||
}
|
||||
Slog.i(TAG, "interface " + CLAT_INTERFACE_NAME +
|
||||
|
||||
Reference in New Issue
Block a user