Network Stack is an updatable Mainline module that ensures that Android can adapt to evolving network standards and allows for interoperability with new implementations. For example, updates to captive portal detection and login code allow Android to stay up to date with changing captive portal models, and updates to APF allow Android to save power on Wi-Fi as new types of packets become common.
Included components
The Network Stack module contains the following components. On devices using the module, these services were moved to a different process and are accessed through a stable AIDL interface.
IP services.
IpClient
(formerlyIpManager
) is a component in charge of IP layer provisioning and maintenance. In Android 9, it was already used cross-process by components such as Bluetooth, and in-process by components such as Wi-Fi.DhcpClient
obtains IP addresses from DHCP servers so they can be assigned to interfaces.NetworkMonitor. The
NetworkMonitor
component tests for internet reachability when connecting to a new network or upon network failures, when detecting captive portals, and when validating networks.Captive portal login app. A preinstalled app in charge of managing login on captive portals. This has been a separate app since Android 5.0, but it interacts with
NetworkMonitor
to forward some user choices to the system.
Affected paths
The paths moved to the Network Stack module by the refactor are listed below.
IP services. In
frameworks/base/services/net/java/android/net/
:apf
dhcp
ip
netlink
util
(partly)
Captive portal detection and login. In
frameworks/base/
:core/java/android/net/captiveportal/
services/core/java/com/android/server/connectivity/NetworkMonitor.java
packages/CaptivePortalLogin/*
The new location of the moved code is in packages/modules/NetworkStack
,
packages/modules/CaptivePortalLogin
and some other shared locations. The above
paths refer to the location of files before being moved there for Mainline.
Files in packages/modules/NetworkStack
and
packages/modules/CaptivePortalLogin
are part of the Mainline module and cannot
be modified.
Package format
The Network Stack module contains the following components in APK format:
- IP services
- Captive portal login (
com.google.android.captiveportallogin
)
This module is accompanied by the Network Stack Permission Config module, which is a pre-installed APK file that defines the necessary permissions for the Network Stack components.
Dependencies
The Network Stack module depends on the following:
Privileged @hide methods in the system server (e.g., in
IConnectivityManager.aidl
). These APIs have been made@SystemApi
and appropriately protected so that they are accessible to the Mainline module but not other privileged apps (e.g., using a new signature permission).Binder IPCs to
netd
defined inINetd.aidl
. This interface has been converted to stable AIDL and is subject to conformance tests.