Merge "Respect metered filter in matchesMobile*"
This commit is contained in:
@@ -168,11 +168,11 @@ public class NetworkTemplate implements Parcelable {
|
||||
@NetworkType int ratType) {
|
||||
if (TextUtils.isEmpty(subscriberId)) {
|
||||
return new NetworkTemplate(MATCH_MOBILE_WILDCARD, null, null, null,
|
||||
METERED_ALL, ROAMING_ALL, DEFAULT_NETWORK_ALL, ratType, OEM_MANAGED_ALL,
|
||||
METERED_YES, ROAMING_ALL, DEFAULT_NETWORK_ALL, ratType, OEM_MANAGED_ALL,
|
||||
SUBSCRIBER_ID_MATCH_RULE_EXACT);
|
||||
}
|
||||
return new NetworkTemplate(MATCH_MOBILE, subscriberId, new String[]{subscriberId}, null,
|
||||
METERED_ALL, ROAMING_ALL, DEFAULT_NETWORK_ALL, ratType, OEM_MANAGED_ALL,
|
||||
METERED_YES, ROAMING_ALL, DEFAULT_NETWORK_ALL, ratType, OEM_MANAGED_ALL,
|
||||
SUBSCRIBER_ID_MATCH_RULE_EXACT);
|
||||
}
|
||||
|
||||
@@ -305,6 +305,7 @@ public class NetworkTemplate implements Parcelable {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Deprecate this constructor, mark it @UnsupportedAppUsage(maxTargetSdk = S)
|
||||
@UnsupportedAppUsage
|
||||
public NetworkTemplate(int matchRule, String subscriberId, String networkId) {
|
||||
this(matchRule, subscriberId, new String[] { subscriberId }, networkId);
|
||||
@@ -312,9 +313,14 @@ public class NetworkTemplate implements Parcelable {
|
||||
|
||||
public NetworkTemplate(int matchRule, String subscriberId, String[] matchSubscriberIds,
|
||||
String networkId) {
|
||||
this(matchRule, subscriberId, matchSubscriberIds, networkId, METERED_ALL, ROAMING_ALL,
|
||||
DEFAULT_NETWORK_ALL, NETWORK_TYPE_ALL, OEM_MANAGED_ALL,
|
||||
SUBSCRIBER_ID_MATCH_RULE_EXACT);
|
||||
// Older versions used to only match MATCH_MOBILE and MATCH_MOBILE_WILDCARD templates
|
||||
// to metered networks. It is now possible to match mobile with any meteredness, but
|
||||
// in order to preserve backward compatibility of @UnsupportedAppUsage methods, this
|
||||
//constructor passes METERED_YES for these types.
|
||||
this(matchRule, subscriberId, matchSubscriberIds, networkId,
|
||||
(matchRule == MATCH_MOBILE || matchRule == MATCH_MOBILE_WILDCARD) ? METERED_YES
|
||||
: METERED_ALL , ROAMING_ALL, DEFAULT_NETWORK_ALL, NETWORK_TYPE_ALL,
|
||||
OEM_MANAGED_ALL, SUBSCRIBER_ID_MATCH_RULE_EXACT);
|
||||
}
|
||||
|
||||
// TODO: Remove it after updating all of the caller.
|
||||
@@ -589,11 +595,7 @@ public class NetworkTemplate implements Parcelable {
|
||||
// TODO: consider matching against WiMAX subscriber identity
|
||||
return true;
|
||||
} else {
|
||||
// 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 (ident.mType == TYPE_MOBILE && ident.mMetered)
|
||||
&& !ArrayUtils.isEmpty(mMatchSubscriberIds)
|
||||
return ident.mType == TYPE_MOBILE && !ArrayUtils.isEmpty(mMatchSubscriberIds)
|
||||
&& ArrayUtils.contains(mMatchSubscriberIds, ident.mSubscriberId)
|
||||
&& matchesCollapsedRatType(ident);
|
||||
}
|
||||
@@ -707,8 +709,7 @@ public class NetworkTemplate implements Parcelable {
|
||||
if (ident.mType == TYPE_WIMAX) {
|
||||
return true;
|
||||
} else {
|
||||
return (ident.mType == TYPE_MOBILE && ident.mMetered)
|
||||
&& matchesCollapsedRatType(ident);
|
||||
return ident.mType == TYPE_MOBILE && matchesCollapsedRatType(ident);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -227,7 +227,7 @@ public class MultipathPolicyTracker {
|
||||
subscriberId = tele.getSubscriberId();
|
||||
mNetworkTemplate = new NetworkTemplate(
|
||||
NetworkTemplate.MATCH_MOBILE, subscriberId, new String[] { subscriberId },
|
||||
null, NetworkStats.METERED_ALL, NetworkStats.ROAMING_ALL,
|
||||
null, NetworkStats.METERED_YES, NetworkStats.ROAMING_ALL,
|
||||
NetworkStats.DEFAULT_NETWORK_NO, NETWORK_TYPE_ALL, OEM_MANAGED_ALL,
|
||||
SUBSCRIBER_ID_MATCH_RULE_EXACT);
|
||||
mUsageCallback = new UsageCallback() {
|
||||
|
||||
Reference in New Issue
Block a user