Revert "Immediately create networks unless chickened out"

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: Ic4226f2f1a20965f80b554967568a4450e460da2
This commit is contained in:
Satish Yalla 2025-03-19 20:18:37 -07:00 • committed by Gerrit Code Review
commit 0141d82c2d

View file

@ -113,7 +113,6 @@ import static android.net.NetworkCapabilities.RES_ID_MATCH_ALL_RESERVATIONS;
import static android.net.NetworkCapabilities.RES_ID_UNSET;
import static android.net.NetworkCapabilities.TRANSPORT_CELLULAR;
import static android.net.NetworkCapabilities.TRANSPORT_TEST;
import static android.net.NetworkCapabilities.TRANSPORT_THREAD;
import static android.net.NetworkCapabilities.TRANSPORT_VPN;
import static android.net.NetworkCapabilities.TRANSPORT_WIFI;
import static android.net.NetworkRequest.Type.LISTEN_FOR_BEST;
@ -5449,18 +5448,15 @@ public class ConnectivityService extends IConnectivityManager.Stub {
}
@VisibleForTesting
protected boolean shouldCreateNetworksImmediately(@NonNull NetworkCapabilities caps) {
protected static boolean shouldCreateNetworksImmediately(@NonNull NetworkCapabilities caps) {
// The feature of creating the networks immediately was slated for U, but race conditions
// detected late required this was flagged off.
// TODO : remove when it's determined that the code is stable
return mQueueNetworkAgentEventsInSystemServer
// Local network agents for Thread used to not create networks immediately,
// but other local agents (tethering, P2P) require this to function.
|| (caps.hasCapability(NET_CAPABILITY_LOCAL_NETWORK)
&& !caps.hasTransport(TRANSPORT_THREAD));
// TODO : enable this in a Mainline update or in V, and re-enable the test for this
// in NetworkAgentTest.
return caps.hasCapability(NET_CAPABILITY_LOCAL_NETWORK);
}
private boolean shouldCreateNativeNetwork(@NonNull NetworkAgentInfo nai,
private static boolean shouldCreateNativeNetwork(@NonNull NetworkAgentInfo nai,
@NonNull NetworkInfo.State state) {
if (nai.isCreated()) return false;
if (state == NetworkInfo.State.CONNECTED) return true;