Fix nascent timer never get removed
By design, the nascent timer will be removed after a network satisfied first request. However, this never happens. Because the mInactive is false when that happens, so isNascent is never true. Furthermore, when removing a nascent timer, the inactivity state can never be updated since no condition in the updateInactivityState will be met to update the state correctly. Thus, update inactive state accordingly when adding/removing the nascent timer. Test: TH Bug: 184227264 Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f Merged-In: I4c1521b6e0ef68ac489771a2ab6b09ef3e381577 Change-Id: I4c1521b6e0ef68ac489771a2ab6b09ef3e381577 (cherry-picked from ag/14060609)
This commit is contained in:
@@ -7851,6 +7851,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
||||
// all networks except in the case of an underlying network for a VCN.
|
||||
if (newSatisfier.isNascent()) {
|
||||
newSatisfier.unlingerRequest(NetworkRequest.REQUEST_ID_NONE);
|
||||
newSatisfier.unsetInactive();
|
||||
}
|
||||
|
||||
// if newSatisfier is not null, then newRequest may not be null.
|
||||
@@ -8355,6 +8356,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
||||
// But it will be removed as soon as the network satisfies a request for the first time.
|
||||
networkAgent.lingerRequest(NetworkRequest.REQUEST_ID_NONE,
|
||||
SystemClock.elapsedRealtime(), mNascentDelayMs);
|
||||
networkAgent.setInactive();
|
||||
|
||||
// Consider network even though it is not yet validated.
|
||||
rematchAllNetworksAndRequests();
|
||||
|
||||
Reference in New Issue
Block a user