diff options
author | Roshan Pius <rpius@google.com> | 2019-09-18 13:54:01 -0700 |
---|---|---|
committer | Roshan Pius <rpius@google.com> | 2019-09-19 06:54:27 -0700 |
commit | 01d9f78abe210569be95be2b3e2d008559dd3cc7 (patch) | |
tree | dd6db146fdd61584d3e460b07a70ca991cfbf1e0 /service | |
parent | 3cffd9799d4213405b343a5b24a01cfebfc94ed8 (diff) |
WifiNative: Add API to fetch set of all client interfaces
Bug: 140111024
Test: atest com.android.server.wifi
Change-Id: If768581a27181d78b14ee44f652f736f36029f1a
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/WifiNative.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/WifiNative.java b/service/java/com/android/server/wifi/WifiNative.java index c19584554..23e7f0cab 100644 --- a/service/java/com/android/server/wifi/WifiNative.java +++ b/service/java/com/android/server/wifi/WifiNative.java @@ -30,6 +30,7 @@ import android.os.INetworkManagementService; import android.os.RemoteException; import android.os.SystemClock; import android.text.TextUtils; +import android.util.ArraySet; import android.util.Log; import com.android.internal.annotations.Immutable; @@ -279,6 +280,17 @@ public class WifiNative { return iface.name; } + private @NonNull Set<String> findAllStaIfaceNames() { + Set<String> ifaceNames = new ArraySet<>(); + for (Iface iface : mIfaces.values()) { + if (iface.type == Iface.IFACE_TYPE_STA_FOR_CONNECTIVITY + || iface.type == Iface.IFACE_TYPE_STA_FOR_SCAN) { + ifaceNames.add(iface.name); + } + } + return ifaceNames; + } + /** Removes the existing iface that does not match the provided id. */ public Iface removeExistingIface(int newIfaceId) { Iface removedIface = null; @@ -1258,6 +1270,17 @@ public class WifiNative { } /** + * Get names of all the client interfaces. + * + * @return List of interface name of all active client interfaces. + */ + public Set<String> getClientInterfaceNames() { + synchronized (mLock) { + return mIfaceMgr.findAllStaIfaceNames(); + } + } + + /** * Get name of the softap interface. * * This is mainly used by external modules that needs to perform some |