Ethernet Config — AIDL Interface

This document describes the AIDL API exposed by Ethernet Config (com.example.ethernetconfig). The service registers a system binder named blissethernet.

For end-to-end device validation (including persist.bass.ethernet.* auto-config), see Testing Guide. Overview: Ethernet Config.

Client JAR: Download bliss-ethernet-framework.jar — see system_libs/README.md (also mirrored at /static/downloads/bliss-ethernet-framework.jar).


Prerequisites

  • Ethernet Config installed as a privileged/system app (Bass ROM builds include it).
  • The blissethernet service registered in ServiceManager (started at boot via init / start-bliss-ethernet).
  • For third-party apps: caller must be authorized (see Authorization).
  • Ethernet tethering requires TETHER_PRIVILEGED on the server (granted via priv-app whitelist).

IP assignment modes

Canonical values for getIpAssignment / setIpAssignment:

Value Constant Meaning
0 UNASSIGNED Interface administratively down / unassigned
1 DHCP Automatic IP via DHCP
2 STATIC Static IP, gateway, and DNS

Static IP address format: <IPv4>/<prefix> (e.g. 192.168.1.100/24).

Legacy JAR migration (breaking)

The old Bliss Ethernet Manager client JAR used different integers:

Meaning Legacy JAR Current (Ethernet Config)
UNASSIGNED -1 0
DHCP 0 1
STATIC 1 2
  • getIpAssignment always returns canonical 0/1/2.
  • setIpAssignment accepts canonical 0/1/2 and exclusive legacy -1 (→ UNASSIGNED).
  • For legacy 0 (DHCP) / 1 (STATIC), call BlissEthernetAssignment.fromLegacy(value) before set, or update constants.
  • The old JAR does not include ethernet tethering APIs — use the new JAR / AIDL sources.

Ethernet tethering

Tethering shares the device’s upstream network over an ethernet downstream. The server uses AOSP TetheringManager with an optional static IPv4 pair (gateway + single DHCP client address in the same prefix).

Method Description
startEthernetTethering(localIpv4, clientIpv4) Start ethernet tether. Empty strings → defaults below.
stopEthernetTethering() Stop ethernet tether.
isEthernetTetheringActive() Whether a start has succeeded and not yet stopped.
getEthernetTetherLocalIpv4() Last requested / default gateway ip/prefix.
getEthernetTetherClientIpv4() Last requested / default client ip/prefix.

Defaults when arguments are empty:

  • Local (gateway): 192.168.10.1/24
  • Client (DHCP offer): 192.168.10.2/24

Non-empty values must be ip/prefix strings in the same prefix.

BlissEthernetManager mgr = BlissEthernetManager.getInstance(context);
// Product default 192.168.10.0/24
mgr.startEthernetTethering("", "");
// Custom pair
mgr.startEthernetTethering("192.168.10.1/24", "192.168.10.50/24");
mgr.stopEthernetTethering();

Client usage

Gradle

Download bliss-ethernet-framework.jar (or the static mirror), place it in your app’s system_libs/, then:

implementation fileTree(dir: 'system_libs/', include: ['*.jar'])

Or copy AIDL sources into your module and enable buildFeatures { aidl = true }.

Java

import org.blissos.ethernet.BlissEthernetManager;
import org.blissos.ethernet.BlissEthernetAssignment;

BlissEthernetManager blissEthernetManager = BlissEthernetManager.getInstance(context);

String[] interfaces = blissEthernetManager.getAvailableInterfaces();
boolean up = blissEthernetManager.isAvailable("eth0");

blissEthernetManager.setIpAssignment("eth0", BlissEthernetAssignment.STATIC);
blissEthernetManager.setIpAddress("eth0", "192.168.1.100/24");
blissEthernetManager.setGateway("eth0", "192.168.1.1");
blissEthernetManager.setDnses("eth0", new String[] { "8.8.8.8", "8.8.4.4" });

blissEthernetManager.startEthernetTethering("", "");

Manifest (client app)

<uses-permission android:name="org.blissos.ethernet.permission.ACCESS_ETHERNET_MANAGER" />

AIDLs

IBlissEthernet.aidl:

package org.blissos.ethernet;

import org.blissos.ethernet.IBlissEthernetServiceListener;

interface IBlissEthernet {
    String[] getAvailableInterfaces();
    boolean isAvailable(String iface);
    void setListener(in IBlissEthernetServiceListener listener);

    void setInterfaceUp(String iface);
    void setInterfaceDown(String iface);

    String getEthernetMacAddress(String ifname);
    int getIpAssignment(String iface);
    void setIpAssignment(String iface, int assignment);
    String getIpAddress(String iface);
    void setIpAddress(String iface, String ipAddress);
    String getGateway(String iface);
    void setGateway(String iface, String gateway);
    String[] getDnses(String iface);
    void setDnses(String iface, in String[] dnses);

    void startEthernetTethering(String localIpv4, String clientIpv4);
    void stopEthernetTethering();
    boolean isEthernetTetheringActive();
    String getEthernetTetherLocalIpv4();
    String getEthernetTetherClientIpv4();
}

IBlissEthernetServiceListener.aidl:

package org.blissos.ethernet;

oneway interface IBlissEthernetServiceListener {
    void onAvailabilityChanged(String iface, boolean isAvailable);
}

Method reference

Method Description
getAvailableInterfaces() Detected Ethernet interface names
isAvailable(String iface) Whether the interface is available
setListener(...) Availability callbacks (null to clear)
setInterfaceUp / setInterfaceDown Bring interface up or down
getEthernetMacAddress MAC from sysfs / NetworkInterface
getIpAssignment / setIpAssignment Canonical 0 UNASSIGNED, 1 DHCP, 2 STATIC
getIpAddress / setIpAddress Static address as ip/prefix
getGateway / setGateway Default gateway
getDnses / setDnses DNS servers
startEthernetTethering / stopEthernetTethering Ethernet tether control
isEthernetTetheringActive Tether active flag
getEthernetTetherLocalIpv4 / getEthernetTetherClientIpv4 Last tether address pair

Partial updates (setIpAddress, setGateway, setDnses) merge with the current interface configuration before applying.


Authorization

A call succeeds only if the caller is one of:

  1. System UID or shell UID (e.g. adb shell service call …)
  2. Same app as the server (com.example.ethernetconfig)
  3. Holder of org.blissos.ethernet.permission.ACCESS_ETHERNET_MANAGER
  4. Package listed in bliss_ethernet_authorized_packages, or allow-all mode enabled in the server app resources

Unauthorized callers receive SecurityException.


ADB interface

adb shell service call blissethernet <code> [parameters...]

<code> is the 1-based transaction ID matching AIDL method order.

Code AIDL method Parameters
1 getAvailableInterfaces
2 isAvailable s16 interface name
3 setListener listener binder (uncommon from shell)
4 setInterfaceUp s16 interface name
5 setInterfaceDown s16 interface name
6 getEthernetMacAddress s16 interface name
7 getIpAssignment s16 interface name
8 setIpAssignment s16 iface, i32 assignment
9 getIpAddress s16 interface name
10 setIpAddress s16 iface, s16 ip/prefix
11 getGateway s16 interface name
12 setGateway s16 iface, s16 gateway
13 getDnses s16 interface name
14 setDnses s16 iface, string array
15 startEthernetTethering s16 localIpv4, s16 clientIpv4 (empty → defaults)
16 stopEthernetTethering
17 isEthernetTetheringActive
18 getEthernetTetherLocalIpv4
19 getEthernetTetherClientIpv4

Examples

# List interfaces
adb shell service call blissethernet 1

# isAvailable(eth0)
adb shell service call blissethernet 2 s16 eth0

# getIpAssignment — 0=UNASSIGNED, 1=DHCP, 2=STATIC
adb shell service call blissethernet 7 s16 eth0

# Set static IP
adb shell service call blissethernet 8 s16 eth0 i32 2
adb shell service call blissethernet 10 s16 eth0 s16 192.168.1.100/24
adb shell service call blissethernet 12 s16 eth0 s16 192.168.1.1

# Start ethernet tethering with product defaults (192.168.10.1/24 + 192.168.10.2/24)
adb shell service call blissethernet 15 s16 "" s16 ""

# Start with explicit addresses
adb shell service call blissethernet 15 s16 192.168.10.1/24 s16 192.168.10.50/24

# Status / stop
adb shell service call blissethernet 17
adb shell service call blissethernet 16

Verify service registration

adb shell service list | grep blissethernet

If missing after boot, see Ethernet Config — Boot start.


Compatibility notes

  • Package namespace: org.blissos.ethernet (unchanged from Bliss Ethernet Manager)
  • Service name: blissethernet (unchanged)
  • Client IP methods (codes 1–14): Same shapes as legacy; assignment integers changed (see table above)
  • Tethering (codes 15–19): New in Ethernet Config — not present in the legacy JAR
  • Listener: onAvailabilityChanged fires while BlissEthernetService is running

Legacy app UI docs: BlissEthernetManager.