Revert isDefaultNetworkActive behavior when there is no default network
aosp/2605757 updated isDefaultNetworkActive returns false when there is no default network. But this change was not merged to U release branch and this change was not well tested by dogfooding. So this CL reverts the isDefaultNetworkActivity behavior change. Bug: 279380356 Bug: 291870075 Test: atest FrameworksNetTests Change-Id: Id88662faea9eeaba93d59ab2729f6204a3631ab1
This commit is contained in:
@@ -11138,7 +11138,9 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
new RemoteCallbackList<>();
|
new RemoteCallbackList<>();
|
||||||
// Indicate the current system default network activity is active or not.
|
// Indicate the current system default network activity is active or not.
|
||||||
// This needs to be volatile to allow non handler threads to read this value without lock.
|
// This needs to be volatile to allow non handler threads to read this value without lock.
|
||||||
private volatile boolean mIsDefaultNetworkActive;
|
// If there is no default network, default network is considered active to keep the existing
|
||||||
|
// behavior. Initial value is used until first connect to the default network.
|
||||||
|
private volatile boolean mIsDefaultNetworkActive = true;
|
||||||
private final ArrayMap<String, IdleTimerParams> mActiveIdleTimers = new ArrayMap<>();
|
private final ArrayMap<String, IdleTimerParams> mActiveIdleTimers = new ArrayMap<>();
|
||||||
|
|
||||||
private static class IdleTimerParams {
|
private static class IdleTimerParams {
|
||||||
@@ -11321,8 +11323,9 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
reportNetworkActive();
|
reportNetworkActive();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// If there is no default network, default network is considered inactive.
|
// If there is no default network, default network is considered active to keep the
|
||||||
mIsDefaultNetworkActive = false;
|
// existing behavior.
|
||||||
|
mIsDefaultNetworkActive = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11328,7 +11328,8 @@ public class ConnectivityServiceTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIsDefaultNetworkActiveNoDefaultNetwork() throws Exception {
|
public void testIsDefaultNetworkActiveNoDefaultNetwork() throws Exception {
|
||||||
assertFalse(mCm.isDefaultNetworkActive());
|
// isDefaultNetworkActive returns true if there is no default network, which is known issue.
|
||||||
|
assertTrue(mCm.isDefaultNetworkActive());
|
||||||
|
|
||||||
final LinkProperties cellLp = new LinkProperties();
|
final LinkProperties cellLp = new LinkProperties();
|
||||||
cellLp.setInterfaceName(MOBILE_IFNAME);
|
cellLp.setInterfaceName(MOBILE_IFNAME);
|
||||||
@@ -11340,7 +11341,7 @@ public class ConnectivityServiceTest {
|
|||||||
mCellAgent.disconnect();
|
mCellAgent.disconnect();
|
||||||
waitForIdle();
|
waitForIdle();
|
||||||
|
|
||||||
assertFalse(mCm.isDefaultNetworkActive());
|
assertTrue(mCm.isDefaultNetworkActive());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user