ethernet: fix IpClient restart when link is down
Do not restart IpClient when link is down after calling updateConfiguration(). Test: atest EthernetManagerTest Bug: 249897651 Change-Id: Ia0f6b67cde63747a608d35b8bec6ad37bcabb110
This commit is contained in:
parent
53c84a8f1f
commit
ae3ace4433
2 changed files with 22 additions and 1 deletions
|
|
@ -469,7 +469,9 @@ public class EthernetNetworkFactory {
|
|||
// TODO: Update this logic to only do a restart if required. Although a restart may
|
||||
// be required due to the capabilities or ipConfiguration values, not all
|
||||
// capabilities changes require a restart.
|
||||
restart();
|
||||
if (mIpClient != null) {
|
||||
restart();
|
||||
}
|
||||
}
|
||||
|
||||
boolean isRestricted() {
|
||||
|
|
|
|||
|
|
@ -979,4 +979,23 @@ class EthernetManagerTest {
|
|||
cb.eventuallyExpectCapabilities(TEST_CAPS)
|
||||
cb.eventuallyExpectLpForStaticConfig(STATIC_IP_CONFIGURATION.staticIpConfiguration)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testUpdateConfiguration_withLinkDown() {
|
||||
assumeChangingCarrierSupported()
|
||||
// createInterface without carrier is racy, so create it and then remove carrier.
|
||||
val iface = createInterface()
|
||||
val cb = requestNetwork(ETH_REQUEST)
|
||||
cb.expectAvailable()
|
||||
|
||||
iface.setCarrierEnabled(false)
|
||||
cb.eventuallyExpectLost()
|
||||
|
||||
updateConfiguration(iface, STATIC_IP_CONFIGURATION, TEST_CAPS).expectResult(iface.name)
|
||||
cb.assertNoCallback()
|
||||
|
||||
iface.setCarrierEnabled(true)
|
||||
cb.eventuallyExpectCapabilities(TEST_CAPS)
|
||||
cb.eventuallyExpectLpForStaticConfig(STATIC_IP_CONFIGURATION.staticIpConfiguration)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue