VPN network stat accounting changes.
Properly account for VPN apps that make heavy use of the tun
interface. Prior to this change a VPN app could be incorrectly charged
for more data than it actually used if it sent more traffic through
the tun interface than the underlying interface.
This change excludes VPN app traffic on the tun interface from the
adjustment pool and doesn't redistribute traffic to the VPN app.
Instead all of the redistributed traffic is deducted from the VPN app
which effectively represents any overhead incurred by the VPN app.
BUG: 30557871
(cherry picked from commit 12255e3655)
Change-Id: I06f01aa8fe5fdc06b2d36cfb9c68feb244c2e5de
This commit is contained in:
committed by
Lorenzo Colitti
parent
a79b99893c
commit
921f6f6797
@@ -68,18 +68,11 @@ public class NetworkStats implements Parcelable {
|
|||||||
// TODO: Rename TAG_NONE to TAG_ALL.
|
// TODO: Rename TAG_NONE to TAG_ALL.
|
||||||
public static final int TAG_NONE = 0;
|
public static final int TAG_NONE = 0;
|
||||||
|
|
||||||
/** {@link #metered} value to account for all metered states. */
|
/** {@link #set} value for all roaming values. */
|
||||||
public static final int METERED_ALL = -1;
|
|
||||||
/** {@link #metered} value where native, unmetered data is accounted. */
|
|
||||||
public static final int METERED_NO = 0;
|
|
||||||
/** {@link #metered} value where metered data is accounted. */
|
|
||||||
public static final int METERED_YES = 1;
|
|
||||||
|
|
||||||
/** {@link #roaming} value to account for all roaming states. */
|
|
||||||
public static final int ROAMING_ALL = -1;
|
public static final int ROAMING_ALL = -1;
|
||||||
/** {@link #roaming} value where native, non-roaming data is accounted. */
|
/** {@link #set} value where native, non-roaming data is accounted. */
|
||||||
public static final int ROAMING_NO = 0;
|
public static final int ROAMING_NO = 0;
|
||||||
/** {@link #roaming} value where roaming data is accounted. */
|
/** {@link #set} value where roaming data is accounted. */
|
||||||
public static final int ROAMING_YES = 1;
|
public static final int ROAMING_YES = 1;
|
||||||
|
|
||||||
// TODO: move fields to "mVariable" notation
|
// TODO: move fields to "mVariable" notation
|
||||||
@@ -95,7 +88,6 @@ public class NetworkStats implements Parcelable {
|
|||||||
private int[] uid;
|
private int[] uid;
|
||||||
private int[] set;
|
private int[] set;
|
||||||
private int[] tag;
|
private int[] tag;
|
||||||
private int[] metered;
|
|
||||||
private int[] roaming;
|
private int[] roaming;
|
||||||
private long[] rxBytes;
|
private long[] rxBytes;
|
||||||
private long[] rxPackets;
|
private long[] rxPackets;
|
||||||
@@ -108,12 +100,6 @@ public class NetworkStats implements Parcelable {
|
|||||||
public int uid;
|
public int uid;
|
||||||
public int set;
|
public int set;
|
||||||
public int tag;
|
public int tag;
|
||||||
/**
|
|
||||||
* Note that this is only populated w/ the default value when read from /proc or written
|
|
||||||
* to disk. We merge in the correct value when reporting this value to clients of
|
|
||||||
* getSummary().
|
|
||||||
*/
|
|
||||||
public int metered;
|
|
||||||
/**
|
/**
|
||||||
* Note that this is only populated w/ the default value when read from /proc or written
|
* Note that this is only populated w/ the default value when read from /proc or written
|
||||||
* to disk. We merge in the correct value when reporting this value to clients of
|
* to disk. We merge in the correct value when reporting this value to clients of
|
||||||
@@ -137,17 +123,16 @@ public class NetworkStats implements Parcelable {
|
|||||||
|
|
||||||
public Entry(String iface, int uid, int set, int tag, long rxBytes, long rxPackets,
|
public Entry(String iface, int uid, int set, int tag, long rxBytes, long rxPackets,
|
||||||
long txBytes, long txPackets, long operations) {
|
long txBytes, long txPackets, long operations) {
|
||||||
this(iface, uid, set, tag, METERED_NO, ROAMING_NO, rxBytes, rxPackets, txBytes,
|
this(iface, uid, set, tag, ROAMING_NO, rxBytes, rxPackets, txBytes, txPackets,
|
||||||
txPackets, operations);
|
operations);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Entry(String iface, int uid, int set, int tag, int metered, int roaming,
|
public Entry(String iface, int uid, int set, int tag, int roaming, long rxBytes,
|
||||||
long rxBytes, long rxPackets, long txBytes, long txPackets, long operations) {
|
long rxPackets, long txBytes, long txPackets, long operations) {
|
||||||
this.iface = iface;
|
this.iface = iface;
|
||||||
this.uid = uid;
|
this.uid = uid;
|
||||||
this.set = set;
|
this.set = set;
|
||||||
this.tag = tag;
|
this.tag = tag;
|
||||||
this.metered = metered;
|
|
||||||
this.roaming = roaming;
|
this.roaming = roaming;
|
||||||
this.rxBytes = rxBytes;
|
this.rxBytes = rxBytes;
|
||||||
this.rxPackets = rxPackets;
|
this.rxPackets = rxPackets;
|
||||||
@@ -180,7 +165,6 @@ public class NetworkStats implements Parcelable {
|
|||||||
builder.append(" uid=").append(uid);
|
builder.append(" uid=").append(uid);
|
||||||
builder.append(" set=").append(setToString(set));
|
builder.append(" set=").append(setToString(set));
|
||||||
builder.append(" tag=").append(tagToString(tag));
|
builder.append(" tag=").append(tagToString(tag));
|
||||||
builder.append(" metered=").append(meteredToString(metered));
|
|
||||||
builder.append(" roaming=").append(roamingToString(roaming));
|
builder.append(" roaming=").append(roamingToString(roaming));
|
||||||
builder.append(" rxBytes=").append(rxBytes);
|
builder.append(" rxBytes=").append(rxBytes);
|
||||||
builder.append(" rxPackets=").append(rxPackets);
|
builder.append(" rxPackets=").append(rxPackets);
|
||||||
@@ -194,18 +178,13 @@ public class NetworkStats implements Parcelable {
|
|||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (o instanceof Entry) {
|
if (o instanceof Entry) {
|
||||||
final Entry e = (Entry) o;
|
final Entry e = (Entry) o;
|
||||||
return uid == e.uid && set == e.set && tag == e.tag && metered == e.metered
|
return uid == e.uid && set == e.set && tag == e.tag && roaming == e.roaming
|
||||||
&& roaming == e.roaming && rxBytes == e.rxBytes && rxPackets == e.rxPackets
|
&& rxBytes == e.rxBytes && rxPackets == e.rxPackets && txBytes == e.txBytes
|
||||||
&& txBytes == e.txBytes && txPackets == e.txPackets
|
&& txPackets == e.txPackets && operations == e.operations
|
||||||
&& operations == e.operations && iface.equals(e.iface);
|
&& iface.equals(e.iface);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return Objects.hash(uid, set, tag, metered, roaming, iface);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public NetworkStats(long elapsedRealtime, int initialSize) {
|
public NetworkStats(long elapsedRealtime, int initialSize) {
|
||||||
@@ -217,7 +196,6 @@ public class NetworkStats implements Parcelable {
|
|||||||
this.uid = new int[initialSize];
|
this.uid = new int[initialSize];
|
||||||
this.set = new int[initialSize];
|
this.set = new int[initialSize];
|
||||||
this.tag = new int[initialSize];
|
this.tag = new int[initialSize];
|
||||||
this.metered = new int[initialSize];
|
|
||||||
this.roaming = new int[initialSize];
|
this.roaming = new int[initialSize];
|
||||||
this.rxBytes = new long[initialSize];
|
this.rxBytes = new long[initialSize];
|
||||||
this.rxPackets = new long[initialSize];
|
this.rxPackets = new long[initialSize];
|
||||||
@@ -231,7 +209,6 @@ public class NetworkStats implements Parcelable {
|
|||||||
this.uid = EmptyArray.INT;
|
this.uid = EmptyArray.INT;
|
||||||
this.set = EmptyArray.INT;
|
this.set = EmptyArray.INT;
|
||||||
this.tag = EmptyArray.INT;
|
this.tag = EmptyArray.INT;
|
||||||
this.metered = EmptyArray.INT;
|
|
||||||
this.roaming = EmptyArray.INT;
|
this.roaming = EmptyArray.INT;
|
||||||
this.rxBytes = EmptyArray.LONG;
|
this.rxBytes = EmptyArray.LONG;
|
||||||
this.rxPackets = EmptyArray.LONG;
|
this.rxPackets = EmptyArray.LONG;
|
||||||
@@ -249,7 +226,6 @@ public class NetworkStats implements Parcelable {
|
|||||||
uid = parcel.createIntArray();
|
uid = parcel.createIntArray();
|
||||||
set = parcel.createIntArray();
|
set = parcel.createIntArray();
|
||||||
tag = parcel.createIntArray();
|
tag = parcel.createIntArray();
|
||||||
metered = parcel.createIntArray();
|
|
||||||
roaming = parcel.createIntArray();
|
roaming = parcel.createIntArray();
|
||||||
rxBytes = parcel.createLongArray();
|
rxBytes = parcel.createLongArray();
|
||||||
rxPackets = parcel.createLongArray();
|
rxPackets = parcel.createLongArray();
|
||||||
@@ -267,7 +243,6 @@ public class NetworkStats implements Parcelable {
|
|||||||
dest.writeIntArray(uid);
|
dest.writeIntArray(uid);
|
||||||
dest.writeIntArray(set);
|
dest.writeIntArray(set);
|
||||||
dest.writeIntArray(tag);
|
dest.writeIntArray(tag);
|
||||||
dest.writeIntArray(metered);
|
|
||||||
dest.writeIntArray(roaming);
|
dest.writeIntArray(roaming);
|
||||||
dest.writeLongArray(rxBytes);
|
dest.writeLongArray(rxBytes);
|
||||||
dest.writeLongArray(rxPackets);
|
dest.writeLongArray(rxPackets);
|
||||||
@@ -302,11 +277,10 @@ public class NetworkStats implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public NetworkStats addValues(String iface, int uid, int set, int tag, int metered, int roaming,
|
public NetworkStats addValues(String iface, int uid, int set, int tag, int roaming,
|
||||||
long rxBytes, long rxPackets, long txBytes, long txPackets, long operations) {
|
long rxBytes, long rxPackets, long txBytes, long txPackets, long operations) {
|
||||||
return addValues(new Entry(
|
return addValues(new Entry(
|
||||||
iface, uid, set, tag, metered, roaming, rxBytes, rxPackets, txBytes, txPackets,
|
iface, uid, set, tag, roaming, rxBytes, rxPackets, txBytes, txPackets, operations));
|
||||||
operations));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -320,7 +294,6 @@ public class NetworkStats implements Parcelable {
|
|||||||
uid = Arrays.copyOf(uid, newLength);
|
uid = Arrays.copyOf(uid, newLength);
|
||||||
set = Arrays.copyOf(set, newLength);
|
set = Arrays.copyOf(set, newLength);
|
||||||
tag = Arrays.copyOf(tag, newLength);
|
tag = Arrays.copyOf(tag, newLength);
|
||||||
metered = Arrays.copyOf(metered, newLength);
|
|
||||||
roaming = Arrays.copyOf(roaming, newLength);
|
roaming = Arrays.copyOf(roaming, newLength);
|
||||||
rxBytes = Arrays.copyOf(rxBytes, newLength);
|
rxBytes = Arrays.copyOf(rxBytes, newLength);
|
||||||
rxPackets = Arrays.copyOf(rxPackets, newLength);
|
rxPackets = Arrays.copyOf(rxPackets, newLength);
|
||||||
@@ -334,7 +307,6 @@ public class NetworkStats implements Parcelable {
|
|||||||
uid[size] = entry.uid;
|
uid[size] = entry.uid;
|
||||||
set[size] = entry.set;
|
set[size] = entry.set;
|
||||||
tag[size] = entry.tag;
|
tag[size] = entry.tag;
|
||||||
metered[size] = entry.metered;
|
|
||||||
roaming[size] = entry.roaming;
|
roaming[size] = entry.roaming;
|
||||||
rxBytes[size] = entry.rxBytes;
|
rxBytes[size] = entry.rxBytes;
|
||||||
rxPackets[size] = entry.rxPackets;
|
rxPackets[size] = entry.rxPackets;
|
||||||
@@ -355,7 +327,6 @@ public class NetworkStats implements Parcelable {
|
|||||||
entry.uid = uid[i];
|
entry.uid = uid[i];
|
||||||
entry.set = set[i];
|
entry.set = set[i];
|
||||||
entry.tag = tag[i];
|
entry.tag = tag[i];
|
||||||
entry.metered = metered[i];
|
|
||||||
entry.roaming = roaming[i];
|
entry.roaming = roaming[i];
|
||||||
entry.rxBytes = rxBytes[i];
|
entry.rxBytes = rxBytes[i];
|
||||||
entry.rxPackets = rxPackets[i];
|
entry.rxPackets = rxPackets[i];
|
||||||
@@ -410,8 +381,7 @@ public class NetworkStats implements Parcelable {
|
|||||||
* also be used to subtract values from existing rows.
|
* also be used to subtract values from existing rows.
|
||||||
*/
|
*/
|
||||||
public NetworkStats combineValues(Entry entry) {
|
public NetworkStats combineValues(Entry entry) {
|
||||||
final int i = findIndex(entry.iface, entry.uid, entry.set, entry.tag, entry.metered,
|
final int i = findIndex(entry.iface, entry.uid, entry.set, entry.tag, entry.roaming);
|
||||||
entry.roaming);
|
|
||||||
if (i == -1) {
|
if (i == -1) {
|
||||||
// only create new entry when positive contribution
|
// only create new entry when positive contribution
|
||||||
addValues(entry);
|
addValues(entry);
|
||||||
@@ -439,11 +409,10 @@ public class NetworkStats implements Parcelable {
|
|||||||
/**
|
/**
|
||||||
* Find first stats index that matches the requested parameters.
|
* Find first stats index that matches the requested parameters.
|
||||||
*/
|
*/
|
||||||
public int findIndex(String iface, int uid, int set, int tag, int metered, int roaming) {
|
public int findIndex(String iface, int uid, int set, int tag, int roaming) {
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
if (uid == this.uid[i] && set == this.set[i] && tag == this.tag[i]
|
if (uid == this.uid[i] && set == this.set[i] && tag == this.tag[i]
|
||||||
&& metered == this.metered[i] && roaming == this.roaming[i]
|
&& roaming == this.roaming[i] && Objects.equals(iface, this.iface[i])) {
|
||||||
&& Objects.equals(iface, this.iface[i])) {
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -455,7 +424,7 @@ public class NetworkStats implements Parcelable {
|
|||||||
* search around the hinted index as an optimization.
|
* search around the hinted index as an optimization.
|
||||||
*/
|
*/
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public int findIndexHinted(String iface, int uid, int set, int tag, int metered, int roaming,
|
public int findIndexHinted(String iface, int uid, int set, int tag, int roaming,
|
||||||
int hintIndex) {
|
int hintIndex) {
|
||||||
for (int offset = 0; offset < size; offset++) {
|
for (int offset = 0; offset < size; offset++) {
|
||||||
final int halfOffset = offset / 2;
|
final int halfOffset = offset / 2;
|
||||||
@@ -469,8 +438,7 @@ public class NetworkStats implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (uid == this.uid[i] && set == this.set[i] && tag == this.tag[i]
|
if (uid == this.uid[i] && set == this.set[i] && tag == this.tag[i]
|
||||||
&& metered == this.metered[i] && roaming == this.roaming[i]
|
&& roaming == this.roaming[i] && Objects.equals(iface, this.iface[i])) {
|
||||||
&& Objects.equals(iface, this.iface[i])) {
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -484,7 +452,7 @@ public class NetworkStats implements Parcelable {
|
|||||||
*/
|
*/
|
||||||
public void spliceOperationsFrom(NetworkStats stats) {
|
public void spliceOperationsFrom(NetworkStats stats) {
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
final int j = stats.findIndex(iface[i], uid[i], set[i], tag[i], metered[i], roaming[i]);
|
final int j = stats.findIndex(iface[i], uid[i], set[i], tag[i], roaming[i]);
|
||||||
if (j == -1) {
|
if (j == -1) {
|
||||||
operations[i] = 0;
|
operations[i] = 0;
|
||||||
} else {
|
} else {
|
||||||
@@ -574,7 +542,6 @@ public class NetworkStats implements Parcelable {
|
|||||||
entry.uid = limitUid;
|
entry.uid = limitUid;
|
||||||
entry.set = SET_ALL;
|
entry.set = SET_ALL;
|
||||||
entry.tag = TAG_NONE;
|
entry.tag = TAG_NONE;
|
||||||
entry.metered = METERED_ALL;
|
|
||||||
entry.roaming = ROAMING_ALL;
|
entry.roaming = ROAMING_ALL;
|
||||||
entry.rxBytes = 0;
|
entry.rxBytes = 0;
|
||||||
entry.rxPackets = 0;
|
entry.rxPackets = 0;
|
||||||
@@ -670,12 +637,11 @@ public class NetworkStats implements Parcelable {
|
|||||||
entry.uid = left.uid[i];
|
entry.uid = left.uid[i];
|
||||||
entry.set = left.set[i];
|
entry.set = left.set[i];
|
||||||
entry.tag = left.tag[i];
|
entry.tag = left.tag[i];
|
||||||
entry.metered = left.metered[i];
|
|
||||||
entry.roaming = left.roaming[i];
|
entry.roaming = left.roaming[i];
|
||||||
|
|
||||||
// find remote row that matches, and subtract
|
// find remote row that matches, and subtract
|
||||||
final int j = right.findIndexHinted(entry.iface, entry.uid, entry.set, entry.tag,
|
final int j = right.findIndexHinted(entry.iface, entry.uid, entry.set, entry.tag,
|
||||||
entry.metered, entry.roaming, i);
|
entry.roaming, i);
|
||||||
if (j == -1) {
|
if (j == -1) {
|
||||||
// newly appearing row, return entire value
|
// newly appearing row, return entire value
|
||||||
entry.rxBytes = left.rxBytes[i];
|
entry.rxBytes = left.rxBytes[i];
|
||||||
@@ -721,7 +687,6 @@ public class NetworkStats implements Parcelable {
|
|||||||
entry.uid = UID_ALL;
|
entry.uid = UID_ALL;
|
||||||
entry.set = SET_ALL;
|
entry.set = SET_ALL;
|
||||||
entry.tag = TAG_NONE;
|
entry.tag = TAG_NONE;
|
||||||
entry.metered = METERED_ALL;
|
|
||||||
entry.roaming = ROAMING_ALL;
|
entry.roaming = ROAMING_ALL;
|
||||||
entry.operations = 0L;
|
entry.operations = 0L;
|
||||||
|
|
||||||
@@ -751,7 +716,6 @@ public class NetworkStats implements Parcelable {
|
|||||||
entry.iface = IFACE_ALL;
|
entry.iface = IFACE_ALL;
|
||||||
entry.set = SET_ALL;
|
entry.set = SET_ALL;
|
||||||
entry.tag = TAG_NONE;
|
entry.tag = TAG_NONE;
|
||||||
entry.metered = METERED_ALL;
|
|
||||||
entry.roaming = ROAMING_ALL;
|
entry.roaming = ROAMING_ALL;
|
||||||
|
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
@@ -798,7 +762,6 @@ public class NetworkStats implements Parcelable {
|
|||||||
pw.print(" uid="); pw.print(uid[i]);
|
pw.print(" uid="); pw.print(uid[i]);
|
||||||
pw.print(" set="); pw.print(setToString(set[i]));
|
pw.print(" set="); pw.print(setToString(set[i]));
|
||||||
pw.print(" tag="); pw.print(tagToString(tag[i]));
|
pw.print(" tag="); pw.print(tagToString(tag[i]));
|
||||||
pw.print(" metered="); pw.print(meteredToString(metered[i]));
|
|
||||||
pw.print(" roaming="); pw.print(roamingToString(roaming[i]));
|
pw.print(" roaming="); pw.print(roamingToString(roaming[i]));
|
||||||
pw.print(" rxBytes="); pw.print(rxBytes[i]);
|
pw.print(" rxBytes="); pw.print(rxBytes[i]);
|
||||||
pw.print(" rxPackets="); pw.print(rxPackets[i]);
|
pw.print(" rxPackets="); pw.print(rxPackets[i]);
|
||||||
@@ -866,22 +829,6 @@ public class NetworkStats implements Parcelable {
|
|||||||
return "0x" + Integer.toHexString(tag);
|
return "0x" + Integer.toHexString(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return text description of {@link #metered} value.
|
|
||||||
*/
|
|
||||||
public static String meteredToString(int metered) {
|
|
||||||
switch (metered) {
|
|
||||||
case METERED_ALL:
|
|
||||||
return "ALL";
|
|
||||||
case METERED_NO:
|
|
||||||
return "NO";
|
|
||||||
case METERED_YES:
|
|
||||||
return "YES";
|
|
||||||
default:
|
|
||||||
return "UNKNOWN";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return text description of {@link #roaming} value.
|
* Return text description of {@link #roaming} value.
|
||||||
*/
|
*/
|
||||||
@@ -1051,7 +998,6 @@ public class NetworkStats implements Parcelable {
|
|||||||
tmpEntry.uid = uid[i];
|
tmpEntry.uid = uid[i];
|
||||||
tmpEntry.tag = tag[i];
|
tmpEntry.tag = tag[i];
|
||||||
tmpEntry.set = set[i];
|
tmpEntry.set = set[i];
|
||||||
tmpEntry.metered = metered[i];
|
|
||||||
tmpEntry.roaming = roaming[i];
|
tmpEntry.roaming = roaming[i];
|
||||||
combineValues(tmpEntry);
|
combineValues(tmpEntry);
|
||||||
if (tag[i] == TAG_NONE) {
|
if (tag[i] == TAG_NONE) {
|
||||||
@@ -1071,25 +1017,24 @@ public class NetworkStats implements Parcelable {
|
|||||||
moved.set = SET_DBG_VPN_OUT;
|
moved.set = SET_DBG_VPN_OUT;
|
||||||
moved.tag = TAG_NONE;
|
moved.tag = TAG_NONE;
|
||||||
moved.iface = underlyingIface;
|
moved.iface = underlyingIface;
|
||||||
moved.metered = METERED_ALL;
|
|
||||||
moved.roaming = ROAMING_ALL;
|
moved.roaming = ROAMING_ALL;
|
||||||
combineValues(moved);
|
combineValues(moved);
|
||||||
|
|
||||||
// Caveat: if the vpn software uses tag, the total tagged traffic may be greater than
|
// Caveat: if the vpn software uses tag, the total tagged traffic may be greater than
|
||||||
// the TAG_NONE traffic.
|
// the TAG_NONE traffic.
|
||||||
//
|
//
|
||||||
// Relies on the fact that the underlying traffic only has state ROAMING_NO and METERED_NO,
|
// Relies on the fact that the underlying traffic only has state ROAMING_NO, which
|
||||||
// which should be the case as it comes directly from the /proc file. We only blend in the
|
// should be the case as it comes directly from the /proc file. We only blend in the
|
||||||
// roaming data after applying these adjustments, by checking the NetworkIdentity of the
|
// roaming data after applying these adjustments, by checking the NetworkIdentity of the
|
||||||
// underlying iface.
|
// underlying iface.
|
||||||
int idxVpnBackground = findIndex(underlyingIface, tunUid, SET_DEFAULT, TAG_NONE,
|
int idxVpnBackground = findIndex(underlyingIface, tunUid, SET_DEFAULT, TAG_NONE,
|
||||||
METERED_NO, ROAMING_NO);
|
ROAMING_NO);
|
||||||
if (idxVpnBackground != -1) {
|
if (idxVpnBackground != -1) {
|
||||||
tunSubtract(idxVpnBackground, this, moved);
|
tunSubtract(idxVpnBackground, this, moved);
|
||||||
}
|
}
|
||||||
|
|
||||||
int idxVpnForeground = findIndex(underlyingIface, tunUid, SET_FOREGROUND, TAG_NONE,
|
int idxVpnForeground = findIndex(underlyingIface, tunUid, SET_FOREGROUND, TAG_NONE,
|
||||||
METERED_NO, ROAMING_NO);
|
ROAMING_NO);
|
||||||
if (idxVpnForeground != -1) {
|
if (idxVpnForeground != -1) {
|
||||||
tunSubtract(idxVpnForeground, this, moved);
|
tunSubtract(idxVpnForeground, this, moved);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user