summaryrefslogtreecommitdiff
path: root/framework-t/src/android/app/usage/NetworkStatsManager.java
diff options
context:
space:
mode:
authorFrank Li <lifr@google.com>2022-03-03 02:54:44 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-03-03 02:54:44 +0000
commit4227d880495a060ff1d8d8f5867195c7adbfb4bd (patch)
tree1a6f77f3862cc2b0f5657ad8d67838edec4d705d /framework-t/src/android/app/usage/NetworkStatsManager.java
parent02ac2482a1d55bd2759c8d4d18999654eff3b12f (diff)
parent0cc12cf02d5404300f4a13405d3a250f04ec1902 (diff)
Merge "[MS68.3] Address comments at aosp/1958144" am: 0cc12cf02d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1964907 Change-Id: Idd8ef239098fe5806d099e9392662479dfedebbc
Diffstat (limited to 'framework-t/src/android/app/usage/NetworkStatsManager.java')
-rw-r--r--framework-t/src/android/app/usage/NetworkStatsManager.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/framework-t/src/android/app/usage/NetworkStatsManager.java b/framework-t/src/android/app/usage/NetworkStatsManager.java
index a8baa8e488..ca080ce4c6 100644
--- a/framework-t/src/android/app/usage/NetworkStatsManager.java
+++ b/framework-t/src/android/app/usage/NetworkStatsManager.java
@@ -744,8 +744,9 @@ public class NetworkStatsManager {
* {@link #unregisterUsageCallback} is called.
*
* @param template Template used to match networks. See {@link NetworkTemplate}.
- * @param thresholdBytes Threshold in bytes to be notified on. The provided value that lower
- * than 2MiB will be clamped for non-privileged callers.
+ * @param thresholdBytes Threshold in bytes to be notified on. Provided values lower than 2MiB
+ * will be clamped for callers except callers with the NETWORK_STACK
+ * permission.
* @param executor The executor on which callback will be invoked. The provided {@link Executor}
* must run callback sequentially, otherwise the order of callbacks cannot be
* guaranteed.
@@ -754,6 +755,9 @@ public class NetworkStatsManager {
* @hide
*/
@SystemApi(client = MODULE_LIBRARIES)
+ @RequiresPermission(anyOf = {
+ NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK,
+ android.Manifest.permission.NETWORK_STACK}, conditional = true)
public void registerUsageCallback(@NonNull NetworkTemplate template, long thresholdBytes,
@NonNull @CallbackExecutor Executor executor, @NonNull UsageCallback callback) {
Objects.requireNonNull(template, "NetworkTemplate cannot be null");