Merge "Fix rate limit API review comments" am: a45195924e

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1991870

Change-Id: Ibb6075a3f670c0be760434ac66ac440a1df5d8ff
This commit is contained in:
Patrick Rohr 2022-02-23 19:05:53 +00:00 • committed by Automerger Merge Worker
commit 42586fa3dc
2 changed files with 9 additions and 7 deletions

View file

@ -92,7 +92,7 @@ package android.net {
method public static void setDnsResolverSampleValidityDuration(@NonNull android.content.Context, @NonNull java.time.Duration);
method public static void setDnsResolverSuccessThresholdPercent(@NonNull android.content.Context, @IntRange(from=0, to=100) int);
method public static void setGlobalProxy(@NonNull android.content.Context, @NonNull android.net.ProxyInfo);
method public static void setIngressRateLimitInBytesPerSecond(@NonNull android.content.Context, @IntRange(from=0xffffffff, to=java.lang.Integer.MAX_VALUE) long);
method public static void setIngressRateLimitInBytesPerSecond(@NonNull android.content.Context, @IntRange(from=-1L, to=4294967295L) long);
method public static void setMobileDataActivityTimeout(@NonNull android.content.Context, @NonNull java.time.Duration);
method public static void setMobileDataAlwaysOn(@NonNull android.content.Context, boolean);
method public static void setMobileDataPreferredUids(@NonNull android.content.Context, @NonNull java.util.Set<java.lang.Integer>);

View file

@ -1081,10 +1081,10 @@ public class ConnectivitySettingsManager {
}
/**
* Get the global network bandwidth rate limit.
* Get the network bandwidth ingress rate limit.
*
* The limit is only applicable to networks that provide internet connectivity. If the setting
* is unset, it defaults to -1.
* The limit is only applicable to networks that provide internet connectivity. -1 codes for no
* bandwidth limitation.
*
* @param context The {@link Context} to query the setting.
* @return The rate limit in number of bytes per second or -1 if disabled.
@ -1095,15 +1095,17 @@ public class ConnectivitySettingsManager {
}
/**
* Set the global network bandwidth rate limit.
* Set the network bandwidth ingress rate limit.
*
* The limit is only applicable to networks that provide internet connectivity.
* The limit is applied to all networks that provide internet connectivity. It is applied on a
* per-network basis, meaning that global ingress rate could exceed the limit when communicating
* on multiple networks simultaneously.
*
* @param context The {@link Context} to set the setting.
* @param rateLimitInBytesPerSec The rate limit in number of bytes per second or -1 to disable.
*/
public static void setIngressRateLimitInBytesPerSecond(@NonNull Context context,
@IntRange(from = -1, to = Integer.MAX_VALUE) long rateLimitInBytesPerSec) {
@IntRange(from = -1L, to = 0xFFFFFFFFL) long rateLimitInBytesPerSec) {
if (rateLimitInBytesPerSec < -1) {
throw new IllegalArgumentException(
"Rate limit must be within the range [-1, Integer.MAX_VALUE]");