From 13d5b866144b4c35a53f712d0b39c4cb7904b015 Mon Sep 17 00:00:00 2001 From: kevinwk_lee Date: Fri, 18 Oct 2019 11:25:29 +0800 Subject: [PATCH] Avoid creating IpClient if ethernet cable is unplugged. This change avoids calling start() on needNetworkFor() if ethernet cable is unplugged. Fixed by adding isLinkUp validation. Test: ./cts-tradefed run cts-dev -d -m CtsSecurityTestCases -t \ android.security.cts.ListeningPortsTest#testNoRemotelyAccessibleListeningUdpPorts adb shell netstat -lnup Change-Id: I2debd7367a20b665249f9c19d2d8a61737435803 --- .../src/com/android/server/ethernet/EthernetNetworkFactory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service-t/src/com/android/server/ethernet/EthernetNetworkFactory.java b/service-t/src/com/android/server/ethernet/EthernetNetworkFactory.java index 3cda13f330..090dd13f4f 100644 --- a/service-t/src/com/android/server/ethernet/EthernetNetworkFactory.java +++ b/service-t/src/com/android/server/ethernet/EthernetNetworkFactory.java @@ -226,7 +226,7 @@ public class EthernetNetworkFactory extends NetworkFactory { } } else { for (NetworkInterfaceState n : mTrackingInterfaces.values()) { - if (n.statisified(request.networkCapabilities)) { + if (n.statisified(request.networkCapabilities) && n.mLinkUp) { network = n; break; }