[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
diff --git a/framework-t/src/android/app/usage/NetworkStatsManager.java b/framework-t/src/android/app/usage/NetworkStatsManager.java
index 40b6371..2b9560e 100644
--- a/framework-t/src/android/app/usage/NetworkStatsManager.java
+++ b/framework-t/src/android/app/usage/NetworkStatsManager.java
@@ -139,6 +139,7 @@
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 2beca73..df066c2 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 @@
@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 @@
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();