diff options
| author | 2020-03-27 22:50:42 +0000 | |
|---|---|---|
| committer | 2020-03-27 22:50:42 +0000 | |
| commit | 996492f8668fb9c82e772fa329d138c60164422e (patch) | |
| tree | 8e06282e6c2da827e8439873d2b61c19f6e1b58a | |
| parent | c2ba1873e6199ed6e8e99149671e38662e562138 (diff) | |
| parent | 2da4f9f9ae75f67788457c99a63de4fd83c3dfd7 (diff) | |
Merge changes from topics "api-fix-networkagent", "networkprovider_api", "satisfiedby" into rvc-dev
* changes:
Rename satisfiedBy into canBeSatisfiedBy
Address further API council comments.
Update the NetworkProvider API for council comments
18 files changed, 84 insertions, 80 deletions
diff --git a/api/current.txt b/api/current.txt index 2a13e2edca98..785925ebef91 100644 --- a/api/current.txt +++ b/api/current.txt @@ -30343,11 +30343,11 @@ package android.net { } public class NetworkRequest implements android.os.Parcelable { + method public boolean canBeSatisfiedBy(@Nullable android.net.NetworkCapabilities); method public int describeContents(); method @Nullable public android.net.NetworkSpecifier getNetworkSpecifier(); method public boolean hasCapability(int); method public boolean hasTransport(int); - method public boolean satisfiedBy(@Nullable android.net.NetworkCapabilities); method public void writeToParcel(android.os.Parcel, int); field @NonNull public static final android.os.Parcelable.Creator<android.net.NetworkRequest> CREATOR; } diff --git a/api/system-current.txt b/api/system-current.txt index caa74bfb74f5..50057259223e 100755 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -6177,7 +6177,6 @@ package android.net { public final class MatchAllNetworkSpecifier extends android.net.NetworkSpecifier implements android.os.Parcelable { ctor public MatchAllNetworkSpecifier(); method public int describeContents(); - method public boolean satisfiedBy(android.net.NetworkSpecifier); method public void writeToParcel(@NonNull android.os.Parcel, int); field @NonNull public static final android.os.Parcelable.Creator<android.net.MatchAllNetworkSpecifier> CREATOR; } @@ -6198,13 +6197,14 @@ package android.net { public abstract class NetworkAgent { ctor public NetworkAgent(@NonNull android.content.Context, @NonNull android.os.Looper, @NonNull String, @NonNull android.net.NetworkCapabilities, @NonNull android.net.LinkProperties, int, @NonNull android.net.NetworkAgentConfig, @Nullable android.net.NetworkProvider); method @Nullable public android.net.Network getNetwork(); + method public void markConnected(); method public void onAddKeepalivePacketFilter(int, @NonNull android.net.KeepalivePacketData); method public void onAutomaticReconnectDisabled(); method public void onNetworkUnwanted(); method public void onRemoveKeepalivePacketFilter(int); method public void onSaveAcceptUnvalidated(boolean); method public void onSignalStrengthThresholdsUpdated(@NonNull int[]); - method public void onStartSocketKeepalive(int, @IntRange(from=10, to=3600) int, @NonNull android.net.KeepalivePacketData); + method public void onStartSocketKeepalive(int, @NonNull java.time.Duration, @NonNull android.net.KeepalivePacketData); method public void onStopSocketKeepalive(int); method public void onValidationStatus(int, @Nullable android.net.Uri); method @NonNull public android.net.Network register(); @@ -6212,7 +6212,6 @@ package android.net { method public final void sendNetworkCapabilities(@NonNull android.net.NetworkCapabilities); method public final void sendNetworkScore(@IntRange(from=0, to=99) int); method public final void sendSocketKeepaliveEvent(int, int); - method public void setConnected(); method public void unregister(); field public static final int VALIDATION_STATUS_NOT_VALID = 2; // 0x2 field public static final int VALIDATION_STATUS_VALID = 1; // 0x1 @@ -6283,8 +6282,8 @@ package android.net { ctor public NetworkProvider(@NonNull android.content.Context, @NonNull android.os.Looper, @NonNull String); method @RequiresPermission(android.Manifest.permission.NETWORK_FACTORY) public void declareNetworkRequestUnfulfillable(@NonNull android.net.NetworkRequest); method public int getProviderId(); - method public void onNetworkRequested(@NonNull android.net.NetworkRequest, int, int); - method public void onRequestWithdrawn(@NonNull android.net.NetworkRequest); + method public void onNetworkRequestWithdrawn(@NonNull android.net.NetworkRequest); + method public void onNetworkRequested(@NonNull android.net.NetworkRequest, @IntRange(from=0, to=99) int, int); field public static final int ID_NONE = -1; // 0xffffffff } @@ -6331,8 +6330,8 @@ package android.net { } public abstract class NetworkSpecifier { + method public boolean canBeSatisfiedBy(@Nullable android.net.NetworkSpecifier); method @Nullable public android.net.NetworkSpecifier redact(); - method public abstract boolean satisfiedBy(@Nullable android.net.NetworkSpecifier); } public class NetworkStack { @@ -6435,10 +6434,6 @@ package android.net { method @NonNull public android.net.StaticIpConfiguration.Builder setIpAddress(@Nullable android.net.LinkAddress); } - public final class TelephonyNetworkSpecifier extends android.net.NetworkSpecifier implements android.os.Parcelable { - method public boolean satisfiedBy(android.net.NetworkSpecifier); - } - public final class TetheredClient implements android.os.Parcelable { ctor public TetheredClient(@NonNull android.net.MacAddress, @NonNull java.util.Collection<android.net.TetheredClient.AddressInfo>, int); method public int describeContents(); @@ -7425,10 +7420,6 @@ package android.net.wifi { field public int numUsage; } - public final class WifiNetworkSpecifier extends android.net.NetworkSpecifier implements android.os.Parcelable { - method public boolean satisfiedBy(android.net.NetworkSpecifier); - } - public final class WifiNetworkSuggestion implements android.os.Parcelable { method @NonNull public android.net.wifi.WifiConfiguration getWifiConfiguration(); } @@ -7619,10 +7610,6 @@ package android.net.wifi.aware { method @Deprecated public android.net.NetworkSpecifier createNetworkSpecifierPmk(@NonNull android.net.wifi.aware.PeerHandle, @NonNull byte[]); } - public final class WifiAwareNetworkSpecifier extends android.net.NetworkSpecifier implements android.os.Parcelable { - method public boolean satisfiedBy(android.net.NetworkSpecifier); - } - public class WifiAwareSession implements java.lang.AutoCloseable { method public android.net.NetworkSpecifier createNetworkSpecifierPmk(int, @NonNull byte[], @NonNull byte[]); } diff --git a/core/java/android/net/NetworkAgent.java b/core/java/android/net/NetworkAgent.java index 8119df921745..fe90a8457949 100644 --- a/core/java/android/net/NetworkAgent.java +++ b/core/java/android/net/NetworkAgent.java @@ -36,6 +36,7 @@ import com.android.internal.util.Protocol; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +import java.time.Duration; import java.util.ArrayList; import java.util.Objects; import java.util.concurrent.atomic.AtomicBoolean; @@ -47,7 +48,7 @@ import java.util.concurrent.atomic.AtomicBoolean; * An agent manages the life cycle of a network. A network starts its * life cycle when {@link register} is called on NetworkAgent. The network * is then connecting. When full L3 connectivity has been established, - * the agent shoud call {@link setConnected} to inform the system that + * the agent shoud call {@link markConnected} to inform the system that * this network is ready to use. When the network disconnects its life * ends and the agent should call {@link unregister}, at which point the * system will clean up and free resources. @@ -503,7 +504,8 @@ public abstract class NetworkAgent { break; } case CMD_START_SOCKET_KEEPALIVE: { - onStartSocketKeepalive(msg.arg1 /* slot */, msg.arg2 /* interval */, + onStartSocketKeepalive(msg.arg1 /* slot */, + Duration.ofSeconds(msg.arg2) /* interval */, (KeepalivePacketData) msg.obj /* packet */); break; } @@ -617,10 +619,10 @@ public abstract class NetworkAgent { * Inform ConnectivityService that this agent has now connected. * Call {@link #unregister} to disconnect. */ - public void setConnected() { + public void markConnected() { if (mIsLegacy) { throw new UnsupportedOperationException( - "Legacy agents can't call setConnected."); + "Legacy agents can't call markConnected."); } mNetworkInfo.setDetailedState(NetworkInfo.DetailedState.CONNECTED, null, null); queueOrSendMessage(EVENT_NETWORK_INFO_CHANGED, mNetworkInfo); @@ -798,8 +800,8 @@ public abstract class NetworkAgent { * {@code VALIDATION_STATUS_VALID} if Internet connectivity was validated, * {@code VALIDATION_STATUS_NOT_VALID} if Internet connectivity was not validated. * - * This may be called multiple times as network status changes, or if there are multiple - * subsequent attempts to validate connectivity that fail. + * This is guaranteed to be called again when the network status changes, but the system + * may also call this multiple times even if the status does not change. * * @param status one of {@code VALIDATION_STATUS_VALID} or {@code VALIDATION_STATUS_NOT_VALID}. * @param redirectUri If Internet connectivity is being redirected (e.g., on a captive portal), @@ -832,18 +834,25 @@ public abstract class NetworkAgent { * Requests that the network hardware send the specified packet at the specified interval. * * @param slot the hardware slot on which to start the keepalive. - * @param intervalSeconds the interval between packets + * @param interval the interval between packets, between 10 and 3600. Note that this API + * does not support sub-second precision and will round off the request. * @param packet the packet to send. */ // seconds is from SocketKeepalive.MIN_INTERVAL_SEC to MAX_INTERVAL_SEC, but these should // not be exposed as constants because they may change in the future (API guideline 4.8) // and should have getters if exposed at all. Getters can't be used in the annotation, // so the values unfortunately need to be copied. - public void onStartSocketKeepalive(int slot, - @IntRange(from = 10, to = 3600) int intervalSeconds, + public void onStartSocketKeepalive(int slot, @NonNull Duration interval, @NonNull KeepalivePacketData packet) { - Message msg = mHandler.obtainMessage(CMD_START_SOCKET_KEEPALIVE, slot, intervalSeconds, - packet); + final long intervalSeconds = interval.getSeconds(); + if (intervalSeconds < SocketKeepalive.MIN_INTERVAL_SEC + || intervalSeconds > SocketKeepalive.MAX_INTERVAL_SEC) { + throw new IllegalArgumentException("Interval needs to be comprised between " + + SocketKeepalive.MIN_INTERVAL_SEC + " and " + SocketKeepalive.MAX_INTERVAL_SEC + + " but was " + intervalSeconds); + } + final Message msg = mHandler.obtainMessage(CMD_START_SOCKET_KEEPALIVE, slot, + (int) intervalSeconds, packet); startSocketKeepalive(msg); msg.recycle(); } diff --git a/core/java/android/net/NetworkCapabilities.java b/core/java/android/net/NetworkCapabilities.java index af9414c56654..91ef911ef25c 100644 --- a/core/java/android/net/NetworkCapabilities.java +++ b/core/java/android/net/NetworkCapabilities.java @@ -1122,7 +1122,7 @@ public final class NetworkCapabilities implements Parcelable { } private boolean satisfiedBySpecifier(NetworkCapabilities nc) { - return mNetworkSpecifier == null || mNetworkSpecifier.satisfiedBy(nc.mNetworkSpecifier) + return mNetworkSpecifier == null || mNetworkSpecifier.canBeSatisfiedBy(nc.mNetworkSpecifier) || nc.mNetworkSpecifier instanceof MatchAllNetworkSpecifier; } diff --git a/core/java/android/net/NetworkProvider.java b/core/java/android/net/NetworkProvider.java index 418d6915d4b3..75086cf82b57 100644 --- a/core/java/android/net/NetworkProvider.java +++ b/core/java/android/net/NetworkProvider.java @@ -16,6 +16,7 @@ package android.net; +import android.annotation.IntRange; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.RequiresPermission; @@ -33,8 +34,8 @@ import android.util.Log; * {@link NetworkAgent}s. The networks can then provide connectivity to apps and can be interacted * with via networking APIs such as {@link ConnectivityManager}. * - * Subclasses should implement {@link #onNetworkRequested} and {@link #onRequestWithdrawn} to - * receive {@link NetworkRequest}s sent by the system and by apps. A network that is not the + * Subclasses should implement {@link #onNetworkRequested} and {@link #onNetworkRequestWithdrawn} + * to receive {@link NetworkRequest}s sent by the system and by apps. A network that is not the * best (highest-scoring) network for any request is generally not used by the system, and torn * down. * @@ -77,7 +78,7 @@ public class NetworkProvider { * Constructs a new NetworkProvider. * * @param looper the Looper on which to run {@link #onNetworkRequested} and - * {@link #onRequestWithdrawn}. + * {@link #onNetworkRequestWithdrawn}. * @param name the name of the listener, used only for debugging. * * @hide @@ -94,7 +95,7 @@ public class NetworkProvider { onNetworkRequested((NetworkRequest) m.obj, m.arg1, m.arg2); break; case CMD_CANCEL_REQUEST: - onRequestWithdrawn((NetworkRequest) m.obj); + onNetworkRequestWithdrawn((NetworkRequest) m.obj); break; default: Log.e(mName, "Unhandled message: " + m.what); @@ -142,14 +143,15 @@ public class NetworkProvider { * @hide */ @SystemApi - public void onNetworkRequested(@NonNull NetworkRequest request, int score, int providerId) {} + public void onNetworkRequested(@NonNull NetworkRequest request, + @IntRange(from = 0, to = 99) int score, int providerId) {} /** * Called when a NetworkRequest is withdrawn. * @hide */ @SystemApi - public void onRequestWithdrawn(@NonNull NetworkRequest request) {} + public void onNetworkRequestWithdrawn(@NonNull NetworkRequest request) {} /** * Asserts that no provider will ever be able to satisfy the specified request. The provider @@ -157,7 +159,7 @@ public class NetworkProvider { * satisfying this request, and that the request cannot be satisfied. The application filing the * request will receive an {@link NetworkCallback#onUnavailable()} callback. * - * @param request the request that cannot be fulfilled + * @param request the request that permanently cannot be fulfilled * @hide */ @SystemApi diff --git a/core/java/android/net/NetworkRequest.java b/core/java/android/net/NetworkRequest.java index 798856d13b1d..a6bd74a5870d 100644 --- a/core/java/android/net/NetworkRequest.java +++ b/core/java/android/net/NetworkRequest.java @@ -474,7 +474,7 @@ public class NetworkRequest implements Parcelable { * @param nc Capabilities that should satisfy this NetworkRequest. null capabilities do not * satisfy any request. */ - public boolean satisfiedBy(@Nullable NetworkCapabilities nc) { + public boolean canBeSatisfiedBy(@Nullable NetworkCapabilities nc) { return networkCapabilities.satisfiedByNetworkCapabilities(nc); } diff --git a/core/java/android/net/NetworkSpecifier.java b/core/java/android/net/NetworkSpecifier.java index 2dd0c4e207fe..160259e39813 100644 --- a/core/java/android/net/NetworkSpecifier.java +++ b/core/java/android/net/NetworkSpecifier.java @@ -35,7 +35,9 @@ public abstract class NetworkSpecifier { * @hide */ @SystemApi - public abstract boolean satisfiedBy(@Nullable NetworkSpecifier other); + public boolean canBeSatisfiedBy(@Nullable NetworkSpecifier other) { + return false; + } /** * Optional method which can be overridden by concrete implementations of NetworkSpecifier to diff --git a/core/java/android/net/SocketKeepalive.java b/core/java/android/net/SocketKeepalive.java index 8ff8f4c48c32..46aef10258d9 100644 --- a/core/java/android/net/SocketKeepalive.java +++ b/core/java/android/net/SocketKeepalive.java @@ -115,7 +115,8 @@ public abstract class SocketKeepalive implements AutoCloseable { SUCCESS, ERROR_INVALID_LENGTH, ERROR_UNSUPPORTED, - ERROR_INSUFFICIENT_RESOURCES + ERROR_INSUFFICIENT_RESOURCES, + ERROR_HARDWARE_UNSUPPORTED }) public @interface KeepaliveEvent {} diff --git a/core/java/android/net/StringNetworkSpecifier.java b/core/java/android/net/StringNetworkSpecifier.java index 6ae59716cfd8..3f2aa17f263e 100644 --- a/core/java/android/net/StringNetworkSpecifier.java +++ b/core/java/android/net/StringNetworkSpecifier.java @@ -40,7 +40,7 @@ public final class StringNetworkSpecifier extends NetworkSpecifier implements Pa /** @hide */ @Override - public boolean satisfiedBy(NetworkSpecifier other) { + public boolean canBeSatisfiedBy(NetworkSpecifier other) { return equals(other); } diff --git a/core/java/android/net/TelephonyNetworkSpecifier.java b/core/java/android/net/TelephonyNetworkSpecifier.java index 726f77059707..aafebd7ecfc8 100644 --- a/core/java/android/net/TelephonyNetworkSpecifier.java +++ b/core/java/android/net/TelephonyNetworkSpecifier.java @@ -97,7 +97,7 @@ public final class TelephonyNetworkSpecifier extends NetworkSpecifier implements /** @hide */ @Override - public boolean satisfiedBy(NetworkSpecifier other) { + public boolean canBeSatisfiedBy(NetworkSpecifier other) { // Any generic requests should be satisfied by a specific telephony network. // For simplicity, we treat null same as MatchAllNetworkSpecifier return equals(other) || other == null || other instanceof MatchAllNetworkSpecifier; diff --git a/tests/net/java/com/android/server/ConnectivityServiceTest.java b/tests/net/java/com/android/server/ConnectivityServiceTest.java index 83399b8076af..e093c573247b 100644 --- a/tests/net/java/com/android/server/ConnectivityServiceTest.java +++ b/tests/net/java/com/android/server/ConnectivityServiceTest.java @@ -2911,7 +2911,7 @@ public class ConnectivityServiceTest { class ConfidentialMatchAllNetworkSpecifier extends NetworkSpecifier implements Parcelable { @Override - public boolean satisfiedBy(NetworkSpecifier other) { + public boolean canBeSatisfiedBy(NetworkSpecifier other) { return true; } @@ -2939,7 +2939,7 @@ public class ConnectivityServiceTest { } @Override - public boolean satisfiedBy(NetworkSpecifier other) { + public boolean canBeSatisfiedBy(NetworkSpecifier other) { if (other instanceof LocalStringNetworkSpecifier) { return TextUtils.equals(mString, ((LocalStringNetworkSpecifier) other).mString); @@ -3060,7 +3060,10 @@ public class ConnectivityServiceTest { }); class NonParcelableSpecifier extends NetworkSpecifier { - public boolean satisfiedBy(NetworkSpecifier other) { return false; } + @Override + public boolean canBeSatisfiedBy(NetworkSpecifier other) { + return false; + } }; class ParcelableSpecifier extends NonParcelableSpecifier implements Parcelable { @Override public int describeContents() { return 0; } diff --git a/wifi/java/android/net/wifi/WifiNetworkAgentSpecifier.java b/wifi/java/android/net/wifi/WifiNetworkAgentSpecifier.java index 6632c162fcf9..0d13805a08d8 100644 --- a/wifi/java/android/net/wifi/WifiNetworkAgentSpecifier.java +++ b/wifi/java/android/net/wifi/WifiNetworkAgentSpecifier.java @@ -74,7 +74,7 @@ public final class WifiNetworkAgentSpecifier extends NetworkSpecifier implements } @Override - public boolean satisfiedBy(@Nullable NetworkSpecifier other) { + public boolean canBeSatisfiedBy(@Nullable NetworkSpecifier other) { if (this == other) { return true; } diff --git a/wifi/java/android/net/wifi/WifiNetworkSpecifier.java b/wifi/java/android/net/wifi/WifiNetworkSpecifier.java index 3d946c9f887d..ed54ad13e5e1 100644 --- a/wifi/java/android/net/wifi/WifiNetworkSpecifier.java +++ b/wifi/java/android/net/wifi/WifiNetworkSpecifier.java @@ -552,7 +552,7 @@ public final class WifiNetworkSpecifier extends NetworkSpecifier implements Parc /** @hide */ @Override - public boolean satisfiedBy(NetworkSpecifier other) { + public boolean canBeSatisfiedBy(NetworkSpecifier other) { if (this == other) { return true; } diff --git a/wifi/java/android/net/wifi/aware/WifiAwareAgentNetworkSpecifier.java b/wifi/java/android/net/wifi/aware/WifiAwareAgentNetworkSpecifier.java index a4b3e86398a8..9ae3bd0c93c0 100644 --- a/wifi/java/android/net/wifi/aware/WifiAwareAgentNetworkSpecifier.java +++ b/wifi/java/android/net/wifi/aware/WifiAwareAgentNetworkSpecifier.java @@ -120,7 +120,7 @@ public class WifiAwareAgentNetworkSpecifier extends NetworkSpecifier implements } @Override - public boolean satisfiedBy(NetworkSpecifier other) { + public boolean canBeSatisfiedBy(NetworkSpecifier other) { if (!(other instanceof WifiAwareAgentNetworkSpecifier)) { return false; } diff --git a/wifi/java/android/net/wifi/aware/WifiAwareNetworkSpecifier.java b/wifi/java/android/net/wifi/aware/WifiAwareNetworkSpecifier.java index 65ac1ab26064..3547750896b3 100644 --- a/wifi/java/android/net/wifi/aware/WifiAwareNetworkSpecifier.java +++ b/wifi/java/android/net/wifi/aware/WifiAwareNetworkSpecifier.java @@ -212,7 +212,7 @@ public final class WifiAwareNetworkSpecifier extends NetworkSpecifier implements /** @hide */ @Override - public boolean satisfiedBy(NetworkSpecifier other) { + public boolean canBeSatisfiedBy(NetworkSpecifier other) { // MatchAllNetworkSpecifier is taken care in NetworkCapabilities#satisfiedBySpecifier. if (other instanceof WifiAwareAgentNetworkSpecifier) { return ((WifiAwareAgentNetworkSpecifier) other).satisfiesAwareNetworkSpecifier(this); diff --git a/wifi/tests/src/android/net/wifi/WifiNetworkAgentSpecifierTest.java b/wifi/tests/src/android/net/wifi/WifiNetworkAgentSpecifierTest.java index 0233ee2e2785..d479aacdd296 100644 --- a/wifi/tests/src/android/net/wifi/WifiNetworkAgentSpecifierTest.java +++ b/wifi/tests/src/android/net/wifi/WifiNetworkAgentSpecifierTest.java @@ -155,8 +155,8 @@ public class WifiNetworkAgentSpecifierTest { public void testWifiNetworkAgentSpecifierSatisifiesNullAndAllMatch() { WifiNetworkAgentSpecifier specifier = createDefaultNetworkAgentSpecifier(); - assertTrue(specifier.satisfiedBy(null)); - assertTrue(specifier.satisfiedBy(new MatchAllNetworkSpecifier())); + assertTrue(specifier.canBeSatisfiedBy(null)); + assertTrue(specifier.canBeSatisfiedBy(new MatchAllNetworkSpecifier())); } /** @@ -170,7 +170,7 @@ public class WifiNetworkAgentSpecifierTest { WifiNetworkAgentSpecifier specifier1 = createDefaultNetworkAgentSpecifier(); WifiNetworkAgentSpecifier specifier2 = createDefaultNetworkAgentSpecifier(); - assertTrue(specifier2.satisfiedBy(specifier1)); + assertTrue(specifier2.canBeSatisfiedBy(specifier1)); } /** @@ -196,8 +196,8 @@ public class WifiNetworkAgentSpecifierTest { bssidPattern, wificonfigurationNetworkSpecifier); - assertTrue(wifiNetworkSpecifier.satisfiedBy(wifiNetworkAgentSpecifier)); - assertTrue(wifiNetworkAgentSpecifier.satisfiedBy(wifiNetworkSpecifier)); + assertTrue(wifiNetworkSpecifier.canBeSatisfiedBy(wifiNetworkAgentSpecifier)); + assertTrue(wifiNetworkAgentSpecifier.canBeSatisfiedBy(wifiNetworkSpecifier)); } /** @@ -224,8 +224,8 @@ public class WifiNetworkAgentSpecifierTest { bssidPattern, wificonfigurationNetworkSpecifier); - assertTrue(wifiNetworkSpecifier.satisfiedBy(wifiNetworkAgentSpecifier)); - assertTrue(wifiNetworkAgentSpecifier.satisfiedBy(wifiNetworkSpecifier)); + assertTrue(wifiNetworkSpecifier.canBeSatisfiedBy(wifiNetworkAgentSpecifier)); + assertTrue(wifiNetworkAgentSpecifier.canBeSatisfiedBy(wifiNetworkSpecifier)); } /** @@ -252,8 +252,8 @@ public class WifiNetworkAgentSpecifierTest { bssidPattern, wificonfigurationNetworkSpecifier); - assertTrue(wifiNetworkSpecifier.satisfiedBy(wifiNetworkAgentSpecifier)); - assertTrue(wifiNetworkAgentSpecifier.satisfiedBy(wifiNetworkSpecifier)); + assertTrue(wifiNetworkSpecifier.canBeSatisfiedBy(wifiNetworkAgentSpecifier)); + assertTrue(wifiNetworkAgentSpecifier.canBeSatisfiedBy(wifiNetworkSpecifier)); } /** @@ -283,8 +283,8 @@ public class WifiNetworkAgentSpecifierTest { bssidPattern, wificonfigurationNetworkSpecifier); - assertFalse(wifiNetworkSpecifier.satisfiedBy(wifiNetworkAgentSpecifier)); - assertFalse(wifiNetworkAgentSpecifier.satisfiedBy(wifiNetworkSpecifier)); + assertFalse(wifiNetworkSpecifier.canBeSatisfiedBy(wifiNetworkAgentSpecifier)); + assertFalse(wifiNetworkAgentSpecifier.canBeSatisfiedBy(wifiNetworkSpecifier)); } /** @@ -315,8 +315,8 @@ public class WifiNetworkAgentSpecifierTest { bssidPattern, wificonfigurationNetworkSpecifier); - assertFalse(wifiNetworkSpecifier.satisfiedBy(wifiNetworkAgentSpecifier)); - assertFalse(wifiNetworkAgentSpecifier.satisfiedBy(wifiNetworkSpecifier)); + assertFalse(wifiNetworkSpecifier.canBeSatisfiedBy(wifiNetworkAgentSpecifier)); + assertFalse(wifiNetworkAgentSpecifier.canBeSatisfiedBy(wifiNetworkSpecifier)); } /** @@ -347,8 +347,8 @@ public class WifiNetworkAgentSpecifierTest { bssidPattern, wificonfigurationNetworkSpecifier); - assertFalse(wifiNetworkSpecifier.satisfiedBy(wifiNetworkAgentSpecifier)); - assertFalse(wifiNetworkAgentSpecifier.satisfiedBy(wifiNetworkSpecifier)); + assertFalse(wifiNetworkSpecifier.canBeSatisfiedBy(wifiNetworkAgentSpecifier)); + assertFalse(wifiNetworkAgentSpecifier.canBeSatisfiedBy(wifiNetworkSpecifier)); } /** @@ -374,8 +374,8 @@ public class WifiNetworkAgentSpecifierTest { bssidPattern, wificonfigurationNetworkSpecifier); - assertFalse(wifiNetworkSpecifier.satisfiedBy(wifiNetworkAgentSpecifier)); - assertFalse(wifiNetworkAgentSpecifier.satisfiedBy(wifiNetworkSpecifier)); + assertFalse(wifiNetworkSpecifier.canBeSatisfiedBy(wifiNetworkAgentSpecifier)); + assertFalse(wifiNetworkAgentSpecifier.canBeSatisfiedBy(wifiNetworkSpecifier)); } diff --git a/wifi/tests/src/android/net/wifi/WifiNetworkSpecifierTest.java b/wifi/tests/src/android/net/wifi/WifiNetworkSpecifierTest.java index 3b6723613c50..53a7d032da42 100644 --- a/wifi/tests/src/android/net/wifi/WifiNetworkSpecifierTest.java +++ b/wifi/tests/src/android/net/wifi/WifiNetworkSpecifierTest.java @@ -396,8 +396,8 @@ public class WifiNetworkSpecifierTest { MacAddress.fromString(TEST_BSSID_OUI_MASK)), wifiConfiguration); - assertTrue(specifier.satisfiedBy(null)); - assertTrue(specifier.satisfiedBy(new MatchAllNetworkSpecifier())); + assertTrue(specifier.canBeSatisfiedBy(null)); + assertTrue(specifier.canBeSatisfiedBy(new MatchAllNetworkSpecifier())); } /** @@ -424,7 +424,7 @@ public class WifiNetworkSpecifierTest { MacAddress.fromString(TEST_BSSID_OUI_MASK)), wifiConfiguration); - assertTrue(specifier2.satisfiedBy(specifier1)); + assertTrue(specifier2.canBeSatisfiedBy(specifier1)); } /** @@ -453,7 +453,7 @@ public class WifiNetworkSpecifierTest { MacAddress.fromString(TEST_BSSID_OUI_MASK)), wifiConfiguration2); - assertFalse(specifier2.satisfiedBy(specifier1)); + assertFalse(specifier2.canBeSatisfiedBy(specifier1)); } /** @@ -480,7 +480,7 @@ public class WifiNetworkSpecifierTest { MacAddress.fromString(TEST_BSSID_OUI_MASK)), wifiConfiguration); - assertFalse(specifier2.satisfiedBy(specifier1)); + assertFalse(specifier2.canBeSatisfiedBy(specifier1)); } /** @@ -507,6 +507,6 @@ public class WifiNetworkSpecifierTest { WifiManager.ALL_ZEROS_MAC_ADDRESS), wifiConfiguration); - assertFalse(specifier2.satisfiedBy(specifier1)); + assertFalse(specifier2.canBeSatisfiedBy(specifier1)); } } diff --git a/wifi/tests/src/android/net/wifi/aware/WifiAwareAgentNetworkSpecifierTest.java b/wifi/tests/src/android/net/wifi/aware/WifiAwareAgentNetworkSpecifierTest.java index 81b02fa5f801..f2961db4eb14 100644 --- a/wifi/tests/src/android/net/wifi/aware/WifiAwareAgentNetworkSpecifierTest.java +++ b/wifi/tests/src/android/net/wifi/aware/WifiAwareAgentNetworkSpecifierTest.java @@ -79,7 +79,7 @@ public class WifiAwareAgentNetworkSpecifierTest { public void testEmptyDoesntMatchAnything() { WifiAwareAgentNetworkSpecifier dut = new WifiAwareAgentNetworkSpecifier(); WifiAwareNetworkSpecifier ns = getDummyNetworkSpecifier(6); - collector.checkThat("No match expected", ns.satisfiedBy(dut), equalTo(false)); + collector.checkThat("No match expected", ns.canBeSatisfiedBy(dut), equalTo(false)); } /** @@ -91,8 +91,8 @@ public class WifiAwareAgentNetworkSpecifierTest { WifiAwareNetworkSpecifier nsThis = getDummyNetworkSpecifier(6); WifiAwareAgentNetworkSpecifier dut = new WifiAwareAgentNetworkSpecifier(nsThis); WifiAwareNetworkSpecifier nsOther = getDummyNetworkSpecifier(8); - collector.checkThat("Match expected", nsThis.satisfiedBy(dut), equalTo(true)); - collector.checkThat("No match expected", nsOther.satisfiedBy(dut), equalTo(false)); + collector.checkThat("Match expected", nsThis.canBeSatisfiedBy(dut), equalTo(true)); + collector.checkThat("No match expected", nsOther.canBeSatisfiedBy(dut), equalTo(false)); } /** @@ -113,9 +113,9 @@ public class WifiAwareAgentNetworkSpecifierTest { WifiAwareNetworkSpecifier nsOther = getDummyNetworkSpecifier(10000); for (WifiAwareNetworkSpecifier nsThis: nsSet) { - collector.checkThat("Match expected", nsThis.satisfiedBy(dut), equalTo(true)); + collector.checkThat("Match expected", nsThis.canBeSatisfiedBy(dut), equalTo(true)); } - collector.checkThat("No match expected", nsOther.satisfiedBy(dut), equalTo(false)); + collector.checkThat("No match expected", nsOther.canBeSatisfiedBy(dut), equalTo(false)); } /** @@ -137,7 +137,7 @@ public class WifiAwareAgentNetworkSpecifierTest { WifiAwareAgentNetworkSpecifier newNs = new WifiAwareAgentNetworkSpecifier( nsSet.toArray(new WifiAwareNetworkSpecifier[nsSet.size()])); - collector.checkThat("Match expected", oldNs.satisfiedBy(newNs), equalTo(true)); + collector.checkThat("Match expected", oldNs.canBeSatisfiedBy(newNs), equalTo(true)); } /** @@ -159,7 +159,7 @@ public class WifiAwareAgentNetworkSpecifierTest { WifiAwareAgentNetworkSpecifier oldNs = new WifiAwareAgentNetworkSpecifier( nsSet.toArray(new WifiAwareNetworkSpecifier[nsSet.size()])); - collector.checkThat("Match unexpected", oldNs.satisfiedBy(newNs), equalTo(false)); + collector.checkThat("Match unexpected", oldNs.canBeSatisfiedBy(newNs), equalTo(false)); } // utilities |