summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Aaron Huang <huangaaron@google.com> 2021-09-10 03:20:50 +0800
committer Aaron Huang <huangaaron@google.com> 2021-10-05 21:06:46 +0800
commita273cfe217d2ef931a218898e65ba9f7f0f8b6f9 (patch)
tree186d77ab732d9b92732255534c7bbae75a89cb63
parent9b9cca942ee9a986040e487cc0098cc923ca6291 (diff)
Remove forceAllNetworkTypes from test
A test should test the actual behavior as much as possible. However, if the flag is true, matchesMobile/matchesMobileWildcard will always return true regardless of the network type and metered. Thus, remove this flag would be closer to the actual behavior. Bug: 183776809 Test: atest FrameworksNetTests Change-Id: I0907a08ca1dd8a14a738db4057ea5ff6a0cd925a Merged-In: I0907a08ca1dd8a14a738db4057ea5ff6a0cd925a
-rw-r--r--core/java/android/net/NetworkTemplate.java23
1 files changed, 2 insertions, 21 deletions
diff --git a/core/java/android/net/NetworkTemplate.java b/core/java/android/net/NetworkTemplate.java
index 249154aa9129..e6b5081e39a0 100644
--- a/core/java/android/net/NetworkTemplate.java
+++ b/core/java/android/net/NetworkTemplate.java
@@ -47,7 +47,6 @@ import android.text.TextUtils;
import android.util.BackupUtils;
import android.util.Log;
-import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.ArrayUtils;
import com.android.net.module.util.NetworkIdentityUtils;
@@ -151,24 +150,6 @@ public class NetworkTemplate implements Parcelable {
}
}
- private static boolean sForceAllNetworkTypes = false;
-
- /**
- * Results in matching against all mobile network types.
- *
- * <p>See {@link #matchesMobile} and {@link matchesMobileWildcard}.
- */
- @VisibleForTesting
- public static void forceAllNetworkTypes() {
- sForceAllNetworkTypes = true;
- }
-
- /** Resets the affect of {@link #forceAllNetworkTypes}. */
- @VisibleForTesting
- public static void resetForceAllNetworkTypes() {
- sForceAllNetworkTypes = false;
- }
-
/**
* Template to match {@link ConnectivityManager#TYPE_MOBILE} networks with
* the given IMSI.
@@ -611,7 +592,7 @@ public class NetworkTemplate implements Parcelable {
// Only metered mobile network would be matched regardless of metered filter.
// This is used to exclude non-metered APNs, e.g. IMS. See ag/908650.
// TODO: Respect metered filter and remove mMetered condition.
- return (sForceAllNetworkTypes || (ident.mType == TYPE_MOBILE && ident.mMetered))
+ return (ident.mType == TYPE_MOBILE && ident.mMetered)
&& !ArrayUtils.isEmpty(mMatchSubscriberIds)
&& ArrayUtils.contains(mMatchSubscriberIds, ident.mSubscriberId)
&& matchesCollapsedRatType(ident);
@@ -726,7 +707,7 @@ public class NetworkTemplate implements Parcelable {
if (ident.mType == TYPE_WIMAX) {
return true;
} else {
- return (sForceAllNetworkTypes || (ident.mType == TYPE_MOBILE && ident.mMetered))
+ return (ident.mType == TYPE_MOBILE && ident.mMetered)
&& matchesCollapsedRatType(ident);
}
}