summaryrefslogtreecommitdiff
path: root/core/java/android/net/ConnectivityDiagnosticsManager.java
diff options
context:
space:
mode:
authorChalard Jean <jchalard@google.com>2020-05-20 16:11:50 +0900
committerChalard Jean <jchalard@google.com>2020-06-11 12:30:21 +0000
commitc022b0c7ea668a09a27b124430ee4deec8ce1779 (patch)
treed2f4ca93de02a41eea14c734380c10e268a2cb49 /core/java/android/net/ConnectivityDiagnosticsManager.java
parentb3bd77fcbeb29d5fa56f071abe7cf4cb3b7b8662 (diff)
Document the limitation to a hundred callbacks.
Some developers have been surprised by this limitation and had trouble figuring out what the issue was. Add documentation to address this. This also includes a drive-by removal of a duplicate check. Bug: 149867479 Test: doc-only change Change-Id: I5911d01984695550b6c9afe7a8eb535bf5e320a1
Diffstat (limited to 'core/java/android/net/ConnectivityDiagnosticsManager.java')
-rw-r--r--core/java/android/net/ConnectivityDiagnosticsManager.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/java/android/net/ConnectivityDiagnosticsManager.java b/core/java/android/net/ConnectivityDiagnosticsManager.java
index 275e38c74451..704f31d7f773 100644
--- a/core/java/android/net/ConnectivityDiagnosticsManager.java
+++ b/core/java/android/net/ConnectivityDiagnosticsManager.java
@@ -711,6 +711,13 @@ public class ConnectivityDiagnosticsManager {
* not currently registered. If a ConnectivityDiagnosticsCallback instance is registered with
* multiple NetworkRequests, an IllegalArgumentException will be thrown.
*
+ * <p>To avoid performance issues due to apps leaking callbacks, the system will limit the
+ * number of outstanding requests to 100 per app (identified by their UID), shared with
+ * callbacks in {@link ConnectivityManager}. Registering a callback with this method will count
+ * toward this limit. If this limit is exceeded, an exception will be thrown. To avoid hitting
+ * this issue and to conserve resources, make sure to unregister the callbacks with
+ * {@link #unregisterConnectivityDiagnosticsCallback}.
+ *
* @param request The NetworkRequest that will be used to match with Networks for which
* callbacks will be fired
* @param e The Executor to be used for running the callback method invocations
@@ -718,6 +725,7 @@ public class ConnectivityDiagnosticsManager {
* System
* @throws IllegalArgumentException if the same callback instance is registered with multiple
* NetworkRequests
+ * @throws RuntimeException if the app already has too many callbacks registered.
*/
public void registerConnectivityDiagnosticsCallback(
@NonNull NetworkRequest request,