Merge "Remove forceAllNetworkTypes from test" am: bc48cdaf46 am: 15503f12d6
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1824613 Change-Id: I3271a1dacea9e99c70b4d23d0cb2aea9a82a4678
This commit is contained in:
@@ -47,7 +47,6 @@ import android.text.TextUtils;
|
|||||||
import android.util.BackupUtils;
|
import android.util.BackupUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
|
||||||
import com.android.internal.util.ArrayUtils;
|
import com.android.internal.util.ArrayUtils;
|
||||||
import com.android.net.module.util.NetworkIdentityUtils;
|
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
|
* Template to match {@link ConnectivityManager#TYPE_MOBILE} networks with
|
||||||
* the given IMSI.
|
* the given IMSI.
|
||||||
@@ -611,7 +592,7 @@ public class NetworkTemplate implements Parcelable {
|
|||||||
// Only metered mobile network would be matched regardless of metered filter.
|
// 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.
|
// This is used to exclude non-metered APNs, e.g. IMS. See ag/908650.
|
||||||
// TODO: Respect metered filter and remove mMetered condition.
|
// 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.isEmpty(mMatchSubscriberIds)
|
||||||
&& ArrayUtils.contains(mMatchSubscriberIds, ident.mSubscriberId)
|
&& ArrayUtils.contains(mMatchSubscriberIds, ident.mSubscriberId)
|
||||||
&& matchesCollapsedRatType(ident);
|
&& matchesCollapsedRatType(ident);
|
||||||
@@ -726,7 +707,7 @@ public class NetworkTemplate implements Parcelable {
|
|||||||
if (ident.mType == TYPE_WIMAX) {
|
if (ident.mType == TYPE_WIMAX) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return (sForceAllNetworkTypes || (ident.mType == TYPE_MOBILE && ident.mMetered))
|
return (ident.mType == TYPE_MOBILE && ident.mMetered)
|
||||||
&& matchesCollapsedRatType(ident);
|
&& matchesCollapsedRatType(ident);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user