Tethering

Updates in Android 13

Update More information
Introduced CrossDevice CrossDevice
Introduced split tunnelling Split tunneling

Overview

The Tethering module shares an Android device's internet connection with other connected client devices, which can connect to tethering devices over Wi-Fi, USB, Bluetooth, or Ethernet. This module includes the tethering component (USB, Wi-Fi access point, Bluetooth, etc.) and its dependencies (interaction with tethering entitlement, IpServer, and offloadController). This module is updatable, meaning it can receive updates to functionality outside of the normal Android release cycle.

The Tethering module enables OEMs throughout the Android ecosystem to use a single, standard reference implementation that brings the following benefits.

  • End users get a consistent experience across Android devices and fixes to interoperability issues through module updates.

  • OEMs can fulfill carrier requirements while also reducing costs for individual customizations (as they don't need different implementations of the same requirements in different ways).

Split tunneling

To support split tunneling use cases, a new API is added to Android 13 to specify exclude routes.

Split tunneling refers to the configuration where certain traffic goes through the VPN while other traffic does not. A common example is where an organization wants general web surfing, bandwidth-heavy (for example, YouTube, Netflix) or latency-sensitive applications (for example, Office 365) to bypass the VPN. Before split tunneling was available, VpnService.Builder allowed the VPN client to indicate that only some subnets should be routed to it (include routes). With split tunneling, you have the ability to specify the inverse: to route all traffic to the VPN, except for specific subnets (exclude routes).

The signature of the new split tunneling API is:

public Builder excludeRoute(@NonNull IpPrefix prefix)

CrossDevice

CrossDevice, introduced in Android 13, aims to provide cross-device communication technologies using standard protocols. It provides APIs and features for device discovery, authenticated connection, and other cross-device experiences.

CrossDevice motivation

  • Tighter collaboration with OEM partners. OEMs can integrate their own account key system with CrossDevice implementation instead of needing to use Google's solution.
  • More visible implementation of the protocol. The CrossDevice module is open source, providing more visibility into the implementation details and better privacy story for CrossDevice technologies implementation.

CrossDevice module boundary

CrossDevice APIs In packages/modules/CrossDevice/framework
  • NearbyManager
  • AccountProviderBase
CrossDevice Services In packages/modules/CrossDevice/service
  • NearbyService - scanning API

CrossDevice package format

The main function of this module is included in an APEX package. The resources are packaged in an APK.

CrossDevice dependencies

CrossDevice depends on the following:

  • WiFi
  • Bluetooth
  • UWB
  • modules-utils-preconditions
  • Proto libraries

CrossDevice customization options

We plan to allow OEMS to customize the UI for half sheet through RRO. There is no plan to customize the functionality.

CrossDevice testing strategy

We plan to add Android Compatibility Test Suite (CTS) tests to verify CrossDevice functionality, and cross device testing into MTS.

eBPF tethering offload

To provide high-speed tethering without replying on hardware offloads, Android 11 provides a tethering software offload solution called eBPF tethering offload for IPv6 download (traffic flowing to tethered device).

From Android 12, this functionality (including the eBPF program code) is entirely provided by the Tethering module, which supports the following:

  • IPv6 download (traffic flowing to tethered device)
  • IPv6 upload (traffic flowing from tethered device)
  • IPv4 TCP/UDP upload and downstream (traffic flowing to/from tethered device)
  • eBPF offload

This feature is enabled by default, users can override config_tether_enable_bpf_offload configuration to false by RRO. See Customization for more information.

IPv4 and IPv6 support

The Tethering module supports IPv4 and IPv6 dual stack.

  • For IPv4 networks, the module sets up network address translation (NAT) and adopts dynamic host configuration protocol (DHCP) for IP address assignment.

  • For IPv6 networks, the module adopts IPv6 stateless address autoconfiguration (SLAAC) for IP address assignment.

Module boundary

For Android 12 and higher, all the files/folders under packages/modules/Connectivity are in the Tethering module scope.

For Android 11 and lower, the Tethering module has the following Android 10 files in packages/modules/Tethering.

  • frameworks/base/services/core/java/com/android/server/connectivity/Tethering.java
  • frameworks/base/services/core/java/com/android/server/connectivity/tethering/
  • frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
  • frameworks/base/services/net/java/android/net/ip/{InterfaceController,IpServer,RouterAdvertisementDaemon}.java
  • frameworks/base/services/net/java/android/net/{netlink,dhcp}/*
  • frameworks/base/services/net/java/android/net/util/{InterfaceSet,InterfaceParams,NetdService,PrefixUtils,SharedLog,VersionedBroadcastListener}.java
  • frameworks/base/core/java/android/net/{ITetheringEventCallback,ITetheringStatsProvider}.aidl
  • frameworks/base/core/java/android/net/{NetworkUtils,util/IpUtils}.java
  • frameworks/base/core/java/com/android/internal/util/{BitUtils,IndentingPrintWriter,State,StateMachine}.java
  • frameworks/base/core/java/com/android/server/connectivity/MockableSystemProperties.java
  • frameworks/base/core/java/android/os/INetworkManagementService.aidl
  • frameworks/base/core/java/android/bluetooth/BluetoothPan.java
  • frameworks/base/services/core/jni/com_android_server_connectivity_tethering_OffloadHardwareInterface.cpp
  • packages/apps/Settings/src/com/android/settings/wifi/tether/TetherService.java
  • packages/apps/Settings/src/com/android/settings/network/TetherProvisioningActivity.java

Module format

The Tethering module (com.android.tethering) is in APEX format and is available for devices running Android 11 or higher.

Include ConnectivityService

From Android 12, the ConnectivityService code that implements the central component of L3+ connectivity is added to the Tethering APEX. The scope of Tethering expands into a Connectivity module.

Module dependencies

The Tethering module has the following dependencies:

  • Public and system API methods in the system server
  • Stable AIDL IPCs interface with the system server
  • tetheroffload HIDL (defined in hardware/interfaces/tetheroffload/)
  • DHCP server (part of the Network Stack module)

Customization

The Tethering module doesn't support customization.

Testing

The Android Compatibility Test Suite (CTS) verifies functionality of the Tethering module.