diff options
| author | Benedict Wong <benedictwong@google.com> | 2019-06-06 17:06:48 -0700 |
|---|---|---|
| committer | Lorenzo Colitti <lorenzo@google.com> | 2019-06-07 09:17:47 +0000 |
| commit | 055992b1126b243d51b60a0bc8de3cf97fe2c7cf (patch) | |
| tree | 553a05a4ceab735706f4d6f4bb660e6e4cff5e9e /core/java/android | |
| parent | 1fbf261c014edb969ad8a1107ca1feafd60e0c3b (diff) | |
Revert "NetworkStatsService: Fix getDetailedUidStats to take VPNs into account."
This reverts commit ed11b84131eae1e104af9be2c17fc9b07183eee3.
Reason for revert: This change has been implicated in 4-way deadlocks as seen in b/134244752.
Bug: 134244752
Change-Id: I0c00e8f0e30cee987b71b561079a97bf09d4dae4
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/net/NetworkStats.java | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/core/java/android/net/NetworkStats.java b/core/java/android/net/NetworkStats.java index e8625f34f0c8..f09f2ee22367 100644 --- a/core/java/android/net/NetworkStats.java +++ b/core/java/android/net/NetworkStats.java @@ -34,7 +34,6 @@ import libcore.util.EmptyArray; import java.io.CharArrayWriter; import java.io.PrintWriter; import java.util.Arrays; -import java.util.function.Predicate; import java.util.HashSet; import java.util.Map; import java.util.Objects; @@ -995,33 +994,23 @@ public class NetworkStats implements Parcelable { if (limitUid == UID_ALL && limitTag == TAG_ALL && limitIfaces == INTERFACES_ALL) { return; } - filter(e -> (limitUid == UID_ALL || limitUid == e.uid) - && (limitTag == TAG_ALL || limitTag == e.tag) - && (limitIfaces == INTERFACES_ALL - || ArrayUtils.contains(limitIfaces, e.iface))); - } - - /** - * Only keep entries with {@link #set} value less than {@link #SET_DEBUG_START}. - * - * <p>This mutates the original structure in place. - */ - public void filterDebugEntries() { - filter(e -> e.set < SET_DEBUG_START); - } - private void filter(Predicate<Entry> predicate) { Entry entry = new Entry(); int nextOutputEntry = 0; for (int i = 0; i < size; i++) { entry = getValues(i, entry); - if (predicate.test(entry)) { - if (nextOutputEntry != i) { - setValues(nextOutputEntry, entry); - } + final boolean matches = + (limitUid == UID_ALL || limitUid == entry.uid) + && (limitTag == TAG_ALL || limitTag == entry.tag) + && (limitIfaces == INTERFACES_ALL + || ArrayUtils.contains(limitIfaces, entry.iface)); + + if (matches) { + setValues(nextOutputEntry, entry); nextOutputEntry++; } } + size = nextOutputEntry; } |
