From ea76fb897961d4b797affd41a9f5cdd61902c2c1 Mon Sep 17 00:00:00 2001 From: junyulai Date: Fri, 29 May 2020 14:32:21 +0800 Subject: [PATCH] Address ag/11592772 leftover comments Test: TH Bug: 156313635 Change-Id: I3180050ca658deb14fbe86f0af6ba903a40564a4 --- .../server/stats/pull/StatsPullAtomService.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java b/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java index 263c096f056f3..3f713970a55e6 100644 --- a/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java +++ b/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java @@ -684,10 +684,14 @@ public class StatsPullAtomService extends SystemService { /** * Return the {@code INetworkStatsSession} object that holds the necessary properties needed * for the subsequent queries to {@link com.android.server.net.NetworkStatsService}. Or - * null if the service or binder cannot be obtained. + * null if the service or binder cannot be obtained. Calling this method will trigger poll + * in NetworkStatsService with once per 15 seconds rate-limit, unless {@code bypassRateLimit} + * is set to true. This is needed in {@link #getUidNetworkStatsSnapshotForTemplate}, where + * bypassing the limit is necessary for perfd to supply realtime stats to developers looking at + * the network usage of their app. */ @Nullable - private INetworkStatsSession getNetworkStatsSession(boolean forcePoll) { + private INetworkStatsSession getNetworkStatsSession(boolean bypassRateLimit) { final INetworkStatsService networkStatsService = INetworkStatsService.Stub.asInterface( ServiceManager.getService(Context.NETWORK_STATS_SERVICE)); @@ -695,7 +699,7 @@ public class StatsPullAtomService extends SystemService { try { return networkStatsService.openSessionForUsageStats( - FLAG_AUGMENT_WITH_SUBSCRIPTION_PLAN | (forcePoll ? FLAG_POLL_FORCE + FLAG_AUGMENT_WITH_SUBSCRIPTION_PLAN | (bypassRateLimit ? FLAG_POLL_FORCE : FLAG_POLL_ON_OPEN), mContext.getOpPackageName()); } catch (RemoteException e) { Slog.e(TAG, "Cannot get NetworkStats session", e);