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
This commit is contained in:
parent
d71b5643bb
commit
e26dae35e7
1 changed files with 49 additions and 1 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue