diff --git a/service/src/com/android/server/ConnectivityService.java b/service/src/com/android/server/ConnectivityService.java index c870edc94f..4021a82eff 100644 --- a/service/src/com/android/server/ConnectivityService.java +++ b/service/src/com/android/server/ConnectivityService.java @@ -504,8 +504,13 @@ public class ConnectivityService extends IConnectivityManager.Stub { static final int MAX_NETWORK_REQUESTS_PER_UID = 100; // The maximum number of network request allowed for system UIDs before an exception is thrown. + // The point of this limit is to help developers find request leaks, so it should be + // appropriately low, while allowing plenty of requests for normal use cases. + // In the case of the system UIDs, the main consumer of such requests is JobScheduler, which + // at most might file one request per UID on the system. Also see b/391114053 for some context + // about the specific JobScheduler case and its own self-imposed limit. @VisibleForTesting - static final int MAX_NETWORK_REQUESTS_PER_SYSTEM_UID = 250; + static final int MAX_NETWORK_REQUESTS_PER_SYSTEM_UID = 375; @VisibleForTesting protected int mLingerDelayMs; // Can't be final, or test subclass constructors can't change it. diff --git a/tests/unit/java/com/android/server/ConnectivityServiceTest.java b/tests/unit/java/com/android/server/ConnectivityServiceTest.java index 5337bfb444..63d014aad9 100755 --- a/tests/unit/java/com/android/server/ConnectivityServiceTest.java +++ b/tests/unit/java/com/android/server/ConnectivityServiceTest.java @@ -7611,7 +7611,7 @@ public class ConnectivityServiceTest { final int CALLBACKS = 88; final int DIFF_INTENTS = 10; final int SAME_INTENTS = 10; - final int SYSTEM_ONLY_MAX_REQUESTS = 250; + final int SYSTEM_ONLY_MAX_REQUESTS = 375; // CALLBACKS + DIFF_INTENTS + 1 (same intent) // = MAX_REQUESTS - 1, since the capacity is MAX_REQUEST - 1. assertEquals(MAX_REQUESTS - 1, CALLBACKS + DIFF_INTENTS + 1);