Merge "[MS74] Expose NetworkTemplate#matches" am: 05e7864df4

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1960186

Change-Id: Icd61dbba3f56d223602ea0277fb6c5a78b3c1ae5
This commit is contained in:
Treehugger Robot
2022-01-26 11:47:19 +00:00
committed by Automerger Merge Worker
2 changed files with 4 additions and 1 deletions

View File

@@ -345,6 +345,7 @@ package android.net {
method public int getRoaming(); method public int getRoaming();
method @NonNull public java.util.Set<java.lang.String> getSubscriberIds(); method @NonNull public java.util.Set<java.lang.String> getSubscriberIds();
method @NonNull public java.util.Set<java.lang.String> getWifiNetworkKeys(); method @NonNull public java.util.Set<java.lang.String> getWifiNetworkKeys();
method public boolean matches(@NonNull android.net.NetworkIdentity);
method public void writeToParcel(@NonNull android.os.Parcel, int); method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.net.NetworkTemplate> CREATOR; field @NonNull public static final android.os.Parcelable.Creator<android.net.NetworkTemplate> CREATOR;
field public static final int MATCH_BLUETOOTH = 8; // 0x8 field public static final int MATCH_BLUETOOTH = 8; // 0x8

View File

@@ -652,7 +652,9 @@ public final class NetworkTemplate implements Parcelable {
* *
* @hide * @hide
*/ */
public boolean matches(NetworkIdentity ident) { @SystemApi(client = MODULE_LIBRARIES)
public boolean matches(@NonNull NetworkIdentity ident) {
Objects.requireNonNull(ident);
if (!matchesMetered(ident)) return false; if (!matchesMetered(ident)) return false;
if (!matchesRoaming(ident)) return false; if (!matchesRoaming(ident)) return false;
if (!matchesDefaultNetwork(ident)) return false; if (!matchesDefaultNetwork(ident)) return false;