Have buildTemplateMobileWithRatType take metered parameter
To support unmetered 5g, have buildTemplateMobileWithRatType take metered parameter to build a template which could be used to filter an unmetered network. Bug: 183776809 Test: atest FrameworksNetTests:NetworkStatsServiceTest Change-Id: Ia310d90eceeb572a35ce9518de02b198cae16705 Merged-In: Ia310d90eceeb572a35ce9518de02b198cae16705
This commit is contained in:
@@ -160,19 +160,19 @@ public class NetworkTemplate implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Template to match cellular networks with the given IMSI and {@code ratType}.
|
* Template to match cellular networks with the given IMSI, {@code ratType} and
|
||||||
* Use {@link #NETWORK_TYPE_ALL} to include all network types when filtering.
|
* {@code metered}. Use {@link #NETWORK_TYPE_ALL} to include all network types when
|
||||||
* See {@code TelephonyManager.NETWORK_TYPE_*}.
|
* filtering. See {@code TelephonyManager.NETWORK_TYPE_*}.
|
||||||
*/
|
*/
|
||||||
public static NetworkTemplate buildTemplateMobileWithRatType(@Nullable String subscriberId,
|
public static NetworkTemplate buildTemplateMobileWithRatType(@Nullable String subscriberId,
|
||||||
@NetworkType int ratType) {
|
@NetworkType int ratType, int metered) {
|
||||||
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_YES, ROAMING_ALL, DEFAULT_NETWORK_ALL, ratType, OEM_MANAGED_ALL,
|
metered, ROAMING_ALL, DEFAULT_NETWORK_ALL, ratType, OEM_MANAGED_ALL,
|
||||||
SUBSCRIBER_ID_MATCH_RULE_EXACT);
|
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_YES, ROAMING_ALL, DEFAULT_NETWORK_ALL, ratType, OEM_MANAGED_ALL,
|
metered, ROAMING_ALL, DEFAULT_NETWORK_ALL, ratType, OEM_MANAGED_ALL,
|
||||||
SUBSCRIBER_ID_MATCH_RULE_EXACT);
|
SUBSCRIBER_ID_MATCH_RULE_EXACT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user