diff options
| author | Roshan Pius <rpius@google.com> | 2018-10-05 09:42:19 -0700 |
|---|---|---|
| committer | Roshan Pius <rpius@google.com> | 2018-10-31 09:23:15 -0700 |
| commit | 99cfe09fa20a955f47fcabc18f1f693ca266a1da (patch) | |
| tree | 1c4a042899b9793f7d218fadfb57e0c88d518e3e /core/java/android/net/MacAddress.java | |
| parent | 914a64ecd259402b937896d0e5a75fb5eba5d61b (diff) | |
wifi(API): NetworkSpecifier for Wifi NetworkAgent
Create an @hide NetworkSpecifier to use by the Wifi NetworkAgent. This
will be used by connectivity service to match the incoming
NetworkRequest (with WifiNetworkSpecifier) with the NetworkAgent we
created to serve that request.
The WifiNetworkAgentSpecifier will hold the current connected wifi
network configuration which will be used to pattern match the
WifiNetworkSpecifier from NetworkRequest's.
Also, added a @hide helper method in MacAddress to help with matching
bssid pattern.
Bug: 113878056
Test: Unit tests
Change-Id: I9a643f0b914d48ff64104c798ec2869db40cb24b
Diffstat (limited to 'core/java/android/net/MacAddress.java')
| -rw-r--r-- | core/java/android/net/MacAddress.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/core/java/android/net/MacAddress.java b/core/java/android/net/MacAddress.java index 98f356722bf3..4cd000113b7e 100644 --- a/core/java/android/net/MacAddress.java +++ b/core/java/android/net/MacAddress.java @@ -393,4 +393,19 @@ public final class MacAddress implements Parcelable { } return out; } + + /** + * Checks if this MAC Address matches the provided range. + * + * @param baseAddress MacAddress representing the base address to compare with. + * @param mask MacAddress representing the mask to use during comparison. + * @return true if this MAC Address matches the given range. + * + * @hide + */ + public boolean matches(@NonNull MacAddress baseAddress, @NonNull MacAddress mask) { + Preconditions.checkNotNull(baseAddress); + Preconditions.checkNotNull(mask); + return (mAddr & mask.mAddr) == (baseAddress.mAddr & mask.mAddr); + } } |
