Merge "wifi data usage: support to get carrier merged wifi network." am: bef2f5be94 am: debea981d9
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1538743 Change-Id: Ia115b6c8fe536d77071744374f5d42390cc50dbd
This commit is contained in:
@@ -82,6 +82,24 @@ public class NetworkTemplate implements Parcelable {
|
|||||||
public static final int MATCH_WIFI_WILDCARD = 7;
|
public static final int MATCH_WIFI_WILDCARD = 7;
|
||||||
public static final int MATCH_BLUETOOTH = 8;
|
public static final int MATCH_BLUETOOTH = 8;
|
||||||
public static final int MATCH_PROXY = 9;
|
public static final int MATCH_PROXY = 9;
|
||||||
|
public static final int MATCH_CARRIER = 10;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Value of the match rule of the subscriberId to match networks with specific subscriberId.
|
||||||
|
*/
|
||||||
|
public static final int SUBSCRIBER_ID_MATCH_RULE_EXACT = 0;
|
||||||
|
/**
|
||||||
|
* Value of the match rule of the subscriberId to match networks with any subscriberId which
|
||||||
|
* includes null and non-null.
|
||||||
|
*/
|
||||||
|
public static final int SUBSCRIBER_ID_MATCH_RULE_ALL = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wi-Fi Network ID is never supposed to be null (if it is, it is a bug that
|
||||||
|
* should be fixed), so it's not possible to want to match null vs
|
||||||
|
* non-null. Therefore it's fine to use null as a sentinel for Network ID.
|
||||||
|
*/
|
||||||
|
public static final String WIFI_NETWORKID_ALL = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Include all network types when filtering. This is meant to merge in with the
|
* Include all network types when filtering. This is meant to merge in with the
|
||||||
@@ -125,6 +143,7 @@ public class NetworkTemplate implements Parcelable {
|
|||||||
case MATCH_WIFI_WILDCARD:
|
case MATCH_WIFI_WILDCARD:
|
||||||
case MATCH_BLUETOOTH:
|
case MATCH_BLUETOOTH:
|
||||||
case MATCH_PROXY:
|
case MATCH_PROXY:
|
||||||
|
case MATCH_CARRIER:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -168,10 +187,12 @@ public class NetworkTemplate implements Parcelable {
|
|||||||
@NetworkType int ratType) {
|
@NetworkType int ratType) {
|
||||||
if (TextUtils.isEmpty(subscriberId)) {
|
if (TextUtils.isEmpty(subscriberId)) {
|
||||||
return new NetworkTemplate(MATCH_MOBILE_WILDCARD, null, null, null,
|
return new NetworkTemplate(MATCH_MOBILE_WILDCARD, null, null, null,
|
||||||
METERED_ALL, ROAMING_ALL, DEFAULT_NETWORK_ALL, ratType, OEM_MANAGED_ALL);
|
METERED_ALL, ROAMING_ALL, DEFAULT_NETWORK_ALL, ratType, OEM_MANAGED_ALL,
|
||||||
|
SUBSCRIBER_ID_MATCH_RULE_EXACT);
|
||||||
}
|
}
|
||||||
return new NetworkTemplate(MATCH_MOBILE, subscriberId, new String[]{subscriberId}, null,
|
return new NetworkTemplate(MATCH_MOBILE, subscriberId, new String[]{subscriberId}, null,
|
||||||
METERED_ALL, ROAMING_ALL, DEFAULT_NETWORK_ALL, ratType, OEM_MANAGED_ALL);
|
METERED_ALL, ROAMING_ALL, DEFAULT_NETWORK_ALL, ratType, OEM_MANAGED_ALL,
|
||||||
|
SUBSCRIBER_ID_MATCH_RULE_EXACT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -189,6 +210,8 @@ public class NetworkTemplate implements Parcelable {
|
|||||||
*/
|
*/
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
public static NetworkTemplate buildTemplateWifiWildcard() {
|
public static NetworkTemplate buildTemplateWifiWildcard() {
|
||||||
|
// TODO: Consider replace this with MATCH_WIFI with NETWORK_ID_ALL
|
||||||
|
// and SUBSCRIBER_ID_MATCH_RULE_ALL.
|
||||||
return new NetworkTemplate(MATCH_WIFI_WILDCARD, null, null);
|
return new NetworkTemplate(MATCH_WIFI_WILDCARD, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,8 +225,27 @@ public class NetworkTemplate implements Parcelable {
|
|||||||
* Template to match {@link ConnectivityManager#TYPE_WIFI} networks with the
|
* Template to match {@link ConnectivityManager#TYPE_WIFI} networks with the
|
||||||
* given SSID.
|
* given SSID.
|
||||||
*/
|
*/
|
||||||
public static NetworkTemplate buildTemplateWifi(String networkId) {
|
public static NetworkTemplate buildTemplateWifi(@NonNull String networkId) {
|
||||||
return new NetworkTemplate(MATCH_WIFI, null, networkId);
|
Objects.requireNonNull(networkId);
|
||||||
|
return new NetworkTemplate(MATCH_WIFI, null /* subscriberId */,
|
||||||
|
new String[] { null } /* matchSubscriberIds */,
|
||||||
|
networkId, METERED_ALL, ROAMING_ALL,
|
||||||
|
DEFAULT_NETWORK_ALL, NETWORK_TYPE_ALL, OEM_MANAGED_ALL,
|
||||||
|
SUBSCRIBER_ID_MATCH_RULE_ALL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Template to match all {@link ConnectivityManager#TYPE_WIFI} networks with the given SSID,
|
||||||
|
* and IMSI.
|
||||||
|
*
|
||||||
|
* Call with {@link #WIFI_NETWORKID_ALL} for {@code networkId} to get result regardless of SSID.
|
||||||
|
*/
|
||||||
|
public static NetworkTemplate buildTemplateWifi(@Nullable String networkId,
|
||||||
|
@Nullable String subscriberId) {
|
||||||
|
return new NetworkTemplate(MATCH_WIFI, subscriberId, new String[] { subscriberId },
|
||||||
|
networkId, METERED_ALL, ROAMING_ALL,
|
||||||
|
DEFAULT_NETWORK_ALL, NETWORK_TYPE_ALL, OEM_MANAGED_ALL,
|
||||||
|
SUBSCRIBER_ID_MATCH_RULE_EXACT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -231,6 +273,14 @@ public class NetworkTemplate implements Parcelable {
|
|||||||
return new NetworkTemplate(MATCH_PROXY, null, null);
|
return new NetworkTemplate(MATCH_PROXY, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Template to match all carrier networks with the given IMSI.
|
||||||
|
*/
|
||||||
|
public static NetworkTemplate buildTemplateCarrier(@NonNull String subscriberId) {
|
||||||
|
Objects.requireNonNull(subscriberId);
|
||||||
|
return new NetworkTemplate(MATCH_CARRIER, subscriberId, null);
|
||||||
|
}
|
||||||
|
|
||||||
private final int mMatchRule;
|
private final int mMatchRule;
|
||||||
private final String mSubscriberId;
|
private final String mSubscriberId;
|
||||||
|
|
||||||
@@ -251,10 +301,26 @@ public class NetworkTemplate implements Parcelable {
|
|||||||
private final int mRoaming;
|
private final int mRoaming;
|
||||||
private final int mDefaultNetwork;
|
private final int mDefaultNetwork;
|
||||||
private final int mSubType;
|
private final int mSubType;
|
||||||
|
private final int mSubscriberIdMatchRule;
|
||||||
|
|
||||||
// Bitfield containing OEM network properties{@code NetworkIdentity#OEM_*}.
|
// Bitfield containing OEM network properties{@code NetworkIdentity#OEM_*}.
|
||||||
private final int mOemManaged;
|
private final int mOemManaged;
|
||||||
|
|
||||||
|
private void checkValidSubscriberIdMatchRule() {
|
||||||
|
switch (mMatchRule) {
|
||||||
|
case MATCH_MOBILE:
|
||||||
|
case MATCH_CARRIER:
|
||||||
|
// MOBILE and CARRIER templates must always specify a subscriber ID.
|
||||||
|
if (mSubscriberIdMatchRule == SUBSCRIBER_ID_MATCH_RULE_ALL) {
|
||||||
|
throw new IllegalArgumentException("Invalid SubscriberIdMatchRule"
|
||||||
|
+ "on match rule: " + getMatchRuleName(mMatchRule));
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
public NetworkTemplate(int matchRule, String subscriberId, String networkId) {
|
public NetworkTemplate(int matchRule, String subscriberId, String networkId) {
|
||||||
this(matchRule, subscriberId, new String[] { subscriberId }, networkId);
|
this(matchRule, subscriberId, new String[] { subscriberId }, networkId);
|
||||||
@@ -263,14 +329,25 @@ public class NetworkTemplate implements Parcelable {
|
|||||||
public NetworkTemplate(int matchRule, String subscriberId, String[] matchSubscriberIds,
|
public NetworkTemplate(int matchRule, String subscriberId, String[] matchSubscriberIds,
|
||||||
String networkId) {
|
String networkId) {
|
||||||
this(matchRule, subscriberId, matchSubscriberIds, networkId, METERED_ALL, ROAMING_ALL,
|
this(matchRule, subscriberId, matchSubscriberIds, networkId, METERED_ALL, ROAMING_ALL,
|
||||||
DEFAULT_NETWORK_ALL, NETWORK_TYPE_ALL, OEM_MANAGED_ALL);
|
DEFAULT_NETWORK_ALL, NETWORK_TYPE_ALL, OEM_MANAGED_ALL,
|
||||||
|
SUBSCRIBER_ID_MATCH_RULE_EXACT);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Remove it after updating all of the caller.
|
||||||
|
public NetworkTemplate(int matchRule, String subscriberId, String[] matchSubscriberIds,
|
||||||
|
String networkId, int metered, int roaming, int defaultNetwork, int subType,
|
||||||
|
int oemManaged) {
|
||||||
|
this(matchRule, subscriberId, matchSubscriberIds, networkId, metered, roaming,
|
||||||
|
defaultNetwork, subType, oemManaged, SUBSCRIBER_ID_MATCH_RULE_EXACT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public NetworkTemplate(int matchRule, String subscriberId, String[] matchSubscriberIds,
|
public NetworkTemplate(int matchRule, String subscriberId, String[] matchSubscriberIds,
|
||||||
String networkId, int metered, int roaming, int defaultNetwork, int subType,
|
String networkId, int metered, int roaming, int defaultNetwork, int subType,
|
||||||
int oemManaged) {
|
int oemManaged, int subscriberIdMatchRule) {
|
||||||
mMatchRule = matchRule;
|
mMatchRule = matchRule;
|
||||||
mSubscriberId = subscriberId;
|
mSubscriberId = subscriberId;
|
||||||
|
// TODO: Check whether mMatchSubscriberIds = null or mMatchSubscriberIds = {null} when
|
||||||
|
// mSubscriberId is null
|
||||||
mMatchSubscriberIds = matchSubscriberIds;
|
mMatchSubscriberIds = matchSubscriberIds;
|
||||||
mNetworkId = networkId;
|
mNetworkId = networkId;
|
||||||
mMetered = metered;
|
mMetered = metered;
|
||||||
@@ -278,7 +355,8 @@ public class NetworkTemplate implements Parcelable {
|
|||||||
mDefaultNetwork = defaultNetwork;
|
mDefaultNetwork = defaultNetwork;
|
||||||
mSubType = subType;
|
mSubType = subType;
|
||||||
mOemManaged = oemManaged;
|
mOemManaged = oemManaged;
|
||||||
|
mSubscriberIdMatchRule = subscriberIdMatchRule;
|
||||||
|
checkValidSubscriberIdMatchRule();
|
||||||
if (!isKnownMatchRule(matchRule)) {
|
if (!isKnownMatchRule(matchRule)) {
|
||||||
Log.e(TAG, "Unknown network template rule " + matchRule
|
Log.e(TAG, "Unknown network template rule " + matchRule
|
||||||
+ " will not match any identity.");
|
+ " will not match any identity.");
|
||||||
@@ -295,6 +373,7 @@ public class NetworkTemplate implements Parcelable {
|
|||||||
mDefaultNetwork = in.readInt();
|
mDefaultNetwork = in.readInt();
|
||||||
mSubType = in.readInt();
|
mSubType = in.readInt();
|
||||||
mOemManaged = in.readInt();
|
mOemManaged = in.readInt();
|
||||||
|
mSubscriberIdMatchRule = in.readInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -308,6 +387,7 @@ public class NetworkTemplate implements Parcelable {
|
|||||||
dest.writeInt(mDefaultNetwork);
|
dest.writeInt(mDefaultNetwork);
|
||||||
dest.writeInt(mSubType);
|
dest.writeInt(mSubType);
|
||||||
dest.writeInt(mOemManaged);
|
dest.writeInt(mOemManaged);
|
||||||
|
dest.writeInt(mSubscriberIdMatchRule);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -346,13 +426,15 @@ public class NetworkTemplate implements Parcelable {
|
|||||||
if (mOemManaged != OEM_MANAGED_ALL) {
|
if (mOemManaged != OEM_MANAGED_ALL) {
|
||||||
builder.append(", oemManaged=").append(mOemManaged);
|
builder.append(", oemManaged=").append(mOemManaged);
|
||||||
}
|
}
|
||||||
|
builder.append(", subscriberIdMatchRule=")
|
||||||
|
.append(subscriberIdMatchRuleToString(mSubscriberIdMatchRule));
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(mMatchRule, mSubscriberId, mNetworkId, mMetered, mRoaming,
|
return Objects.hash(mMatchRule, mSubscriberId, mNetworkId, mMetered, mRoaming,
|
||||||
mDefaultNetwork, mSubType, mOemManaged);
|
mDefaultNetwork, mSubType, mOemManaged, mSubscriberIdMatchRule);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -366,11 +448,23 @@ public class NetworkTemplate implements Parcelable {
|
|||||||
&& mRoaming == other.mRoaming
|
&& mRoaming == other.mRoaming
|
||||||
&& mDefaultNetwork == other.mDefaultNetwork
|
&& mDefaultNetwork == other.mDefaultNetwork
|
||||||
&& mSubType == other.mSubType
|
&& mSubType == other.mSubType
|
||||||
&& mOemManaged == other.mOemManaged;
|
&& mOemManaged == other.mOemManaged
|
||||||
|
&& mSubscriberIdMatchRule == other.mSubscriberIdMatchRule;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String subscriberIdMatchRuleToString(int rule) {
|
||||||
|
switch (rule) {
|
||||||
|
case SUBSCRIBER_ID_MATCH_RULE_EXACT:
|
||||||
|
return "EXACT_MATCH";
|
||||||
|
case SUBSCRIBER_ID_MATCH_RULE_ALL:
|
||||||
|
return "ALL";
|
||||||
|
default:
|
||||||
|
return "Unknown rule " + rule;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isMatchRuleMobile() {
|
public boolean isMatchRuleMobile() {
|
||||||
switch (mMatchRule) {
|
switch (mMatchRule) {
|
||||||
case MATCH_MOBILE:
|
case MATCH_MOBILE:
|
||||||
@@ -386,6 +480,14 @@ public class NetworkTemplate implements Parcelable {
|
|||||||
case MATCH_MOBILE_WILDCARD:
|
case MATCH_MOBILE_WILDCARD:
|
||||||
case MATCH_WIFI_WILDCARD:
|
case MATCH_WIFI_WILDCARD:
|
||||||
return false;
|
return false;
|
||||||
|
case MATCH_CARRIER:
|
||||||
|
return mSubscriberId != null;
|
||||||
|
case MATCH_WIFI:
|
||||||
|
if (Objects.equals(mNetworkId, WIFI_NETWORKID_ALL)
|
||||||
|
&& mSubscriberIdMatchRule == SUBSCRIBER_ID_MATCH_RULE_ALL) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
default:
|
default:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -405,6 +507,10 @@ public class NetworkTemplate implements Parcelable {
|
|||||||
return mNetworkId;
|
return mNetworkId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getSubscriberIdMatchRule() {
|
||||||
|
return mSubscriberIdMatchRule;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test if given {@link NetworkIdentity} matches this template.
|
* Test if given {@link NetworkIdentity} matches this template.
|
||||||
*/
|
*/
|
||||||
@@ -429,6 +535,8 @@ public class NetworkTemplate implements Parcelable {
|
|||||||
return matchesBluetooth(ident);
|
return matchesBluetooth(ident);
|
||||||
case MATCH_PROXY:
|
case MATCH_PROXY:
|
||||||
return matchesProxy(ident);
|
return matchesProxy(ident);
|
||||||
|
case MATCH_CARRIER:
|
||||||
|
return matchesCarrier(ident);
|
||||||
default:
|
default:
|
||||||
// We have no idea what kind of network template we are, so we
|
// We have no idea what kind of network template we are, so we
|
||||||
// just claim not to match anything.
|
// just claim not to match anything.
|
||||||
@@ -466,8 +574,23 @@ public class NetworkTemplate implements Parcelable {
|
|||||||
|| getCollapsedRatType(mSubType) == getCollapsedRatType(ident.mSubType);
|
|| getCollapsedRatType(mSubType) == getCollapsedRatType(ident.mSubType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean matchesSubscriberId(String subscriberId) {
|
/**
|
||||||
return ArrayUtils.contains(mMatchSubscriberIds, subscriberId);
|
* Check if this template matches {@code subscriberId}. Returns true if this
|
||||||
|
* template was created with {@code SUBSCRIBER_ID_MATCH_RULE_ALL}, or with a
|
||||||
|
* {@code mMatchSubscriberIds} array that contains {@code subscriberId}.
|
||||||
|
*/
|
||||||
|
public boolean matchesSubscriberId(@Nullable String subscriberId) {
|
||||||
|
return mSubscriberIdMatchRule == SUBSCRIBER_ID_MATCH_RULE_ALL
|
||||||
|
|| ArrayUtils.contains(mMatchSubscriberIds, subscriberId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if network with matching SSID. Returns true when the SSID matches, or when
|
||||||
|
* {@code mNetworkId} is {@code WIFI_NETWORKID_ALL}.
|
||||||
|
*/
|
||||||
|
private boolean matchesWifiNetworkId(@Nullable String networkId) {
|
||||||
|
return Objects.equals(mNetworkId, WIFI_NETWORKID_ALL)
|
||||||
|
|| Objects.equals(sanitizeSsid(mNetworkId), sanitizeSsid(networkId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -566,8 +689,8 @@ public class NetworkTemplate implements Parcelable {
|
|||||||
private boolean matchesWifi(NetworkIdentity ident) {
|
private boolean matchesWifi(NetworkIdentity ident) {
|
||||||
switch (ident.mType) {
|
switch (ident.mType) {
|
||||||
case TYPE_WIFI:
|
case TYPE_WIFI:
|
||||||
return Objects.equals(
|
return matchesSubscriberId(ident.mSubscriberId)
|
||||||
sanitizeSsid(mNetworkId), sanitizeSsid(ident.mNetworkId));
|
&& matchesWifiNetworkId(ident.mNetworkId);
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -583,6 +706,15 @@ public class NetworkTemplate implements Parcelable {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if matches carrier network. The carrier networks means it includes the subscriberId.
|
||||||
|
*/
|
||||||
|
private boolean matchesCarrier(NetworkIdentity ident) {
|
||||||
|
return ident.mSubscriberId != null
|
||||||
|
&& !ArrayUtils.isEmpty(mMatchSubscriberIds)
|
||||||
|
&& ArrayUtils.contains(mMatchSubscriberIds, ident.mSubscriberId);
|
||||||
|
}
|
||||||
|
|
||||||
private boolean matchesMobileWildcard(NetworkIdentity ident) {
|
private boolean matchesMobileWildcard(NetworkIdentity ident) {
|
||||||
if (ident.mType == TYPE_WIMAX) {
|
if (ident.mType == TYPE_WIMAX) {
|
||||||
return true;
|
return true;
|
||||||
@@ -635,6 +767,8 @@ public class NetworkTemplate implements Parcelable {
|
|||||||
return "BLUETOOTH";
|
return "BLUETOOTH";
|
||||||
case MATCH_PROXY:
|
case MATCH_PROXY:
|
||||||
return "PROXY";
|
return "PROXY";
|
||||||
|
case MATCH_CARRIER:
|
||||||
|
return "CARRIER";
|
||||||
default:
|
default:
|
||||||
return "UNKNOWN(" + matchRule + ")";
|
return "UNKNOWN(" + matchRule + ")";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import static android.net.NetworkPolicy.LIMIT_DISABLED;
|
|||||||
import static android.net.NetworkPolicy.WARNING_DISABLED;
|
import static android.net.NetworkPolicy.WARNING_DISABLED;
|
||||||
import static android.net.NetworkTemplate.NETWORK_TYPE_ALL;
|
import static android.net.NetworkTemplate.NETWORK_TYPE_ALL;
|
||||||
import static android.net.NetworkTemplate.OEM_MANAGED_ALL;
|
import static android.net.NetworkTemplate.OEM_MANAGED_ALL;
|
||||||
|
import static android.net.NetworkTemplate.SUBSCRIBER_ID_MATCH_RULE_EXACT;
|
||||||
import static android.provider.Settings.Global.NETWORK_DEFAULT_DAILY_MULTIPATH_QUOTA_BYTES;
|
import static android.provider.Settings.Global.NETWORK_DEFAULT_DAILY_MULTIPATH_QUOTA_BYTES;
|
||||||
import static android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID;
|
import static android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID;
|
||||||
|
|
||||||
@@ -227,7 +228,8 @@ public class MultipathPolicyTracker {
|
|||||||
mNetworkTemplate = new NetworkTemplate(
|
mNetworkTemplate = new NetworkTemplate(
|
||||||
NetworkTemplate.MATCH_MOBILE, subscriberId, new String[] { subscriberId },
|
NetworkTemplate.MATCH_MOBILE, subscriberId, new String[] { subscriberId },
|
||||||
null, NetworkStats.METERED_ALL, NetworkStats.ROAMING_ALL,
|
null, NetworkStats.METERED_ALL, NetworkStats.ROAMING_ALL,
|
||||||
NetworkStats.DEFAULT_NETWORK_NO, NETWORK_TYPE_ALL, OEM_MANAGED_ALL);
|
NetworkStats.DEFAULT_NETWORK_NO, NETWORK_TYPE_ALL, OEM_MANAGED_ALL,
|
||||||
|
SUBSCRIBER_ID_MATCH_RULE_EXACT);
|
||||||
mUsageCallback = new UsageCallback() {
|
mUsageCallback = new UsageCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onThresholdReached(int networkType, String subscriberId) {
|
public void onThresholdReached(int networkType, String subscriberId) {
|
||||||
|
|||||||
@@ -31,11 +31,16 @@ import android.net.NetworkTemplate.MATCH_MOBILE
|
|||||||
import android.net.NetworkTemplate.MATCH_MOBILE_WILDCARD
|
import android.net.NetworkTemplate.MATCH_MOBILE_WILDCARD
|
||||||
import android.net.NetworkTemplate.MATCH_WIFI
|
import android.net.NetworkTemplate.MATCH_WIFI
|
||||||
import android.net.NetworkTemplate.MATCH_WIFI_WILDCARD
|
import android.net.NetworkTemplate.MATCH_WIFI_WILDCARD
|
||||||
|
import android.net.NetworkTemplate.WIFI_NETWORKID_ALL
|
||||||
import android.net.NetworkTemplate.NETWORK_TYPE_5G_NSA
|
import android.net.NetworkTemplate.NETWORK_TYPE_5G_NSA
|
||||||
import android.net.NetworkTemplate.NETWORK_TYPE_ALL
|
import android.net.NetworkTemplate.NETWORK_TYPE_ALL
|
||||||
import android.net.NetworkTemplate.OEM_MANAGED_ALL
|
import android.net.NetworkTemplate.OEM_MANAGED_ALL
|
||||||
import android.net.NetworkTemplate.OEM_MANAGED_NO
|
import android.net.NetworkTemplate.OEM_MANAGED_NO
|
||||||
import android.net.NetworkTemplate.OEM_MANAGED_YES
|
import android.net.NetworkTemplate.OEM_MANAGED_YES
|
||||||
|
import android.net.NetworkTemplate.SUBSCRIBER_ID_MATCH_RULE_EXACT
|
||||||
|
import android.net.NetworkTemplate.buildTemplateWifi
|
||||||
|
import android.net.NetworkTemplate.buildTemplateWifiWildcard
|
||||||
|
import android.net.NetworkTemplate.buildTemplateCarrier
|
||||||
import android.net.NetworkTemplate.buildTemplateMobileWithRatType
|
import android.net.NetworkTemplate.buildTemplateMobileWithRatType
|
||||||
import android.telephony.TelephonyManager
|
import android.telephony.TelephonyManager
|
||||||
import com.android.testutils.assertParcelSane
|
import com.android.testutils.assertParcelSane
|
||||||
@@ -53,6 +58,7 @@ import kotlin.test.assertTrue
|
|||||||
private const val TEST_IMSI1 = "imsi1"
|
private const val TEST_IMSI1 = "imsi1"
|
||||||
private const val TEST_IMSI2 = "imsi2"
|
private const val TEST_IMSI2 = "imsi2"
|
||||||
private const val TEST_SSID1 = "ssid1"
|
private const val TEST_SSID1 = "ssid1"
|
||||||
|
private const val TEST_SSID2 = "ssid2"
|
||||||
|
|
||||||
@RunWith(JUnit4::class)
|
@RunWith(JUnit4::class)
|
||||||
class NetworkTemplateTest {
|
class NetworkTemplateTest {
|
||||||
@@ -60,8 +66,8 @@ class NetworkTemplateTest {
|
|||||||
|
|
||||||
private fun buildMobileNetworkState(subscriberId: String): NetworkStateSnapshot =
|
private fun buildMobileNetworkState(subscriberId: String): NetworkStateSnapshot =
|
||||||
buildNetworkState(TYPE_MOBILE, subscriberId = subscriberId)
|
buildNetworkState(TYPE_MOBILE, subscriberId = subscriberId)
|
||||||
private fun buildWifiNetworkState(ssid: String): NetworkStateSnapshot =
|
private fun buildWifiNetworkState(subscriberId: String?, ssid: String?): NetworkStateSnapshot =
|
||||||
buildNetworkState(TYPE_WIFI, ssid = ssid)
|
buildNetworkState(TYPE_WIFI, subscriberId = subscriberId, ssid = ssid)
|
||||||
|
|
||||||
private fun buildNetworkState(
|
private fun buildNetworkState(
|
||||||
type: Int,
|
type: Int,
|
||||||
@@ -93,6 +99,95 @@ class NetworkTemplateTest {
|
|||||||
MockitoAnnotations.initMocks(this)
|
MockitoAnnotations.initMocks(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testWifiWildcardMatches() {
|
||||||
|
val templateWifiWildcard = buildTemplateWifiWildcard()
|
||||||
|
|
||||||
|
val identMobileImsi1 = buildNetworkIdentity(mockContext,
|
||||||
|
buildMobileNetworkState(TEST_IMSI1),
|
||||||
|
false, TelephonyManager.NETWORK_TYPE_UMTS)
|
||||||
|
val identWifiImsiNullSsid1 = buildNetworkIdentity(
|
||||||
|
mockContext, buildWifiNetworkState(null, TEST_SSID1), true, 0)
|
||||||
|
val identWifiImsi1Ssid1 = buildNetworkIdentity(
|
||||||
|
mockContext, buildWifiNetworkState(TEST_IMSI1, TEST_SSID1), true, 0)
|
||||||
|
|
||||||
|
templateWifiWildcard.assertDoesNotMatch(identMobileImsi1)
|
||||||
|
templateWifiWildcard.assertMatches(identWifiImsiNullSsid1)
|
||||||
|
templateWifiWildcard.assertMatches(identWifiImsi1Ssid1)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testWifiMatches() {
|
||||||
|
val templateWifiSsid1 = buildTemplateWifi(TEST_SSID1)
|
||||||
|
val templateWifiSsid1ImsiNull = buildTemplateWifi(TEST_SSID1, null)
|
||||||
|
val templateWifiSsid1Imsi1 = buildTemplateWifi(TEST_SSID1, TEST_IMSI1)
|
||||||
|
val templateWifiSsidAllImsi1 = buildTemplateWifi(WIFI_NETWORKID_ALL, TEST_IMSI1)
|
||||||
|
|
||||||
|
val identMobile1 = buildNetworkIdentity(mockContext, buildMobileNetworkState(TEST_IMSI1),
|
||||||
|
false, TelephonyManager.NETWORK_TYPE_UMTS)
|
||||||
|
val identWifiImsiNullSsid1 = buildNetworkIdentity(
|
||||||
|
mockContext, buildWifiNetworkState(null, TEST_SSID1), true, 0)
|
||||||
|
val identWifiImsi1Ssid1 = buildNetworkIdentity(
|
||||||
|
mockContext, buildWifiNetworkState(TEST_IMSI1, TEST_SSID1), true, 0)
|
||||||
|
val identWifiImsi2Ssid1 = buildNetworkIdentity(
|
||||||
|
mockContext, buildWifiNetworkState(TEST_IMSI2, TEST_SSID1), true, 0)
|
||||||
|
val identWifiImsi1Ssid2 = buildNetworkIdentity(
|
||||||
|
mockContext, buildWifiNetworkState(TEST_IMSI1, TEST_SSID2), true, 0)
|
||||||
|
|
||||||
|
// Verify that template with SSID only matches any subscriberId and specific SSID.
|
||||||
|
templateWifiSsid1.assertDoesNotMatch(identMobile1)
|
||||||
|
templateWifiSsid1.assertMatches(identWifiImsiNullSsid1)
|
||||||
|
templateWifiSsid1.assertMatches(identWifiImsi1Ssid1)
|
||||||
|
templateWifiSsid1.assertMatches(identWifiImsi2Ssid1)
|
||||||
|
templateWifiSsid1.assertDoesNotMatch(identWifiImsi1Ssid2)
|
||||||
|
|
||||||
|
// Verify that template with SSID1 and null imsi matches any network with
|
||||||
|
// SSID1 and null imsi.
|
||||||
|
templateWifiSsid1ImsiNull.assertDoesNotMatch(identMobile1)
|
||||||
|
templateWifiSsid1ImsiNull.assertMatches(identWifiImsiNullSsid1)
|
||||||
|
templateWifiSsid1ImsiNull.assertDoesNotMatch(identWifiImsi1Ssid1)
|
||||||
|
templateWifiSsid1ImsiNull.assertDoesNotMatch(identWifiImsi2Ssid1)
|
||||||
|
templateWifiSsid1ImsiNull.assertDoesNotMatch(identWifiImsi1Ssid2)
|
||||||
|
|
||||||
|
// Verify that template with SSID1 and imsi1 matches any network with
|
||||||
|
// SSID1 and imsi1.
|
||||||
|
templateWifiSsid1Imsi1.assertDoesNotMatch(identMobile1)
|
||||||
|
templateWifiSsid1Imsi1.assertDoesNotMatch(identWifiImsiNullSsid1)
|
||||||
|
templateWifiSsid1Imsi1.assertMatches(identWifiImsi1Ssid1)
|
||||||
|
templateWifiSsid1Imsi1.assertDoesNotMatch(identWifiImsi2Ssid1)
|
||||||
|
templateWifiSsid1Imsi1.assertDoesNotMatch(identWifiImsi1Ssid2)
|
||||||
|
|
||||||
|
// Verify that template with SSID all and imsi1 matches any network with
|
||||||
|
// any SSID and imsi1.
|
||||||
|
templateWifiSsidAllImsi1.assertDoesNotMatch(identMobile1)
|
||||||
|
templateWifiSsidAllImsi1.assertDoesNotMatch(identWifiImsiNullSsid1)
|
||||||
|
templateWifiSsidAllImsi1.assertMatches(identWifiImsi1Ssid1)
|
||||||
|
templateWifiSsidAllImsi1.assertDoesNotMatch(identWifiImsi2Ssid1)
|
||||||
|
templateWifiSsidAllImsi1.assertMatches(identWifiImsi1Ssid2)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testCarrierMatches() {
|
||||||
|
val templateCarrierImsi1 = buildTemplateCarrier(TEST_IMSI1)
|
||||||
|
|
||||||
|
val identMobile1 = buildNetworkIdentity(mockContext, buildMobileNetworkState(TEST_IMSI1),
|
||||||
|
false, TelephonyManager.NETWORK_TYPE_UMTS)
|
||||||
|
val identMobile2 = buildNetworkIdentity(mockContext, buildMobileNetworkState(TEST_IMSI2),
|
||||||
|
false, TelephonyManager.NETWORK_TYPE_UMTS)
|
||||||
|
val identWifiSsid1 = buildNetworkIdentity(
|
||||||
|
mockContext, buildWifiNetworkState(null, TEST_SSID1), true, 0)
|
||||||
|
val identCarrierWifiImsi1 = buildNetworkIdentity(
|
||||||
|
mockContext, buildWifiNetworkState(TEST_IMSI1, TEST_SSID1), true, 0)
|
||||||
|
val identCarrierWifiImsi2 = buildNetworkIdentity(
|
||||||
|
mockContext, buildWifiNetworkState(TEST_IMSI2, TEST_SSID1), true, 0)
|
||||||
|
|
||||||
|
templateCarrierImsi1.assertMatches(identCarrierWifiImsi1)
|
||||||
|
templateCarrierImsi1.assertDoesNotMatch(identCarrierWifiImsi2)
|
||||||
|
templateCarrierImsi1.assertDoesNotMatch(identWifiSsid1)
|
||||||
|
templateCarrierImsi1.assertMatches(identMobile1)
|
||||||
|
templateCarrierImsi1.assertDoesNotMatch(identMobile2)
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testRatTypeGroupMatches() {
|
fun testRatTypeGroupMatches() {
|
||||||
val stateMobile = buildMobileNetworkState(TEST_IMSI1)
|
val stateMobile = buildMobileNetworkState(TEST_IMSI1)
|
||||||
@@ -117,7 +212,7 @@ class NetworkTemplateTest {
|
|||||||
val identImsi2 = buildNetworkIdentity(mockContext, buildMobileNetworkState(TEST_IMSI2),
|
val identImsi2 = buildNetworkIdentity(mockContext, buildMobileNetworkState(TEST_IMSI2),
|
||||||
false, TelephonyManager.NETWORK_TYPE_UMTS)
|
false, TelephonyManager.NETWORK_TYPE_UMTS)
|
||||||
val identWifi = buildNetworkIdentity(
|
val identWifi = buildNetworkIdentity(
|
||||||
mockContext, buildWifiNetworkState(TEST_SSID1), true, 0)
|
mockContext, buildWifiNetworkState(null, TEST_SSID1), true, 0)
|
||||||
|
|
||||||
// Assert that identity with the same RAT matches.
|
// Assert that identity with the same RAT matches.
|
||||||
templateUmts.assertMatches(identUmts)
|
templateUmts.assertMatches(identUmts)
|
||||||
@@ -151,14 +246,16 @@ class NetworkTemplateTest {
|
|||||||
fun testParcelUnparcel() {
|
fun testParcelUnparcel() {
|
||||||
val templateMobile = NetworkTemplate(MATCH_MOBILE, TEST_IMSI1, null, null, METERED_ALL,
|
val templateMobile = NetworkTemplate(MATCH_MOBILE, TEST_IMSI1, null, null, METERED_ALL,
|
||||||
ROAMING_ALL, DEFAULT_NETWORK_ALL, TelephonyManager.NETWORK_TYPE_LTE,
|
ROAMING_ALL, DEFAULT_NETWORK_ALL, TelephonyManager.NETWORK_TYPE_LTE,
|
||||||
OEM_MANAGED_ALL)
|
OEM_MANAGED_ALL, SUBSCRIBER_ID_MATCH_RULE_EXACT)
|
||||||
val templateWifi = NetworkTemplate(MATCH_WIFI, null, null, TEST_SSID1, METERED_ALL,
|
val templateWifi = NetworkTemplate(MATCH_WIFI, null, null, TEST_SSID1, METERED_ALL,
|
||||||
ROAMING_ALL, DEFAULT_NETWORK_ALL, 0, OEM_MANAGED_ALL)
|
ROAMING_ALL, DEFAULT_NETWORK_ALL, 0, OEM_MANAGED_ALL,
|
||||||
|
SUBSCRIBER_ID_MATCH_RULE_EXACT)
|
||||||
val templateOem = NetworkTemplate(MATCH_MOBILE, null, null, null, METERED_ALL,
|
val templateOem = NetworkTemplate(MATCH_MOBILE, null, null, null, METERED_ALL,
|
||||||
ROAMING_ALL, DEFAULT_NETWORK_ALL, 0, OEM_MANAGED_YES)
|
ROAMING_ALL, DEFAULT_NETWORK_ALL, 0, OEM_MANAGED_YES,
|
||||||
assertParcelSane(templateMobile, 9)
|
SUBSCRIBER_ID_MATCH_RULE_EXACT)
|
||||||
assertParcelSane(templateWifi, 9)
|
assertParcelSane(templateMobile, 10)
|
||||||
assertParcelSane(templateOem, 9)
|
assertParcelSane(templateWifi, 10)
|
||||||
|
assertParcelSane(templateOem, 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify NETWORK_TYPE_* constants in NetworkTemplate do not conflict with
|
// Verify NETWORK_TYPE_* constants in NetworkTemplate do not conflict with
|
||||||
@@ -207,15 +304,14 @@ class NetworkTemplateTest {
|
|||||||
identSsid: String? = null
|
identSsid: String? = null
|
||||||
) {
|
) {
|
||||||
val oemManagedStates = arrayOf(OEM_NONE, OEM_PAID, OEM_PRIVATE, OEM_PAID or OEM_PRIVATE)
|
val oemManagedStates = arrayOf(OEM_NONE, OEM_PAID, OEM_PRIVATE, OEM_PAID or OEM_PRIVATE)
|
||||||
// A null subscriberId needs a null matchSubscriberIds argument as well.
|
val matchSubscriberIds = arrayOf(subscriberId)
|
||||||
val matchSubscriberIds = if (subscriberId == null) null else arrayOf(subscriberId)
|
|
||||||
|
|
||||||
val templateOemYes = NetworkTemplate(matchType, subscriberId, matchSubscriberIds,
|
val templateOemYes = NetworkTemplate(matchType, subscriberId, matchSubscriberIds,
|
||||||
templateSsid, METERED_ALL, ROAMING_ALL, DEFAULT_NETWORK_ALL, NETWORK_TYPE_ALL,
|
templateSsid, METERED_ALL, ROAMING_ALL, DEFAULT_NETWORK_ALL, NETWORK_TYPE_ALL,
|
||||||
OEM_MANAGED_YES)
|
OEM_MANAGED_YES, SUBSCRIBER_ID_MATCH_RULE_EXACT)
|
||||||
val templateOemAll = NetworkTemplate(matchType, subscriberId, matchSubscriberIds,
|
val templateOemAll = NetworkTemplate(matchType, subscriberId, matchSubscriberIds,
|
||||||
templateSsid, METERED_ALL, ROAMING_ALL, DEFAULT_NETWORK_ALL, NETWORK_TYPE_ALL,
|
templateSsid, METERED_ALL, ROAMING_ALL, DEFAULT_NETWORK_ALL, NETWORK_TYPE_ALL,
|
||||||
OEM_MANAGED_ALL)
|
OEM_MANAGED_ALL, SUBSCRIBER_ID_MATCH_RULE_EXACT)
|
||||||
|
|
||||||
for (identityOemManagedState in oemManagedStates) {
|
for (identityOemManagedState in oemManagedStates) {
|
||||||
val ident = buildNetworkIdentity(mockContext, buildNetworkState(networkType,
|
val ident = buildNetworkIdentity(mockContext, buildNetworkState(networkType,
|
||||||
@@ -226,7 +322,7 @@ class NetworkTemplateTest {
|
|||||||
for (templateOemManagedState in oemManagedStates) {
|
for (templateOemManagedState in oemManagedStates) {
|
||||||
val template = NetworkTemplate(matchType, subscriberId, matchSubscriberIds,
|
val template = NetworkTemplate(matchType, subscriberId, matchSubscriberIds,
|
||||||
templateSsid, METERED_ALL, ROAMING_ALL, DEFAULT_NETWORK_ALL,
|
templateSsid, METERED_ALL, ROAMING_ALL, DEFAULT_NETWORK_ALL,
|
||||||
NETWORK_TYPE_ALL, templateOemManagedState)
|
NETWORK_TYPE_ALL, templateOemManagedState, SUBSCRIBER_ID_MATCH_RULE_EXACT)
|
||||||
if (identityOemManagedState == templateOemManagedState) {
|
if (identityOemManagedState == templateOemManagedState) {
|
||||||
template.assertMatches(ident)
|
template.assertMatches(ident)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ import static android.net.NetworkTemplate.MATCH_MOBILE_WILDCARD;
|
|||||||
import static android.net.NetworkTemplate.NETWORK_TYPE_ALL;
|
import static android.net.NetworkTemplate.NETWORK_TYPE_ALL;
|
||||||
import static android.net.NetworkTemplate.OEM_MANAGED_NO;
|
import static android.net.NetworkTemplate.OEM_MANAGED_NO;
|
||||||
import static android.net.NetworkTemplate.OEM_MANAGED_YES;
|
import static android.net.NetworkTemplate.OEM_MANAGED_YES;
|
||||||
|
import static android.net.NetworkTemplate.SUBSCRIBER_ID_MATCH_RULE_EXACT;
|
||||||
import static android.net.NetworkTemplate.buildTemplateMobileAll;
|
import static android.net.NetworkTemplate.buildTemplateMobileAll;
|
||||||
import static android.net.NetworkTemplate.buildTemplateMobileWithRatType;
|
import static android.net.NetworkTemplate.buildTemplateMobileWithRatType;
|
||||||
import static android.net.NetworkTemplate.buildTemplateWifi;
|
import static android.net.NetworkTemplate.buildTemplateWifi;
|
||||||
@@ -669,24 +670,28 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {
|
|||||||
public void testMobileStatsOemManaged() throws Exception {
|
public void testMobileStatsOemManaged() throws Exception {
|
||||||
final NetworkTemplate templateOemPaid = new NetworkTemplate(MATCH_MOBILE_WILDCARD,
|
final NetworkTemplate templateOemPaid = new NetworkTemplate(MATCH_MOBILE_WILDCARD,
|
||||||
/*subscriberId=*/null, /*matchSubscriberIds=*/null, /*networkId=*/null,
|
/*subscriberId=*/null, /*matchSubscriberIds=*/null, /*networkId=*/null,
|
||||||
METERED_ALL, ROAMING_ALL, DEFAULT_NETWORK_ALL, NETWORK_TYPE_ALL, OEM_PAID);
|
METERED_ALL, ROAMING_ALL, DEFAULT_NETWORK_ALL, NETWORK_TYPE_ALL, OEM_PAID,
|
||||||
|
SUBSCRIBER_ID_MATCH_RULE_EXACT);
|
||||||
|
|
||||||
final NetworkTemplate templateOemPrivate = new NetworkTemplate(MATCH_MOBILE_WILDCARD,
|
final NetworkTemplate templateOemPrivate = new NetworkTemplate(MATCH_MOBILE_WILDCARD,
|
||||||
/*subscriberId=*/null, /*matchSubscriberIds=*/null, /*networkId=*/null,
|
/*subscriberId=*/null, /*matchSubscriberIds=*/null, /*networkId=*/null,
|
||||||
METERED_ALL, ROAMING_ALL, DEFAULT_NETWORK_ALL, NETWORK_TYPE_ALL, OEM_PRIVATE);
|
METERED_ALL, ROAMING_ALL, DEFAULT_NETWORK_ALL, NETWORK_TYPE_ALL, OEM_PRIVATE,
|
||||||
|
SUBSCRIBER_ID_MATCH_RULE_EXACT);
|
||||||
|
|
||||||
final NetworkTemplate templateOemAll = new NetworkTemplate(MATCH_MOBILE_WILDCARD,
|
final NetworkTemplate templateOemAll = new NetworkTemplate(MATCH_MOBILE_WILDCARD,
|
||||||
/*subscriberId=*/null, /*matchSubscriberIds=*/null, /*networkId=*/null,
|
/*subscriberId=*/null, /*matchSubscriberIds=*/null, /*networkId=*/null,
|
||||||
METERED_ALL, ROAMING_ALL, DEFAULT_NETWORK_ALL, NETWORK_TYPE_ALL,
|
METERED_ALL, ROAMING_ALL, DEFAULT_NETWORK_ALL, NETWORK_TYPE_ALL,
|
||||||
OEM_PAID | OEM_PRIVATE);
|
OEM_PAID | OEM_PRIVATE, SUBSCRIBER_ID_MATCH_RULE_EXACT);
|
||||||
|
|
||||||
final NetworkTemplate templateOemYes = new NetworkTemplate(MATCH_MOBILE_WILDCARD,
|
final NetworkTemplate templateOemYes = new NetworkTemplate(MATCH_MOBILE_WILDCARD,
|
||||||
/*subscriberId=*/null, /*matchSubscriberIds=*/null, /*networkId=*/null,
|
/*subscriberId=*/null, /*matchSubscriberIds=*/null, /*networkId=*/null,
|
||||||
METERED_ALL, ROAMING_ALL, DEFAULT_NETWORK_ALL, NETWORK_TYPE_ALL, OEM_MANAGED_YES);
|
METERED_ALL, ROAMING_ALL, DEFAULT_NETWORK_ALL, NETWORK_TYPE_ALL, OEM_MANAGED_YES,
|
||||||
|
SUBSCRIBER_ID_MATCH_RULE_EXACT);
|
||||||
|
|
||||||
final NetworkTemplate templateOemNone = new NetworkTemplate(MATCH_MOBILE_WILDCARD,
|
final NetworkTemplate templateOemNone = new NetworkTemplate(MATCH_MOBILE_WILDCARD,
|
||||||
/*subscriberId=*/null, /*matchSubscriberIds=*/null, /*networkId=*/null,
|
/*subscriberId=*/null, /*matchSubscriberIds=*/null, /*networkId=*/null,
|
||||||
METERED_ALL, ROAMING_ALL, DEFAULT_NETWORK_ALL, NETWORK_TYPE_ALL, OEM_MANAGED_NO);
|
METERED_ALL, ROAMING_ALL, DEFAULT_NETWORK_ALL, NETWORK_TYPE_ALL, OEM_MANAGED_NO,
|
||||||
|
SUBSCRIBER_ID_MATCH_RULE_EXACT);
|
||||||
|
|
||||||
// OEM_PAID network comes online.
|
// OEM_PAID network comes online.
|
||||||
NetworkStateSnapshot[] states = new NetworkStateSnapshot[]{
|
NetworkStateSnapshot[] states = new NetworkStateSnapshot[]{
|
||||||
|
|||||||
Reference in New Issue
Block a user