summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorBenedict Wong <benedictwong@google.com>2019-06-06 17:06:39 -0700
committerLorenzo Colitti <lorenzo@google.com>2019-06-07 09:17:31 +0000
commit1fbf261c014edb969ad8a1107ca1feafd60e0c3b (patch)
tree6238d76eff114c75e89988e152cfb760363295a8 /core/java/android
parent54a08a686deceab667cac5ebe8800023d7ff7209 (diff)
Revert "Addressing comments for http://ag/7700679."
This reverts commit a229333986f95e48347fa8b653d7e1776019f84a. Reason for revert: This change has been implicated in 4-way deadlocks as seen in b/134244752. Bug: 134244752 Change-Id: I5fbb3443a39a21fc9d96442726cd10d20e8d61cd
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/net/NetworkStats.java14
1 files changed, 5 insertions, 9 deletions
diff --git a/core/java/android/net/NetworkStats.java b/core/java/android/net/NetworkStats.java
index bb344e289657..e8625f34f0c8 100644
--- a/core/java/android/net/NetworkStats.java
+++ b/core/java/android/net/NetworkStats.java
@@ -1300,8 +1300,7 @@ public class NetworkStats implements Parcelable {
}
final Entry tmpEntry = new Entry();
- final int origSize = size;
- for (int i = 0; i < origSize; i++) {
+ for (int i = 0; i < size; i++) {
if (!Objects.equals(iface[i], tunIface)) {
// Consider only entries that go onto the VPN interface.
continue;
@@ -1317,9 +1316,8 @@ public class NetworkStats implements Parcelable {
tmpEntry.roaming = roaming[i];
tmpEntry.defaultNetwork = defaultNetwork[i];
- // In a first pass, compute this entry's total share of data across all
- // underlyingIfaces. This is computed on the basis of the share of this entry's usage
- // over tunIface.
+ // In a first pass, compute each UID's total share of data across all underlyingIfaces.
+ // This is computed on the basis of the share of each UID's usage over tunIface.
// TODO: Consider refactoring first pass into a separate helper method.
long totalRxBytes = 0;
if (tunIfaceTotal.rxBytes > 0) {
@@ -1396,11 +1394,9 @@ public class NetworkStats implements Parcelable {
* perInterfaceTotal[j].operations
/ underlyingIfacesTotal.operations;
}
- // tmpEntry now contains the migrated data of the i-th entry for the j-th underlying
- // interface. Add that data usage to this object.
+
combineValues(tmpEntry);
if (tag[i] == TAG_NONE) {
- // Add the migrated data to moved so it is deducted from the VPN app later.
moved[j].add(tmpEntry);
// Add debug info
tmpEntry.set = SET_DBG_VPN_IN;
@@ -1416,8 +1412,8 @@ public class NetworkStats implements Parcelable {
@NonNull String[] underlyingIfaces,
@NonNull Entry[] moved) {
for (int i = 0; i < underlyingIfaces.length; i++) {
- moved[i].uid = tunUid;
// Add debug info
+ moved[i].uid = tunUid;
moved[i].set = SET_DBG_VPN_OUT;
moved[i].tag = TAG_NONE;
moved[i].iface = underlyingIfaces[i];