Google Pixel 2 Supports Hardware Accelerated Tethering for Better Battery Life while Tethering

Google Pixel 2 Supports Hardware Accelerated Tethering for Better Battery Life while Tethering

There’s a lot about the new Google Pixel 2/Pixel 2 XL that have yet to be uncovered. Google pulled a fast one on the tech world when they suddenly unveiled that the new smartphones had a custom image processor embedded called the Pixel Visual Core, though that has yet to be enabled. There’s another interesting thing we’ve found on the Pixel 2, although we’re not 100% sure what the full implications of this new feature entail. The feature, called hardware accelerated tethering, will likely improve battery life during mobile data tethering by offloading all logic related to packet forwarding and other tethering-related duties onto hardware.

Google Pixel 2 Hardware Accelerated Tethering

Existing owners of the Google Pixel 2 or the Pixel 2 XL can find the feature in Developer Options under the Networking category. It’s enabled by default, so presumably it’s already functional on these devices. In the Android Open Source Project (AOSP), we can see several commits related to the feature under the “tether-offload” tag. We can see that there is logic for passing on your smartphone’s data limit to the offload code so that your data limit isn’t exceeded.

Most importantly, we can see an implementation for the “tether offload HAL.” Hardware Abstraction Layers (HAL) are what allow the Android system to interface with the WiFi chip in the SoC that will handle hardware accelerated tethering. This HAL is used by Android to offload all of the burden of packet forwarding from Android onto hardware dedicated for it.

The end result is that the system resources dedicated to mobile data tethering will be freed up for other purposes. The less that the device’s CPU is responsible for tethering related operations, the more power is conserved. This can be especially useful when the device enters sleep, because currently software based tethering on Android needs the CPU to be kept awake with a wakelock. By offloading the responsibility of tethering onto the hardware, then perhaps the CPU can truly enter a sleep state—improving battery life the longer you tether.

So what devices support hardware accelerated tethering? Well, we’ve only found the toggle on the Google Pixel 2/Pixel 2 XL thus far so we’re assuming only those devices support it. According to the tethering offload HAL commits, it seems like Google was testing support on the Google Nexus 5X (bullhead). Furthermore, according to a few comments by Googlers, it seems that the tethering offload HAL is rather vendor neutral:

While this HAL does have a few quirks for Qualcomm setup, the vast majority of this is vendor neutral. Any vendor with a suitably capable SoC could support tethering hardware offload with this, in theory (they might skip the extra fd passing at setup, who knows).

In another comment, a Googler mentions how devices can mix and match WiFi chipsets and offload HALs but that the API they’ve build is still designed to work to squeeze the best battery life out of your device while tethering.

At the very top we define that this API will return a static configuration. Depending on the vendor /hardware implementation, these capabilities can change. For e.g. one device can have wifi from vendor A, and offload HAL from vendor B. whereas another device can have Wifi chipset from vendor B and offload HAL from vendor B. In this case the offload capabilities may be different. Even with limited capabilities, framework /client may want to take advantage of hardware offloading for a limited set. Therefore the API is designed to get most juice out of the hardware given there can be variations from soc to soc implementation.

If you own a Google Pixel 2/Pixel 2 XL and want to see the status of the hardware accelerated tethering, you can enter the following ADB shell command and look for strings related to “hardware offload:”

adb shell dumpsys connectivity tethering

We’ll have to do testing to actually see how effective hardware accelerated tethering is at improving battery life while tethering. Tethering used to cause a huge hit in performance, too, but the massive improvements in CPU speed and optimizations in Android have largely fixed that issue. Thus, we don’t expect that offloading tethering logic via the offload HAL to the WiFi chipset will lead to a noticeable improvement in performance.

About author

Mishaal Rahman
Mishaal Rahman

I am the Editor-in-chief of XDA. In addition to breaking news on the Android OS and mobile devices, I manage all editorial and reviews content on the Portal. Tips/media inquiries: [email protected]