From 366c1d7c4bd7c2298a181203f4f5a24ee77d39bb Mon Sep 17 00:00:00 2001 From: Junyu Lai Date: Fri, 24 Dec 2021 08:31:26 +0000 Subject: [PATCH] [MS18] Augment data usage by default Follow-up from ag/2815797, callers who uses the hidden API will have their data augmented by default, and the public API offers a way to opt-into augmentation. However, since the data usage is going to the module. All the hidden API usage must be eliminated. Also, from user perspective, it is better for UI and API to have aligned behavior. Thus, enable augment data usage for public API callers. Test: atest FrameworksNetTests \ android.app.usage.cts.NetworkUsageStatsTest Bug: 204830222 Change-Id: Ida254fac8d44c32d388f1886a866f7324a41ce75 --- framework-t/src/android/app/usage/NetworkStatsManager.java | 1 + service-t/src/com/android/server/net/NetworkStatsService.java | 4 ---- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/framework-t/src/android/app/usage/NetworkStatsManager.java b/framework-t/src/android/app/usage/NetworkStatsManager.java index 40b6371da7..2b9560e7ec 100644 --- a/framework-t/src/android/app/usage/NetworkStatsManager.java +++ b/framework-t/src/android/app/usage/NetworkStatsManager.java @@ -139,6 +139,7 @@ public class NetworkStatsManager { mContext = context; mService = service; setPollOnOpen(true); + setAugmentWithSubscriptionPlan(true); } /** @hide */ diff --git a/service-t/src/com/android/server/net/NetworkStatsService.java b/service-t/src/com/android/server/net/NetworkStatsService.java index 2beca73ecd..df066c21d7 100644 --- a/service-t/src/com/android/server/net/NetworkStatsService.java +++ b/service-t/src/com/android/server/net/NetworkStatsService.java @@ -655,8 +655,6 @@ public class NetworkStatsService extends INetworkStatsService.Stub { @Override public INetworkStatsSession openSession() { - // NOTE: if callers want to get non-augmented data, they should go - // through the public API return openSessionInternal(NetworkStatsManager.FLAG_AUGMENT_WITH_SUBSCRIPTION_PLAN, null); } @@ -876,8 +874,6 @@ public class NetworkStatsService extends INetworkStatsService.Stub { private long getNetworkTotalBytes(NetworkTemplate template, long start, long end) { assertSystemReady(); - // NOTE: if callers want to get non-augmented data, they should go - // through the public API return internalGetSummaryForNetwork(template, NetworkStatsManager.FLAG_AUGMENT_WITH_SUBSCRIPTION_PLAN, start, end, NetworkStatsAccess.Level.DEVICE, Binder.getCallingUid()).getTotalBytes();