By default, Android bring up an ethernet interface through addInterface() in EthernetTracker.java. That is, When a ethernet cable is connected, it will bring up that interface and set Ip automatically.
How to not bring up the interface by default? That is only when enableInterface() is called from my service, the interface should be up. And even if ethernet cable is connected, that interface should not come up until and unless my service calls interface up.
Things I have tried: Made a service to startup very early and listen to "Interface added/Interface state changed" notification and set the interface down to ensure the interface is down by default. But this approach brings unnecessary bring up and down of interfaces during bootup.
What I wanted: Suggest a proper way of setting ethernet interface as down by default. A solution without changing AOSP code is preferred.
Enable/disable APIs: https://source.android.com/docs/automotive/connectivity/ethernet-manage
EthernetTracker.java: https://cs.android.com/android/platform/superproject/+/android15-qpr2-release:packages/modules/Connectivity/service-t/src/com/android/server/ethernet/EthernetTracker.java?q=EthernetTracker.java
ifupdown, just make it reply "interface eth0 not configured".