Replace the NetdService usage in the EthernetService.
Ethernet service related files are going to be moved into Connectivity
module. NetdService won't be visible to EthernetService. Use asInterface
to get the Netd service instead.
Bug: 210586283
Test: m
Change-Id: I3bf504cd947f74bf5830659915483fe5331ac9eb
diff --git a/service-t/src/com/android/server/ethernet/EthernetService.java b/service-t/src/com/android/server/ethernet/EthernetService.java
index 492a55a..e6fee9e 100644
--- a/service-t/src/com/android/server/ethernet/EthernetService.java
+++ b/service-t/src/com/android/server/ethernet/EthernetService.java
@@ -18,7 +18,6 @@
import android.content.Context;
import android.net.INetd;
-import android.net.util.NetdService;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.IBinder;
@@ -41,11 +40,12 @@
final EthernetNetworkFactory factory = new EthernetNetworkFactory(handler, context);
mImpl = new EthernetServiceImpl(
context, handler,
- new EthernetTracker(context, handler, factory, getNetd()));
+ new EthernetTracker(context, handler, factory, getNetd(context)));
}
- private INetd getNetd() {
- final INetd netd = NetdService.getInstance();
+ private INetd getNetd(Context context) {
+ final INetd netd =
+ INetd.Stub.asInterface((IBinder) context.getSystemService(Context.NETD_SERVICE));
Objects.requireNonNull(netd, "could not get netd instance");
return netd;
}