summaryrefslogtreecommitdiff
path: root/java/com/android/server/ethernet/EthernetTracker.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/com/android/server/ethernet/EthernetTracker.java')
-rw-r--r--java/com/android/server/ethernet/EthernetTracker.java19
1 files changed, 18 insertions, 1 deletions
diff --git a/java/com/android/server/ethernet/EthernetTracker.java b/java/com/android/server/ethernet/EthernetTracker.java
index c38c900..c291b3f 100644
--- a/java/com/android/server/ethernet/EthernetTracker.java
+++ b/java/com/android/server/ethernet/EthernetTracker.java
@@ -57,6 +57,7 @@ import com.android.net.module.util.PermissionUtils;
import java.io.FileDescriptor;
import java.net.InetAddress;
import java.util.ArrayList;
+import java.util.List;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
@@ -90,7 +91,7 @@ public class EthernetTracker {
* Interface names we track. This is a product-dependent regular expression, plus,
* if setIncludeTestInterfaces is true, any test interfaces.
*/
- private String mIfaceMatch;
+ private volatile String mIfaceMatch;
/**
* Track test interfaces if true, don't track otherwise.
*/
@@ -341,6 +342,22 @@ public class EthernetTracker {
return mFactory.getAvailableInterfaces(includeRestricted);
}
+ List<String> getInterfaceList() {
+ final List<String> interfaceList = new ArrayList<String>();
+ final String[] ifaces;
+ try {
+ ifaces = mNetd.interfaceGetList();
+ } catch (RemoteException e) {
+ Log.e(TAG, "Could not get list of interfaces " + e);
+ return interfaceList;
+ }
+ final String ifaceMatch = mIfaceMatch;
+ for (String iface : ifaces) {
+ if (iface.matches(ifaceMatch)) interfaceList.add(iface);
+ }
+ return interfaceList;
+ }
+
/**
* Returns true if given interface was configured as restricted (doesn't have
* NET_CAPABILITY_NOT_RESTRICTED) capability. Otherwise, returns false.