9

Android 13 will add a setting to throttle Internet speeds

 2 years ago
source link: https://blog.esper.io/android-13-network-throttling-setting/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
Android 13 will add a setting to throttle Internet speeds

By using this website, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. View our Privacy Policy for more information.

Average Internet speed varies wildly by region, so it’s important for developers to consider how their applications behave when connectivity is suboptimal. Unforeseen problems may arise when a device’s Internet connection is slow, and developers can get ahead of these issues by testing their apps under simulated network conditions. However, neither Android Studio nor Android itself offer an easy way to throttle Internet speeds, leaving developers to find solutions for themselves. This will change in Android 13, with the addition of a new setting to throttle network speeds.

Over the last few weeks, Google has introduced new code to Android’s network connectivity APIs that enables bandwidth limiting. According to this new code, Android 13 will support setting a rate limit on any Internet-capable network, including both Wi-Fi and cellular networks. The rate limit is defined in bytes per second and is stored in the Settings.Global value ‘ingress_rate_limit_bytes_per_second.’ For example, if the desired rate limit is 1Mbps, then the value of ‘ingress_rate_limit_bytes_per_second’ will be ‘125000.’ A value ≤ 0 will disable throttling entirely. The rate limit is applied on a per-network basis, so a device that’s connected to multiple networks simultaneously could exceed the limit.

Android 13’s new bandwidth rate limiting API won’t be supported on all devices, however. The kernel must support the feature, which can be accomplished by building Linux with the following config options: CONFIG_NET_SCHED, CONFIG_NET_SCH_INGRESS, CONFIG_NET_CLS_MATCHALL, CONFIG_NET_CLS_ACT, CONFIG_NET_ACT_POLICE, and CONFIG_NET_ACT_BPF. The configuration value ‘config_ingress_rate_limiting_supported’ of ServiceConnectivityResources should be set to ‘true’ (via a runtime resource overlay) if the kernel was built with support for network rate limiting.

framework-connectivity-in-the-com.android.tethering-Mainline-module-of-Android-13-DP2.png?resize=2560%2C1392&ssl=1service-connectivity-in-the-com.android.tethering-Mainline-module-of-Android-13-DP2.png?resize=2560%2C1392&ssl=1The new bandwidth rate limiting APIs have been added to Android’s network connectivity APIs in Android 13 Developer Preview 2. The relevant code can be found in the JARs contained within the Tethering APEX.

Although the second developer preview build of Android 13 contains the new bandwidth limiting APIs, there is currently no user-facing way for developers to set a rate limit. A Google employee has confirmed that the company has implemented a setting in developer options to throttle Internet speeds, however. This setting is expected to be available in the first beta build of Android 13, which is scheduled to release sometime next month. Until the setting arrives, developers can simulate slow network connectivity by manually starting the Android Emulator via the command line with the -netspeed option.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK