summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Benedict Wong <benedictwong@google.com> 2019-06-20 14:46:35 -0700
committer Benedict Wong <benedictwong@google.com> 2019-06-21 01:12:41 +0000
commit51a770bfc7d26f359a147efa235c2b7e110b0b9a (patch)
tree422a7d861dd26e99098f3e9007f48bcc7ff39aa8
parent8cdd41eb34d76d50689da7200197c5a27c6a50cd (diff)
Inline readNetworkStatsDetailInternal, make mUseBpfStats final
This change inlines the logic from readNetworkStatsDetailInternal, and reduces reundant checks in mUseBpfStats Bug: 113122541 Test: atest FrameworksNetTests run, passing Merged-In: If2ef8d8f038f32c8cf974aa02cfc1dc7e44dbad3 Change-Id: If7d41052115ed145da8a610d676f6ed33c8d5e63 (cherry picked from commit 8c9d8c5e05cd35a340c4224c61f7fa9e95b5c861)
-rw-r--r--services/core/java/com/android/server/net/NetworkStatsFactory.java31
1 files changed, 12 insertions, 19 deletions
diff --git a/services/core/java/com/android/server/net/NetworkStatsFactory.java b/services/core/java/com/android/server/net/NetworkStatsFactory.java
index 2d3c66d68f21..7687718b0693 100644
--- a/services/core/java/com/android/server/net/NetworkStatsFactory.java
+++ b/services/core/java/com/android/server/net/NetworkStatsFactory.java
@@ -68,7 +68,7 @@ public class NetworkStatsFactory {
/** Path to {@code /proc/net/xt_qtaguid/stats}. */
private final File mStatsXtUid;
- private boolean mUseBpfStats;
+ private final boolean mUseBpfStats;
private INetd mNetdService;
@@ -302,6 +302,17 @@ public class NetworkStatsFactory {
return readNetworkStatsDetail(UID_ALL, INTERFACES_ALL, TAG_ALL);
}
+ @GuardedBy("sPersistentDataLock")
+ private void requestSwapActiveStatsMapLocked() throws RemoteException {
+ // Ask netd to do a active map stats swap. When the binder call successfully returns,
+ // the system server should be able to safely read and clean the inactive map
+ // without race problem.
+ if (mNetdService == null) {
+ mNetdService = NetdService.getInstance();
+ }
+ mNetdService.trafficSwapActiveStatsMap();
+ }
+
/**
* Reads the detailed UID stats based on the provided parameters
*
@@ -312,24 +323,6 @@ public class NetworkStatsFactory {
* @return the NetworkStats instance containing network statistics at the present time.
*/
public NetworkStats readNetworkStatsDetail(
- int limitUid, @Nullable String[] limitIfaces, int limitTag) throws IOException {
- return readNetworkStatsDetailInternal(limitUid, limitIfaces, limitTag);
- }
-
- @GuardedBy("sPersistentDataLock")
- private void requestSwapActiveStatsMapLocked() throws RemoteException {
- // Ask netd to do a active map stats swap. When the binder call successfully returns,
- // the system server should be able to safely read and clean the inactive map
- // without race problem.
- if (mUseBpfStats) {
- if (mNetdService == null) {
- mNetdService = NetdService.getInstance();
- }
- mNetdService.trafficSwapActiveStatsMap();
- }
- }
-
- private NetworkStats readNetworkStatsDetailInternal(
int limitUid, String[] limitIfaces, int limitTag) throws IOException {
// In order to prevent deadlocks, anything protected by this lock MUST NOT call out to other
// code that will acquire other locks within the system server. See b/134244752.