Revert "Always disconnect agents immediately."

Revert submission 3548747

Reason for revert: Droidmonitor created revert due to b/404956859. Will be verified through ABTD for standard investigation.

Reverted changes: /q/submissionid:3548747

Change-Id: I44affb742ca066406e93fc75056b4d3d1298eadb
This commit is contained in:
Satish Yalla 2025-03-19 20:18:37 -07:00
commit 19dcc447c4

View file

@ -4894,11 +4894,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
// the destroyed flag is only just above the "current satisfier wins"
// tie-breaker. But technically anything that affects scoring should rematch.
rematchAllNetworksAndRequests();
if (mQueueNetworkAgentEventsInSystemServer) {
mHandler.postDelayed(() -> disconnectAndDestroyNetwork(nai), timeoutMs);
} else {
mHandler.postDelayed(() -> nai.disconnect(), timeoutMs);
}
mHandler.postDelayed(() -> nai.disconnect(), timeoutMs);
break;
}
}
@ -5513,11 +5509,6 @@ public class ConnectivityService extends IConnectivityManager.Stub {
if (DBG) {
log(nai.toShortString() + " disconnected, was satisfying " + nai.numNetworkRequests());
}
if (mQueueNetworkAgentEventsInSystemServer) {
nai.disconnect();
}
// Clear all notifications of this network.
mNotifier.clearNotification(nai.network.getNetId());
// A network agent has disconnected.
@ -7021,11 +7012,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
final NetworkAgentInfo nai = getNetworkAgentInfoForNetwork((Network) msg.obj);
if (nai == null) break;
nai.onPreventAutomaticReconnect();
if (mQueueNetworkAgentEventsInSystemServer) {
disconnectAndDestroyNetwork(nai);
} else {
nai.disconnect();
}
nai.disconnect();
break;
case EVENT_SET_VPN_NETWORK_PREFERENCE:
handleSetVpnNetworkPreference((VpnNetworkPreferenceInfo) msg.obj);
@ -11264,11 +11251,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
break;
}
}
if (mQueueNetworkAgentEventsInSystemServer) {
disconnectAndDestroyNetwork(nai);
} else {
nai.disconnect();
}
nai.disconnect();
}
private void handleLingerComplete(NetworkAgentInfo oldNetwork) {
@ -12269,9 +12252,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
// This has to happen after matching the requests, because callbacks are just requests.
notifyNetworkCallbacks(networkAgent, CALLBACK_PRECHECK);
} else if (state == NetworkInfo.State.DISCONNECTED) {
if (!mQueueNetworkAgentEventsInSystemServer) {
networkAgent.disconnect();
}
networkAgent.disconnect();
if (networkAgent.isVPN()) {
updateVpnUids(networkAgent, networkAgent.networkCapabilities, null);
}