Per-Application Network Selection (PANS)

Vehicles increasingly rely on connectivity to manage the growing list of use cases requested by both OEMs and vehicle owners, resulting in an increased data footprint and associated costs. Use the Per-Application Network Selection (PANS) feature to route the traffic of specified applications on networks paid for by the OEM.

With PANS, you can manage the volume and cost of data usage while simultaneously providing a robust, secure, and connected car experience. PANS:

  • Consists of a new API added to ConnectivityManager available only to automotive devices.
  • Provides an updated Wi-Fi suggestion API (see Wi-Fi suggestion API for internet connectivity) to include support for dynamically changing PANS network capabilities.
  • Collects supporting metrics.
  • Provides a reference application.


PANS can:

  • Dynamically update application-to-network mappings.
  • Manage application-level routing without making changes to apps.
  • Only OEM-allowed applications can access the mapped OEM networks.
  • Application developers needn't make any changes to implement this feature.
  • User-facing metrics track application-to-network data usage for OEM managed networks.
  • Network access is secure and can't be abused through unintended use cases or unauthorized applications.
  • Changes to PANS application-to-network mappings are communicated to users.
  • The same network configuration is applied across all users.

Core advantages

PANS provides OEMS with these core advantages:

  1. OEMs can pay for network traffic instead of users:
    • System updates can be provided at no cost to the user.
    • Network usage of specified apps can be provided at no cost to the user.
    • Telemetry and other analytics can be managed at no cost to the user.
  2. OEMs can ensure critical applications remain connected even without a user-paid data plan. For example, safety-critical features such as maps, assistant (hands-free driving), and system updates continue to function even when a user has no data plan.
  3. PANS provides additional granularity of control specific to network traffic routing in Android. For example, OEMs can optimally define a logical network topology for the routing of application-level traffic.

Figure 1. PANS framework

Implementing PANS

To implement PANS, a new ConnectivityManager API, setOemNetworkPreference, is provided. This new API maps applications to an OemNetworkPreference. This API is available only to automotive devices and is annotated as a @SystemApi with a new signature permission.

Figure 2. Implement PANS


OemNetworkPreference is an abstraction over OEM_PAID and OEM_PRIVATE NetworkCapabilities mapping apps by package name to a network preference. Network preferences allow for network hierarchies. For example, mapping an app to the OEM_NETWORK_PREFERENCE_OEM_PAID preference will result in the following priority of default networks assigned to an app: use an UNMETERED network first, if UNMETERED is not available use an OEM_PAID network, and if OEM_PAID is not available, use the system default network.

  • OEM_PAID Used primarily for apps that can be routed on both OEM and non-OEM networks.
  • OEM_PRIVATE Used primarily for OEM apps to gain access to a network dedicated to them.
* If an unmetered network is available, use it.
* Otherwise, if a network with the OEM_PAID capability is available, use it.
* Otherwise, use the general default network.
public static final int OEM_NETWORK_PREFERENCE_OEM_PAID = 1;

* If an unmetered network is available, use it.
* Otherwise, if a network with the OEM_PAID capability is available, use it.
* Otherwise, the app doesn't get a default network.

* Use only NET_CAPABILITY_OEM_PAID networks.
public static final int OEM_NETWORK_PREFERENCE_OEM_PAID_ONLY = 3;

public static final int OEM_NETWORK_PREFERENCE_OEM_PRIVATE_ONLY = 4;

Calling PANS APIs

To use PANS APIs:

  1. Use OemNetworkPreferences to map an app to a network preference.
  2. Call setOemNetworkPreference with the OemNetworkPreferences object.
  3. Use the Runnable interface to listen for API completion.

For example:

// Mapping three packages to two network preferences
// Packages have a 1:1 mapping to network preferences
OemNetworkPreferences pref = new OemNetworkPreferences.Builder()
   .addNetworkPreference("", OEM_NETWORK_PREFERENCE_OEM_PAID)
   .addNetworkPreference("", OEM_NETWORK_PREFERENCE_OEM_PAID)

myConnectivityManager.setOemNetworkPreference(pref, myExecutor, myListener);


As you implement PANS, keep the following points in mind:

  • Network preferences aren't persisted across boots and will need to be reapplied on each boot.
  • To create a preference for an application, it needn't be installed. Therefore, network preferences for uninstalled apps can be set proactively.
  • At any given time, an app can only be mapped to a single network preference.
  • Network preferences are used to set the default network of an application. This is the network used when an application hasn't specified what network(s) it wants to use through one of the specialized APIs. Not only does this cover the vast majority of connectivity needs, it also allows continued usage of specialized APIs such as the NetworkRequest API so as to not break existing app use-cases. For example, when an app only wants to do an operation over an unmetered network, PANS won't force it to use another network.

Configuring a network

A network with either the OEM_PAID or OEM_PRIVATE capabilities must be available when using a corresponding network preference. Android provides support for the configuration of capabilities for Ethernet and Wi-Fi networks. For Ethernet networks, you can use a resource overlay, config_ethernet_interfaces. This is set at compile time.

For Wi-Fi, the WifiNetworkSuggestion API can be used with the new Android 12 APIs, setOemPaid(Boolean) and setOemPrivate(Boolean). This can be changed at runtime.

Consider these examples:

  1. A resource overlay named config_ethernet_interfaces specifies:
    • The name of the interface to configure.
    • The desired NetworkCapabilities values.
      <string-array translatable="false" name="config_ethernet_interfaces">
  2. This WiFiNetworkSuggestion can be changed dynamically:
    ArrayList<WifiNetworkSuggestion> list = new ArrayList<>();
    list.add(new WifiNetworkSuggestion.Builder()

Restricting access to PANS networks

Tagging a network with either the OEM_PAID or OEM_PRIVATE capabilities marks that network as a restricted network. Restricted networks can only be used by apps that have the CONNECTIVITY_USE_RESTRICTED_NETWORKS permission, which is controlled by OEMs.

Apps with this permission can use restricted networks provided the apps explicitly request them. However, these apps won't get restricted networks as their default. Apps mapped through PANS can have restricted OEM networks set as their default and won't need the restricted network permission to use them. When such an app has a restricted OEM network assigned as its default network by PANS, it also has the ability to explicitly request said OEM network if the app chooses to do so.

Reviewing the reference app

A reference app (including code) named NetworkPreferenceApp is provided in user-debug automotive builds and demonstrates how to:

  • Consume PANS metrics.
  • Set PANS policy.
  • Set a default policy for the device.
  • Clear a policy.
  • Apply a policy on boot.
  • Use the Driver Distraction API (see Driver Distraction Guidelines).
  • Dynamically update Wi-Fi with OEM_PAID and OEM_PRIVATE.

Figure 3. Reference app


To facilitate transparency around data usage, metrics are collected and made available regarding the amount of data transmitted over the OEM_PAID and OEM_PRIVATE network mappings.


Most troubleshooting conditions arise from either an application using the wrong network (no network connectivity) or data overages. To enable quick resolutions:

  • Connectivity dumpsys includes a list of active per-app default networks and their associated applications (mapped from PANS).
  • Netd dumpsys includes UID IP and firewall rules.
  • Netstats dumpsys includes PANS per-application metrics. For example, which applications used which OEM network.

All dumpsys data is available by creating an Android bugreport.