Merge "Fixes isDefaultNetworkActive and onNetworkActive unreasonable behavior"

This commit is contained in:
Motomu Utsumi
2023-06-20 01:00:24 +00:00
committed by Gerrit Code Review
2 changed files with 34 additions and 27 deletions

View File

@@ -11309,18 +11309,17 @@ public class ConnectivityServiceTest {
}
@Test
public void testOnNetworkActive_NewEthernetConnects_CallbackNotCalled() throws Exception {
// LegacyNetworkActivityTracker calls onNetworkActive callback only for networks that
public void testOnNetworkActive_NewEthernetConnects_Callback() throws Exception {
// On T-, LegacyNetworkActivityTracker calls onNetworkActive callback only for networks that
// tracker adds the idle timer to. And the tracker does not set the idle timer for the
// ethernet network.
// So onNetworkActive is not called when the ethernet becomes the default network
doTestOnNetworkActive_NewNetworkConnects(TRANSPORT_ETHERNET, false /* expectCallback */);
doTestOnNetworkActive_NewNetworkConnects(TRANSPORT_ETHERNET, mDeps.isAtLeastU());
}
@Test
public void testIsDefaultNetworkActiveNoDefaultNetwork() throws Exception {
// isDefaultNetworkActive returns true if there is no default network, which is known issue.
assertTrue(mCm.isDefaultNetworkActive());
assertFalse(mCm.isDefaultNetworkActive());
final LinkProperties cellLp = new LinkProperties();
cellLp.setInterfaceName(MOBILE_IFNAME);
@@ -11332,7 +11331,7 @@ public class ConnectivityServiceTest {
mCellAgent.disconnect();
waitForIdle();
assertTrue(mCm.isDefaultNetworkActive());
assertFalse(mCm.isDefaultNetworkActive());
}
@Test