From 5c437e94ec6ea8dc80debda84b27d216cd8e0c1b Mon Sep 17 00:00:00 2001 From: lesl Date: Thu, 28 Jan 2021 15:58:23 +0800 Subject: [PATCH] carrier data usage: Use carrier template as default policy The carrier network means any network which linked with sepcific subscriberId (for instances: merged Wifi or mobile). Update default policy to use carrier network template to replace mobile template. No impact for current AOSP user because no any wifi network is merged wifi. (Because the merged wifi network requires to support from the wifi module). Also this change convert all of the old policies which template is TYEP_MOBILE to TYPE_CARRIER to match the default policy. Bug: 176396812 Test: atest -c NetworkPolicyManagerServiceTest Test: atest -c CtsHostsideNetworkTests Test: Manual Test with test code (Force wifi to merged wifi). The data will limit when using merged wifi. And mobile policy also work normally. Change-Id: I33c10f7549e713c52ce9afd5b8c4cce2abbda616 --- core/java/android/net/NetworkTemplate.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/java/android/net/NetworkTemplate.java b/core/java/android/net/NetworkTemplate.java index 352f2e99aa..68917a8288 100644 --- a/core/java/android/net/NetworkTemplate.java +++ b/core/java/android/net/NetworkTemplate.java @@ -514,6 +514,10 @@ public class NetworkTemplate implements Parcelable { return mSubscriberIdMatchRule; } + public int getMeteredness() { + return mMetered; + } + /** * Test if given {@link NetworkIdentity} matches this template. */